Skip to content

Commit

Permalink
01/05/2009 - v1.0.3.0
Browse files Browse the repository at this point in the history
  - 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
  • Loading branch information
Pedro Duarte committed Mar 20, 2021
1 parent a1188f1 commit c9bd49c
Show file tree
Hide file tree
Showing 10 changed files with 757 additions and 622 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o \
p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o \
r_main.o r_plane.o r_segs.o r_sky.o r_things.o s_sound.o sounds.o \
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
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

EE_BIN = ps2doom.elf

Expand Down
10 changes: 7 additions & 3 deletions Whatsthis.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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).
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).

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).
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.


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

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.

You can use any USB compatible with the PlayStation2 also.
You can use any USB compatible keyboard with the PlayStation2 also.


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

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

20/04/2009 - v1.0.2.2
- Enabled game save/load to memory card (mc0:). Use R1 e R2 buttons to write funny savenames
- Nicer 'debug' font (thanks NoEffex and Allen http://forums.ps2dev.org/viewtopic.php?t=11663)
Expand Down
95 changes: 95 additions & 0 deletions cosmitoFileIO.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include "cosmitoFileIO.h"

// Note: This calls fseek, so watch out...
int GetFilesize(FILE * fd)
{
int size;
fseek(fd, 0, SEEK_END);
size = (int)ftell(fd);
fseek(fd, 0, SEEK_SET);
return (size);
}

///
int GetWAVsize(char *filename)
{
int size;
FILE *wav;
wav = fopen(filename, "rb");

if (wav != NULL)
{
fseek(wav, 0, SEEK_END);
size = (int)ftell(wav);
size -= 0x30;
fclose(wav);
return size;
}
else
return 0;
}

/// TBD
//// Dynamically mallocs a signed char buffer and loads from file into it. res < 0 means error.
//FILE AllocLoad_scharbuffer(char *filename, int optionalBufSize, int *res)
//{
// FILE *fd;
// int size;
//
//
// if (optionalBufSize == 0)
//
//}

///
void GetElfFilename(const char *argv0_probe, char* deviceName, char* fullPath, char* elfFilename)
{
int i;

int lenght = strlen(argv0_probe);
int doispontosIndex = 0;
int slashIndex = 0;
int isFileOnRoot = 0;


// locate '/' from the end of path
for(i=lenght-1; i>=0; i--)
{
if (argv0_probe[i] == '/')
{
slashIndex = i;
break;
}
}
if (slashIndex == 0)
isFileOnRoot = 1; // elf is located on root of device

// locate ':' from the start of path
for(i=0; i<lenght; i++)
{
if (argv0_probe[i] == ':')
{
doispontosIndex = i;
break;
}
}

// set deviceName to device name (ex: 'mass:', 'host:', 'mc0', etc)
strncpy(deviceName, argv0_probe, doispontosIndex+1);
deviceName[doispontosIndex+1] = 0;

// set fullPath to full path (ex: 'mass:directory/', 'mass:directory1/directory2', etc (no limit over depth))
if (isFileOnRoot)
strcpy(fullPath, deviceName); // fullPath = deviceName actually
else
{
strncpy(fullPath, argv0_probe, slashIndex+1);
fullPath[slashIndex+1] = 0;
}

// set elfFilename
if (isFileOnRoot)
memcpy(elfFilename, argv0_probe + doispontosIndex + 1, lenght - doispontosIndex);
else
memcpy(elfFilename, argv0_probe + slashIndex + 1, lenght - slashIndex);
}
14 changes: 14 additions & 0 deletions cosmitoFileIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef _COSMITOFILEIO
#define _COSMITOFILEIO

#include <stdio.h>
#include <string.h>

// Note: This calls fseek, so watch out...
int GetFilesize(FILE * fd);

int GetWAVsize(char *filename);

void GetElfFilename(const char *argv0_probe, char* deviceName, char* fullPath, char* elfFilename);

#endif // _COSMITOFILEIO
12 changes: 11 additions & 1 deletion d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static int access(char *file, int mode)
#include "p_setup.h"
#include "r_local.h"

#include "cosmitoFileIO.h"

#include "d_main.h"

Expand Down Expand Up @@ -588,11 +589,20 @@ void IdentifyVersion (void)

char *home;
char *doomwaddir;

#ifdef _EE
char elfFilename[100];
char deviceName[10];
char fullPath[100];
#endif

doomwaddir = getenv("DOOMWADDIR");

#ifdef _EE
//doomwaddir = "";
doomwaddir = "mass:";
//doomwaddir = "mass:";
GetElfFilename(myargv[0], deviceName, fullPath, elfFilename);
doomwaddir = fullPath;
#else
if (!doomwaddir)
doomwaddir = "./";
Expand Down
8 changes: 6 additions & 2 deletions i_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ static char s_pUDNL [] __attribute__( ( section( ".data" ), aligned( 1 ) )
#include <kernel.h> //for GetThreadId
#include <libmc.h>

#include "cosmitoFileIO.h"


extern int SAMPLECOUNT;

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

init_scr();
scr_printf(" --==== PS2DOOM v1.0.2.2 ====--\n\n");
scr_printf(" A Doom PS2 port started by Lukasz Bruun and improved by cosmito\n\n\n");
//scr_printf(" --==== PS2DOOM v1.0.2.2 ====--\n\n");
//scr_printf(" A Doom PS2 port started by Lukasz Bruun and improved by cosmito\n\n\n");
scr_printf(" --==== PS2DOOM v1.0.3.0 ====--\n\n\n");

int ret;
printf("sample: kicking IRXs\n");
Expand Down
Binary file modified i_system.c
Binary file not shown.
Binary file modified ps2sdldoom_VS2005/ps2sdldoom_VS2005.suo
Binary file not shown.
Loading

0 comments on commit c9bd49c

Please sign in to comment.