Skip to content

Commit c9bd49c

Browse files
author
Pedro Duarte
committed
01/05/2009 - v1.0.3.0
- Now loads the .wad from current directory. No need to put it at a root of a USB device anymore. As consequence, loads perfectly from memory card. - The Quit option menu now boots back to the OSD PS2 Browser
1 parent a1188f1 commit c9bd49c

File tree

10 files changed

+757
-622
lines changed

10 files changed

+757
-622
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \
77
p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o \
88
p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o \
99
r_main.o r_plane.o r_segs.o r_sky.o r_things.o s_sound.o sounds.o \
10-
st_lib.o st_stuff.o tables.o v_video.o w_wad.o wi_stuff.o z_zone.o ps2doom.o mixer_thread.o mixer.o sjpcm_rpc.o usbd.s usbhdfsd.s SJPCM.s
10+
st_lib.o st_stuff.o tables.o v_video.o w_wad.o wi_stuff.o z_zone.o ps2doom.o mixer_thread.o mixer.o cosmitoFileIO.o sjpcm_rpc.o usbd.s usbhdfsd.s SJPCM.s
1111

1212
EE_BIN = ps2doom.elf
1313

Whatsthis.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Is is version 1.0.2.2 of PS2Doom, a port of Doom for the PS2, started by Lukasz Bruun (http://lukasz.dk) and currently maintained by me, cosmito (http://ps2homebrewing.wordpress.com). It also features audio support functions by Jason Yu (http://www.jasonyu.net).
1+
Is is version 1.0.3.0 of PS2Doom, a port of Doom for the PS2, started by Lukasz Bruun (http://lukasz.dk) and currently maintained by me, cosmito (http://ps2homebrewing.wordpress.com). It also features audio support functions by Jason Yu (http://www.jasonyu.net).
22

3-
Run PS2Doom.elf using uLaunchELF and make sure you have a doom1.wad, doom.wad, or doom2.wad copied at the root of a USB pen attached to tou PS2 (put only one .wad at the USB pen since currently no selector is made).
3+
Run PS2Doom.elf using uLaunchELF and make sure you have a doom1.wad, doom.wad, or doom2.wad copied at the same directory as the ps2doom.elf. Memory cards and USB storage devices can be used and also. Currently HD support is not implemented. Put only one .wad at a time since currently no selector is made yet.
44

55

66
Dualshock Joystick mappings:
@@ -23,7 +23,7 @@ Analog Right click: Brightness (gamma)
2323

2424
Please note: Enter key action (required to menu operations like starting new game) is a bit clumsy for now. For bringing up the menu, use the Cross button but to select items, use the Start button. This will be fixed.
2525

26-
You can use any USB compatible with the PlayStation2 also.
26+
You can use any USB compatible keyboard with the PlayStation2 also.
2727

2828

2929
Source is included. Also a Visual Studio 2005 project just for code browsing (it doesn't compile).
@@ -45,6 +45,10 @@ cosmito
4545
History:
4646
========
4747

48+
01/05/2009 - v1.0.3.0
49+
- Now loads the .wad from current directory. No need to put it at a root of a USB device anymore. As consequence, loads perfectly from memory card.
50+
- The Quit option menu now boots back to the OSD PS2 Browser
51+
4852
20/04/2009 - v1.0.2.2
4953
- Enabled game save/load to memory card (mc0:). Use R1 e R2 buttons to write funny savenames
5054
- Nicer 'debug' font (thanks NoEffex and Allen http://forums.ps2dev.org/viewtopic.php?t=11663)

cosmitoFileIO.c

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#include "cosmitoFileIO.h"
2+
3+
// Note: This calls fseek, so watch out...
4+
int GetFilesize(FILE * fd)
5+
{
6+
int size;
7+
fseek(fd, 0, SEEK_END);
8+
size = (int)ftell(fd);
9+
fseek(fd, 0, SEEK_SET);
10+
return (size);
11+
}
12+
13+
///
14+
int GetWAVsize(char *filename)
15+
{
16+
int size;
17+
FILE *wav;
18+
wav = fopen(filename, "rb");
19+
20+
if (wav != NULL)
21+
{
22+
fseek(wav, 0, SEEK_END);
23+
size = (int)ftell(wav);
24+
size -= 0x30;
25+
fclose(wav);
26+
return size;
27+
}
28+
else
29+
return 0;
30+
}
31+
32+
/// TBD
33+
//// Dynamically mallocs a signed char buffer and loads from file into it. res < 0 means error.
34+
//FILE AllocLoad_scharbuffer(char *filename, int optionalBufSize, int *res)
35+
//{
36+
// FILE *fd;
37+
// int size;
38+
//
39+
//
40+
// if (optionalBufSize == 0)
41+
//
42+
//}
43+
44+
///
45+
void GetElfFilename(const char *argv0_probe, char* deviceName, char* fullPath, char* elfFilename)
46+
{
47+
int i;
48+
49+
int lenght = strlen(argv0_probe);
50+
int doispontosIndex = 0;
51+
int slashIndex = 0;
52+
int isFileOnRoot = 0;
53+
54+
55+
// locate '/' from the end of path
56+
for(i=lenght-1; i>=0; i--)
57+
{
58+
if (argv0_probe[i] == '/')
59+
{
60+
slashIndex = i;
61+
break;
62+
}
63+
}
64+
if (slashIndex == 0)
65+
isFileOnRoot = 1; // elf is located on root of device
66+
67+
// locate ':' from the start of path
68+
for(i=0; i<lenght; i++)
69+
{
70+
if (argv0_probe[i] == ':')
71+
{
72+
doispontosIndex = i;
73+
break;
74+
}
75+
}
76+
77+
// set deviceName to device name (ex: 'mass:', 'host:', 'mc0', etc)
78+
strncpy(deviceName, argv0_probe, doispontosIndex+1);
79+
deviceName[doispontosIndex+1] = 0;
80+
81+
// set fullPath to full path (ex: 'mass:directory/', 'mass:directory1/directory2', etc (no limit over depth))
82+
if (isFileOnRoot)
83+
strcpy(fullPath, deviceName); // fullPath = deviceName actually
84+
else
85+
{
86+
strncpy(fullPath, argv0_probe, slashIndex+1);
87+
fullPath[slashIndex+1] = 0;
88+
}
89+
90+
// set elfFilename
91+
if (isFileOnRoot)
92+
memcpy(elfFilename, argv0_probe + doispontosIndex + 1, lenght - doispontosIndex);
93+
else
94+
memcpy(elfFilename, argv0_probe + slashIndex + 1, lenght - slashIndex);
95+
}

cosmitoFileIO.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef _COSMITOFILEIO
2+
#define _COSMITOFILEIO
3+
4+
#include <stdio.h>
5+
#include <string.h>
6+
7+
// Note: This calls fseek, so watch out...
8+
int GetFilesize(FILE * fd);
9+
10+
int GetWAVsize(char *filename);
11+
12+
void GetElfFilename(const char *argv0_probe, char* deviceName, char* fullPath, char* elfFilename);
13+
14+
#endif // _COSMITOFILEIO

d_main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ static int access(char *file, int mode)
8686
#include "p_setup.h"
8787
#include "r_local.h"
8888

89+
#include "cosmitoFileIO.h"
8990

9091
#include "d_main.h"
9192

@@ -588,11 +589,20 @@ void IdentifyVersion (void)
588589

589590
char *home;
590591
char *doomwaddir;
592+
593+
#ifdef _EE
594+
char elfFilename[100];
595+
char deviceName[10];
596+
char fullPath[100];
597+
#endif
598+
591599
doomwaddir = getenv("DOOMWADDIR");
592600

593601
#ifdef _EE
594602
//doomwaddir = "";
595-
doomwaddir = "mass:";
603+
//doomwaddir = "mass:";
604+
GetElfFilename(myargv[0], deviceName, fullPath, elfFilename);
605+
doomwaddir = fullPath;
596606
#else
597607
if (!doomwaddir)
598608
doomwaddir = "./";

i_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static char s_pUDNL [] __attribute__( ( section( ".data" ), aligned( 1 ) )
5757
#include <kernel.h> //for GetThreadId
5858
#include <libmc.h>
5959

60+
#include "cosmitoFileIO.h"
61+
62+
6063
extern int SAMPLECOUNT;
6164

6265
int getDisplayModeFromELFName(char **argv);
@@ -74,8 +77,9 @@ int main( int argc, char** argv )
7477
SifInitRpc(0);
7578

7679
init_scr();
77-
scr_printf(" --==== PS2DOOM v1.0.2.2 ====--\n\n");
78-
scr_printf(" A Doom PS2 port started by Lukasz Bruun and improved by cosmito\n\n\n");
80+
//scr_printf(" --==== PS2DOOM v1.0.2.2 ====--\n\n");
81+
//scr_printf(" A Doom PS2 port started by Lukasz Bruun and improved by cosmito\n\n\n");
82+
scr_printf(" --==== PS2DOOM v1.0.3.0 ====--\n\n\n");
7983

8084
int ret;
8185
printf("sample: kicking IRXs\n");

i_system.c

184 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)