-updated to version 2.3-

*Fixed creating NMM save file folders in FST mode
*Fixed CardFindEntryByName which incorrectly compared file names
*Added a hack for Phantasy Star Online 1&2 version 1.0
*GCLoader improvements that include warning the user if an incorrect CONFIG_VERSION is used
*Hardcoded the only worthy DVDGetDriveStatus patching, so once again the NODISC cfg doesn't do anything
*Removed unused code
*Removed unused files

git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@29 be6c1b03-d731-4111-a574-e37d80d43941
This commit is contained in:
0xD15EA5E@gmail.com 2012-09-24 14:03:20 +00:00
parent e15e2b2d8c
commit 8cebe92a4d
11 changed files with 48 additions and 106 deletions

54
Card.c
View File

@ -1,12 +1,16 @@
#include "Card.h"
FIL CardStat;
extern u32 FSTMode;
extern FIL GameFile;
void CardInit( void )
{
FILINFO f;
u32 i,wrote;
CARDStat CStat;
char GameID[0x20];
memset32( (void*)CARD_BASE, 0xdeadbeef, 0x20 );
memset32( (void*)CARD_SHADOW, 0, 0x20 );
@ -18,10 +22,20 @@ void CardInit( void )
f_chdir("/saves");
}
if( f_chdir((const TCHAR*)0) != FR_OK )
if( FSTMode )
{
f_mkdir((const TCHAR*)0);
f_chdir((const TCHAR*)0);
FSTRead( (char*)GameID, 0x20, 0 );
} else {
f_lseek( &GameFile, 0 );
f_read( &GameFile, (char*)GameID, 0x20, &wrote );
}
if( f_chdir(GameID) != FR_OK )
{
f_mkdir(GameID);
f_chdir(GameID);
}
switch( f_stat( "stats.bin", &f ) )
@ -57,6 +71,7 @@ void CardInit( void )
write32( 0x2FA0, 0 );
}
s32 CardFindFreeEntry( void )
{
CARDStat CStat;
@ -88,8 +103,8 @@ s32 CardFindEntryByName( char *Filename )
{
f_lseek( &CardStat, sizeof(CARDStat) * i );
f_read( &CardStat, &CStat, sizeof(CARDStat), &read );
if( memcmp( Filename, CStat.fileName, strlen(Filename) ) == 0 )
if( strcmp( Filename, CStat.fileName ) == 0 )
{
//dbgprintf("CardFindEntryByName(%d,%s,%s)\n", i, Filename, CStat.fileName );
return i;
@ -144,7 +159,7 @@ s32 CardFastOpenFile( u32 FileNo, CARDFileInfo *CFInfo )
{
CARDStat CStat;
FIL savefile;
s32 fres;
s32 Slot,fres;
u32 read;
if( FileNo >= CARD_MAX_FILES )
@ -505,10 +520,9 @@ void CardUpdateStats( CARDStat *CStat )
CStat->offsetData = Offset;
}
u32 Device = 0;
void CARDUpdateRegisters( void )
{
u32 read;
u32 read,i;
if( read32(CARD_CONTROL) != 0xdeadbeef )
{
@ -524,20 +538,17 @@ void CARDUpdateRegisters( void )
write32( CARD_CONTROL, 0xdeadbeef );
#ifdef ACTIVITYLED
set32( HW_GPIO_OUT, 1<<5 );
#endif
if( ConfigGetConfig(DML_CFG_ACTIVITY_LED) )
set32( HW_GPIO_OUT, 1<<5 );
while( read32(CARD_CMD) == 0xdeadbeef );
write32( CARD_SCMD, read32(CARD_CMD) );
write32( CARD_CMD, 0xdeadbeef );
if( read32(CARD_CMD_1) != 0xdeadbeef )
{
write32( CARD_SCMD_1, read32(CARD_CMD_1) );
write32( CARD_CMD_1, 0xdeadbeef );
}
while( read32(CARD_CMD_1) == 0xdeadbeef );
write32( CARD_SCMD_1, read32(CARD_CMD_1) );
write32( CARD_CMD_1, 0xdeadbeef );
if( read32(CARD_CMD_2) != 0xdeadbeef )
{
write32( CARD_SCMD_2, read32(CARD_CMD_2) );
@ -565,12 +576,9 @@ void CARDUpdateRegisters( void )
default:
{
//EXIControl(1);
dbgprintf("CARD:Unknown CMD:%08X %08X %08X %08X %08X %08X\n", read32(CARD_SCMD), read32(CARD_SCMD_1), read32(CARD_SCMD_2), read32(CARD_SCMD_3), read32(CARD_SCMD_4), read32(CARD_SCONTROL) );
Shutdown();
} break;
/* CARDOpen( char *FileName ) */
case 0xC0:
{
@ -942,8 +950,8 @@ void CARDUpdateRegisters( void )
#endif
} break;
}
#ifdef ACTIVITYLED
clear32( HW_GPIO_OUT, 1<<5 );
#endif
if( ConfigGetConfig(DML_CFG_ACTIVITY_LED) )
clear32( HW_GPIO_OUT, 1<<5 );
}
}

View File

@ -9,15 +9,15 @@ void ConfigInit( DML_CFG *Cfg )
memset32( DMLCfg, 0, sizeof(DML_CFG) );
//If a loader supplied any options we use them otherwise use the code defines
if( Cfg->Magicbytes == 0xD1050CF6 && Cfg->Version == CONFIG_VERSION )
if( Cfg->Magicbytes == 0xD1050CF6 )
{
memcpy( DMLCfg, Cfg, sizeof( DML_CFG ) );
} else {
dbgprintf("No config found in RAM\n");
dbgprintf("No valid config found in RAM\n");
dbgprintf("Version:%08X\n", DMLCfg->Version );
dbgprintf("Config:%08X\n", DMLCfg->Config );
dbgprintf("Config :%08X\n", DMLCfg->Config );
DMLCfg->Config = 0;
#ifdef CHEATHOOK
@ -41,9 +41,9 @@ void ConfigInit( DML_CFG *Cfg )
#ifdef PADHOOK
DMLCfg->Config |= DML_CFG_PADHOOK;
#endif
DMLCfg->VideoMode = DML_VID_DML_AUTO;
DMLCfg->Version = CONFIG_VERSION;
DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->Version = CONFIG_VERSION;
DMLCfg->VideoMode = DML_VID_DML_AUTO;
}
//Check if a memcard is inserted in Slot A

View File

@ -3,7 +3,6 @@
#include "string.h"
#include "global.h"
#include "ipc.h"
#include "alloc.h"
#include "vsprintf.h"
#include "HW.h"

1
HW.h
View File

@ -4,7 +4,6 @@
#include "string.h"
#include "global.h"
#include "memory.h"
#include "ipc.h"
#include "alloc.h"
#include "dip.h"

View File

@ -887,8 +887,11 @@ void DoPatches( char *ptr, u32 size, u32 SectionOffset )
if( FPatterns[j].Patch == (u8*)DVDGetDriveStatus )
{
if( !ConfigGetConfig( DML_CFG_NODISC ) )
if( (read32(0) >> 8) != 0x474754 && // Chibi-Robo!
(read32(0) >> 8) != 0x475041 ) // Pokémon Channel
break;
dbgprintf("Patch:DVDGetDriveStatus\n");
}
if( (FPatterns[j].Length >> 16) == 0xdead )

View File

@ -3,7 +3,6 @@
#include "string.h"
#include "global.h"
#include "ipc.h"
#include "alloc.h"
#include "ff.h"
#include "vsprintf.h"

11
dip.c
View File

@ -37,6 +37,7 @@ char *getfilenamebyoffset(u32 offset)
return (char*)NULL;
}
void DIInit( void )
{
memset32( (void*)DI_BASE, 0xdeadbeef, 0x30 );
@ -53,7 +54,7 @@ u32 DIUpdateRegisters( void )
static u32 PatchState = 0;
static u32 DOLReadSize = 0;
static u32 PSOHack = 0;
if( read32(DI_CONTROL) != 0xdeadbeef )
{
write32( DI_SCONTROL, read32(DI_CONTROL) & 3 );
@ -102,7 +103,7 @@ u32 DIUpdateRegisters( void )
write32( DI_SIMM, read32(DI_IMM) );
write32( DI_IMM, 0xdeadbeef );
}
switch( read32(DI_SCMD_0) >> 24 )
{
case 0xA7:
@ -156,7 +157,8 @@ u32 DIUpdateRegisters( void )
switch( Offset )
{
case 0x56B8E7E0: // AppSwitcher [EUR]
case 0x56C49600: // [USA]
case 0x56C49600: // [USA] v1.1
case 0x56C4C980: // [USA] v1.0
{
DMLCfg->Config &= ~(DML_CFG_CHEATS|DML_CFG_PADHOOK|DML_CFG_DEBUGGER|DML_CFG_DEBUGWAIT);
@ -164,7 +166,8 @@ u32 DIUpdateRegisters( void )
} break;
case 0x5668FE20: // psov3.dol [EUR]
case 0x56750660: // [USA]
case 0x56750660: // [USA] v1.1
case 0x56753EC0: // [USA] v1.0
{
PSOHack = 1;
} break;

View File

@ -15,7 +15,7 @@
#define PADHOOK 1
#define CONFIG_VERSION 0x00000002
#define DM_VERSION 0x00020002
#define DM_VERSION 0x00020003
#define DI_SUCCESS 1
#define DI_ERROR 2

67
ipc.h
View File

@ -1,67 +0,0 @@
#ifndef __IPC_H__
#define __IPC_H__ 1
struct ioctl_vector {
void *data;
unsigned int len;
} __attribute__((packed));
struct ipcmessage
{
unsigned int command; // 0
unsigned int result; // 4
union
{
unsigned int fd; // 8
};
union
{
struct
{
char *device; // 12
unsigned int mode; // 16
unsigned int resultfd; // 20
} open;
struct
{
void *data;
unsigned int length;
} read, write;
struct
{
int offset;
int origin;
} seek;
struct
{
unsigned int command;
unsigned int *buffer_in;
unsigned int length_in;
unsigned int *buffer_io;
unsigned int length_io;
} ioctl;
struct
{
unsigned int command; // C
unsigned int argc_in; // 10
unsigned int argc_io; // 14
struct ioctl_vector *argv; // 18
} ioctlv;
};
} __attribute__((packed)) ipcmessage;
#define IOS_OPEN 0x01
#define IOS_CLOSE 0x02
#define IOS_READ 0x03
#define IOS_WRITE 0x04
#define IOS_SEEK 0x05
#define IOS_IOCTL 0x06
#define IOS_IOCTLV 0x07
#endif

1
main.c
View File

@ -7,7 +7,6 @@ Copyright (C) 2010-2012 crediar
*/
#include "string.h"
#include "global.h"
#include "ipc.h"
#include "alloc.h"
#include "ff.h"
#include "diskio.h"

View File

@ -3,7 +3,6 @@
#include "string.h"
#include "global.h"
#include "ipc.h"
#include "utils.h"
#include "hollywood.h"
#include "vsprintf.h"