es
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Index: ES.c
===================================================================
--- ES.cÂÂÂÂ(Revision 72)
+++ ES.cÂÂÂÂ(Arbeitskopie)
@@ -695,7 +695,12 @@
ÂÂÂÂ_sprintf( path, "/title/%08x/%08x/data", *(u32*)(tmd+0x18C), *(u32*)(tmd+0x190) );
ÂÂÂÂ//Create data and content dir if neccessary
-ÂÂÂÂr = ISFS_GetUsage( path, NULL, NULL );
+
+ÂÂÂÂu32 *fix = malloca(sizeof(u32), 32 ), *fix2= malloca(sizeof(u32), 32 );
+ÂÂÂÂr = ISFS_GetUsage( path, fix, fix2 );
+ÂÂÂÂfree( fix );
+ÂÂÂÂfree( fix2 );
+ÂÂÂÂ//r = ISFS_GetUsage( path, NULL, NULL );
ÂÂÂÂswitch( r )
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂcase FS_ENOENT2:
@@ -1411,6 +1416,7 @@
ÂÂÂÂu32 LoadDI=0;
ÂÂÂÂ_sprintf( path, "/di.bin" );
+
ÂÂÂÂu8 *difile = NANDLoadFile( path, size );
ÂÂÂÂif( difile != NULL )
ÂÂÂÂ{
@@ -1428,8 +1434,8 @@
ÂÂÂÂÂÂÂÂÂÂÂÂcontinue;
ÂÂÂÂÂÂÂÂ//Skip SD module
-ÂÂÂÂÂÂÂÂif( 4 == *(u16*)(TMD_Data+0x1E8+0x24*i) )
-ÂÂÂÂÂÂÂÂÂÂÂÂcontinue;
+ÂÂÂÂÂÂÂÂ//if( 4 == *(u16*)(TMD_Data+0x1E8+0x24*i) )
+ÂÂÂÂÂÂÂÂ//ÂÂÂÂcontinue;
ÂÂÂÂÂÂÂÂ//Load special DI module
ÂÂÂÂÂÂÂÂif( 1 == *(u16*)(TMD_Data+0x1E8+0x24*i) && LoadDI )
@@ -1649,4 +1655,4 @@
ÂÂÂÂfree( path );
ÂÂÂÂreturn 0;
-}
\ No newline at end of file
+}
Index: DI.c
===================================================================
--- DI.cÂÂÂÂ(Revision 72)
+++ DI.cÂÂÂÂ(Arbeitskopie)
@@ -111,6 +111,7 @@
ÂÂÂÂreturn r;
}
+
s32 DVDSelectGame( u32 SlotID )
{
ÂÂÂÂs32 fd = IOS_Open("/dev/di", 0 );
Index: syscalls.h
===================================================================
--- syscalls.hÂÂÂÂ(Revision 72)
+++ syscalls.hÂÂÂÂ(Arbeitskopie)
@@ -54,8 +54,10 @@
#define timer_destroy(a) syscall_14(a)
void syscall_14(int timer);
-void syscall_15(void);
+#define TimerNow(a) syscall_15(a)
+int syscall_15(int TimerID);
+
#define heap_create(a, b) syscall_16(a, b)
int syscall_16(void *ptr, int len);
Index: vsprintf.c
===================================================================
--- vsprintf.cÂÂÂÂ(Revision 72)
+++ vsprintf.cÂÂÂÂ(Arbeitskopie)
@@ -290,7 +290,7 @@
}
static char buffer[1024] ALIGNED(32);
-int dbgprintf( const char *fmt, ...)
+/*int dbgprintf( const char *fmt, ...)
{
ÂÂÂÂif ( (*(vu32*)(0xd800070) & 1) == 0)
ÂÂÂÂÂÂÂÂreturn 0;
@@ -315,6 +315,31 @@
ÂÂÂÂsvc_write(buffer);
ÂÂÂÂreturn i;
+}*/
+#define SET_DI_COLORÂÂÂÂ0x1b, 1, 32, 48
+#define RESET_DI_COLORÂÂÂÂ0x1b, 0, 30, 48
+
+static char buffer[1024] ALIGNED(32);
+int dbgprintf( const char *fmt, ...)
+{
+ÂÂÂÂif ( (*(vu32*)(0xd800070) & 1) == 0)
+ÂÂÂÂÂÂÂÂreturn 0;
+
+ÂÂÂÂva_list args;
+ÂÂÂÂint i;
+
+ÂÂÂÂva_start(args, fmt);
+ÂÂÂÂi = vsprintf(buffer, fmt, args);
+ÂÂÂÂva_end(args);
+
+ÂÂÂÂchar clrCommand[10];
+ÂÂÂÂ_sprintf(clrCommand, "%c[%d;%d;%dm",SET_DI_COLOR);
+ÂÂÂÂsvc_write( clrCommand );
+ÂÂÂÂsvc_write( buffer );
+ÂÂÂÂ_sprintf(clrCommand, "%c[%d;%d;%dm",RESET_DI_COLOR);
+ÂÂÂÂsvc_write( clrCommand );
+
+ÂÂÂÂreturn i;
}
void fatal(const char *fmt, ...)
{
Index: main.c
===================================================================
--- main.cÂÂÂÂ(Revision 72)
+++ main.cÂÂÂÂ(Arbeitskopie)
@@ -1830,12 +1830,12 @@
ÂÂÂÂif( ret < 0 )
ÂÂÂÂÂÂÂÂreturn ret;
ÂÂÂÂ
-ÂÂÂÂret = device_register("/dev/sdio", queueid );
+/*ÂÂÂÂret = device_register("/dev/sdio", queueid );
#ifdef DEBUG
ÂÂÂÂdbgprintf("ES

eviceRegister(\"/dev/sdio\"):%d QueueID:%d\n", ret, queueid );
#endif
ÂÂÂÂif( ret < 0 )
-ÂÂÂÂÂÂÂÂreturn ret;
+ÂÂÂÂÂÂÂÂreturn ret;*/
ÂÂÂÂreturn queueid;
}
@@ -1892,13 +1892,13 @@
ÂÂÂÂES_BootSystem( &TitleID, &KernelVersion );
ÂÂÂÂdbgprintf("ES:looping!\n");
-
+/*
ÂÂÂÂSDStatus = malloca( sizeof(u32), 0x40 );
ÂÂÂÂ*SDStatus = 0x00000002;
ÂÂÂÂHCR = malloca( sizeof(u32)*0x30, 0x40 );
ÂÂÂÂmemset32( HCR, 0, sizeof(u32)*0x30 );
-
+*/
ÂÂÂÂ//WiiShop always swimming mario
ÂÂÂÂ//if( *(u32*)0x0001CCC0 == 0x4082007C )
ÂÂÂÂ//ÂÂÂÂ*(u32*)0x0001CCC0 = 0x38000063;
@@ -1906,8 +1906,8 @@
ÂÂÂÂif( TitleID == 0x0000000100000002LL )
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂ//Disable SD for system menu
-ÂÂÂÂÂÂÂÂif( *SDStatus == 1 )
-ÂÂÂÂÂÂÂÂÂÂÂÂ*SDStatus = 2;
+//ÂÂÂÂÂÂÂÂif( *SDStatus == 1 )
+//ÂÂÂÂÂÂÂÂÂÂÂÂ*SDStatus = 2;
ÂÂÂÂÂÂÂÂ//Region free 4.2EUR
ÂÂÂÂÂÂÂÂ//*(u32*)0x0137DC90 = 0x4800001C;
@@ -1920,7 +1920,43 @@
ÂÂÂÂÂÂÂÂ//thread_continue( id );
ÂÂÂÂ}
+ÂÂÂÂ/*u8 *timebuf = malloca( 512, 32 );
+ÂÂÂÂÂÂÂÂchar *path = (char*)malloca( 0x40, 32 );
+ÂÂÂÂÂÂÂÂ_sprintf( path, "/tmp/test.bin" );
+
+ÂÂÂÂÂÂÂÂret = ISFS_CreateFile(path, 0, 3, 3, 3 );
+ÂÂÂÂÂÂÂÂdbgprintf("ISFS_CreateFile(%s):%d\n", path, ret );
+ÂÂÂÂÂÂÂÂs32 fd = IOS_Open(path, 1|2 );
+ÂÂÂÂÂÂÂÂdbgprintf("IOS_Open(%s):%d\n", path, fd );
+
+ÂÂÂÂÂÂÂÂu32 now = TimerNow( Timer );
+ÂÂÂÂÂÂÂÂint i;
+ÂÂÂÂÂÂÂÂfor( i=0; i<20480; ++i )
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂIOS_Write( fd, timebuf, 512 );
+ÂÂÂÂÂÂÂÂ}
+ÂÂÂÂÂÂÂÂu32 write = TimerNow( Timer ) - now;
+
+ÂÂÂÂÂÂÂÂIOS_Seek( fd, 0, 0 );
+
+ÂÂÂÂÂÂÂÂnow = TimerNow( Timer );
+ÂÂÂÂÂÂÂÂfor( i=0; i<20480; ++i )
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂIOS_Read( fd, timebuf, 512 );
+ÂÂÂÂÂÂÂÂ}
+
+ÂÂÂÂÂÂÂÂu32 read = TimerNow( Timer ) - now;
+
+ÂÂÂÂÂÂÂÂdbgprintf("write:%d\n", write );
+ÂÂÂÂÂÂÂÂdbgprintf("read:%d\n", read );
+
+ÂÂÂÂÂÂÂÂISFS_Delete( path );
+
+ÂÂÂÂÂÂÂÂfree( path );
+ÂÂÂÂÂÂÂÂfree( timebuf );*/
+
+
ÂÂÂÂwhile (1)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂret = mqueue_recv( queueid, (void *)&message, 0);
@@ -1941,9 +1977,9 @@
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( strncmp( message->open.device, "/dev/es", 7 ) == 0 )
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂret = ES_FD;
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ} else if( strncmp( message->open.device, "/dev/sdio", 9 ) == 0) {
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ} /*else if( strncmp( message->open.device, "/dev/sdio", 9 ) == 0) {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂret = SD_FD;
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ} elseÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}*/ elseÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂret = FS_ENOENT;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
@@ -1956,7 +1992,8 @@
#ifdef DEBUG
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂdbgprintf("ES:IOS_Close(%d)\n", message->fd );
#endif
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( message->fd == ES_FD || message->fd == SD_FDÂÂ)
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//if( message->fd == ES_FD || message->fd == SD_FDÂÂ)
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( message->fd == ES_FD )
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmqueue_ack( (void *)message, ES_SUCCESS);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
@@ -1974,9 +2011,9 @@
ÂÂÂÂÂÂÂÂÂÂÂÂ} break;
ÂÂÂÂÂÂÂÂÂÂÂÂcase IOS_IOCTL:
ÂÂÂÂÂÂÂÂÂÂÂÂ{
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( message->fd == SD_FD )
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂSD_Ioctl( message );
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂelse
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//if( message->fd == SD_FD )
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//ÂÂÂÂSD_Ioctl( message );
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//else
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmqueue_ack( (void *)message, FS_EINVAL );
ÂÂÂÂÂÂÂÂÂÂÂÂ} break;
@@ -1984,8 +2021,8 @@
ÂÂÂÂÂÂÂÂÂÂÂÂcase IOS_IOCTLV:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( message->fd == ES_FD )
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂES_Ioctlv( message );
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂelse if( message->fd == SD_FD )
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂSD_Ioctlv( message );
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//else if( message->fd == SD_FD )
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ//ÂÂÂÂSD_Ioctlv( message );
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂelse
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmqueue_ack( (void *)message, FS_EINVAL );
ÂÂÂÂÂÂÂÂÂÂÂÂbreak;<!--c2--></div><!--ec2-->
fs-usb
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Index: alloc.h
===================================================================
--- alloc.hÂÂÂÂ(Revision 72)
+++ alloc.hÂÂÂÂ(Arbeitskopie)
@@ -22,4 +22,4 @@
void *malloc( u32 size );
void *malloca( u32 size, u32 align );
-void free( void *ptr );
\ No newline at end of file
+void free( void *ptr );
Index: string.c
===================================================================
--- string.cÂÂÂÂ(Revision 72)
+++ string.cÂÂÂÂ(Arbeitskopie)
@@ -112,3 +112,5 @@
ÂÂÂÂ} while(*s++ != 0);
ÂÂÂÂreturn NULL;
}
+
+
Index: usbstorage.c
===================================================================
--- usbstorage.cÂÂÂÂ(Revision 72)
+++ usbstorage.cÂÂÂÂ(Arbeitskopie)
@@ -274,7 +274,11 @@
ÂÂÂÂcmd[0] = SCSI_TEST_UNIT_READY;
ÂÂÂÂretval = __cycle(dev, lun, NULL, 0, cmd, 1, 1, &status, NULL);
-ÂÂÂÂif(retval < 0) return retval;
+ÂÂÂÂif(retval < 0)
+ÂÂÂÂ{
+ÂÂÂÂÂÂÂÂif(sense)free(sense);
+ÂÂÂÂÂÂÂÂreturn retval;
+ÂÂÂÂ}
ÂÂÂÂif(status != 0)
ÂÂÂÂ{
Index: diskio.c
===================================================================
--- diskio.cÂÂÂÂ(Revision 72)
+++ diskio.cÂÂÂÂ(Arbeitskopie)
@@ -64,6 +64,7 @@
ÂÂÂÂif( USBStorage_Read_Sectors( sector, count, buffer ) != 1 )
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂdbgprintf("DIP: Failed to read disc: Sector:%d Count:%d dst:%p\n", sector, count, buff );
+ÂÂÂÂÂÂÂÂfree( buffer );
ÂÂÂÂÂÂÂÂreturn RES_ERROR;
ÂÂÂÂ}
@@ -75,13 +76,14 @@
DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count)
{
-ÂÂÂÂint i;
+//ÂÂÂÂint i;
ÂÂÂÂu32 *buffer = malloca( count*512, 0x40 );
ÂÂÂÂmemcpy( buffer, buff, count*512 );
ÂÂÂÂif( USBStorage_Write_Sectors( sector, count, buffer ) != 1 )
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂdbgprintf("DIP: Failed to read disc: Sector:%d Count:%d dst:%p\n", sector, count, buff );
+ÂÂÂÂÂÂÂÂfree( buffer );
ÂÂÂÂÂÂÂÂreturn RES_ERROR;
ÂÂÂÂ}
ÂÂÂÂfree( buffer );
Index: ff.c
===================================================================
--- ff.cÂÂÂÂ(Revision 72)
+++ ff.cÂÂÂÂ(Arbeitskopie)
@@ -1926,6 +1926,7 @@
ÂÂÂÂDWORD ofsÂÂÂÂÂÂÂÂ/* File pointer from top of file */
)
{
+ÂÂÂÂ//dbgprintf("seek %x %d\n", ofs, ofs );
ÂÂÂÂFRESULT res;
ÂÂÂÂDWORD clst, bcs, nsect, ifptr;
Index: FS.c
===================================================================
--- FS.cÂÂÂÂ(Revision 72)
+++ FS.cÂÂÂÂ(Arbeitskopie)
@@ -76,7 +76,6 @@
ÂÂÂÂÂÂÂÂÂÂÂÂdbgprintf("FFS:ReadDir(\"%s\"):%d FileCount:%d\n", (char*)(v[0].data), ret, *(u32*)(v[1].data) );
#endif
ÂÂÂÂÂÂÂÂ} break;
-ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂcase IOCTL_GETUSAGE:
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂif( memcmp( (char*)(v[0].data), "/title/00010001", 16 ) == 0 )
@@ -197,9 +196,9 @@
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂheap_free( 0, path );
ÂÂÂÂÂÂÂÂÂÂÂÂ}
#endif
-#ifdef DEBUG
+//#ifdef DEBUG
ÂÂÂÂÂÂÂÂÂÂÂÂdbgprintf("FFS:CreateDir(\"%s\", %02X, %02X, %02X, %02X ):%d\n", (char*)(bufin+6), *(u8*)(bufin+0x46), *(u8*)(bufin+0x47), *(u8*)(bufin+0x48), *(u8*)(bufin+0x49), ret );
-#endif
+//#endif
ÂÂÂÂÂÂÂÂ} break;
ÂÂÂÂÂÂÂÂcase IOCTL_SETATTR:
@@ -378,7 +377,31 @@
ÂÂÂÂÂÂÂÂÂÂÂÂdbgprintf("FFS:GetStats( %d, %d, %d ):%d\n", msg->fd, ((FDStat*)bufout)->file_length, ((FDStat*)bufout)->file_length, ret );
#endif
ÂÂÂÂÂÂÂÂ} break;
+ÂÂÂÂÂÂÂÂcase 0x22:
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂret = FS_Open( (char*)(bufin), 1 ); //always open read-only for these files
+ÂÂÂÂÂÂÂÂÂÂÂÂ//dbgprintf("FFS

penLongPathname( \"%s\" ):%d\n", (char*)(bufin), ret);
+ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
+ÂÂÂÂÂÂÂÂ}
+ÂÂÂÂÂÂÂÂcase 0x23:
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂret = FS_Close( *(u32*)(bufin) );
+ÂÂÂÂÂÂÂÂÂÂÂÂ//dbgprintf("FFS:CloseLongPathname( %d ):%d\n", *(u32*)(bufin), ret);
+ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
+ÂÂÂÂÂÂÂÂ}
+ÂÂÂÂÂÂÂÂcase 0x24:
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂret = FS_Seek( *(u32*)(bufin), *(u32*)(bufin+4), *(u32*)(bufin+8) );
+ÂÂÂÂÂÂÂÂÂÂÂÂ//dbgprintf("FFS:SeekLongPathname( %d, %x, %x ):%d\n", *(u32*)(bufin), *(u32*)(bufin+4), *(u32*)(bufin+8), ret);
+ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
+ÂÂÂÂÂÂÂÂ}
+ÂÂÂÂÂÂÂÂcase 0x25:
+ÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂret = FS_Read( *(u32*)(bufin), *(u32*)(bufin+4), *(u32*)(bufin+8) );
+ÂÂÂÂÂÂÂÂÂÂÂÂ//dbgprintf("FFS:ReadLongPathname( %d, %p, %x ):%d\n", *(u32*)(bufin), *(u32*)(bufin+4), *(u32*)(bufin+8), ret);
+ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
+ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂcase IOCTL_SHUTDOWN:
ÂÂÂÂÂÂÂÂÂÂÂÂ//dbgprintf("FFS:Shutdown()\n");
ÂÂÂÂÂÂÂÂÂÂÂÂ//Close all open FS handles
@@ -427,7 +450,7 @@
}
s32 FS_GetUsage( char *path, u32 *FileCount, u32 *TotalSize )
{
-ÂÂÂÂchar *file = heap_alloc_aligned( 0, 0x40, 0x40 );
+ÂÂÂÂÂÂÂÂchar *file = heap_alloc_aligned( 0, 0x40, 0x40 );
ÂÂÂÂDIR d;
ÂÂÂÂFILINFO FInfo;
@@ -673,6 +696,7 @@
}
s32 FS_Close( s32 FileHandle )
{
+ÂÂÂÂ//dbgprintf("FS:close\n");
ÂÂÂÂif( FileHandle == FS_FD || FileHandle == SD_FD )
ÂÂÂÂÂÂÂÂreturn FS_SUCCESS;
ÂÂÂÂ
@@ -694,6 +718,7 @@
}
s32 FS_Open( char *Path, u8 Mode )
{
+
ÂÂÂÂ// Is it a device?
ÂÂÂÂif( strncmp( Path, "/dev/", 5 ) == 0 )
ÂÂÂÂ{
@@ -711,7 +736,7 @@
ÂÂÂÂÂÂÂÂÂÂÂÂreturn FS_ENOENT;
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂ} else { // Or is it a filepath ?
-
+//dbgprintf("FS:open\n");
ÂÂÂÂÂÂÂÂ//if( (strstr( Path, "data/setting.txt") != NULL) && (Mode&2) )
ÂÂÂÂÂÂÂÂ//{
ÂÂÂÂÂÂÂÂ//ÂÂÂÂreturn FS_EACCESS;
@@ -761,6 +786,7 @@
}
s32 FS_Read( s32 FileHandle, u8 *Data, u32 Length )
{
+ÂÂ // dbgprintf("FS:read\n");
ÂÂÂÂif( FS_CheckHandle(FileHandle) == 0)
ÂÂÂÂÂÂÂÂreturn FS_EINVAL;
@@ -786,6 +812,7 @@
*/
s32 FS_Seek( s32 FileHandle, s32 Where, u32 Whence )
{
+ÂÂÂÂ//dbgprintf("FS:seek\n");
ÂÂÂÂif( FS_CheckHandle(FileHandle) == 0)
ÂÂÂÂÂÂÂÂreturn FS_EINVAL;
@@ -793,7 +820,11 @@
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂcase SEEK_SET:
ÂÂÂÂÂÂÂÂÂÂÂÂif( Where >= (u32)(&fd_stack[FileHandle].fsize) )
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn FS_EFATAL;
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif( Where >= fd_stack[FileHandle].fsize )//wtf
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂdbgprintf("FS:%x >= %x %x\n", Where, &fd_stack[FileHandle].fsize, fd_stack[FileHandle].fsize );
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn FS_EFATAL;
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂif( f_lseek( &fd_stack[FileHandle], Where ) == FR_OK )
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn Where;
Index: FS.h
===================================================================
--- FS.hÂÂÂÂ(Revision 72)
+++ FS.hÂÂÂÂ(Arbeitskopie)
@@ -74,6 +74,7 @@
#defineÂÂÂÂIOCTL_GETSTATSÂÂ 0x0B
#defineÂÂÂÂIOCTL_GETUSAGEÂÂ 0x0C
#defineÂÂÂÂIOCTL_SHUTDOWNÂÂ 0x0D
+#defineÂÂÂÂIOCTL_OPENLONGPATHÂÂ 0x22
#define SEEK_SETÂÂÂÂ0
#define SEEK_CURÂÂÂÂ1
Index: main.c
===================================================================
--- main.cÂÂÂÂ(Revision 72)
+++ main.cÂÂÂÂ(Arbeitskopie)
@@ -24,11 +24,12 @@
#include "ipc.h"
#include "ff.h"
#include "FS.h"
+#include "alloc.h"
FATFS fatfs;
-static FIL f;
-static u8 GamePath[64];
+//static FIL f;
+//static u8 GamePath[64];
static char Heap[0x100] ALIGNED(32);
void *QueueSpace = NULL;
@@ -275,5 +276,5 @@
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂ}
-ÂÂÂÂreturn 0;
+//ÂÂÂÂreturn 0;
}
Index: alloc.c
===================================================================
--- alloc.cÂÂÂÂ(Revision 72)
+++ alloc.cÂÂÂÂ(Arbeitskopie)
@@ -26,7 +26,7 @@
ÂÂÂÂvoid *ptr = heap_alloc( 0, size );
ÂÂÂÂif( ptr == NULL )
ÂÂÂÂ{
-ÂÂÂÂÂÂÂÂdbgprintf("Malloc:%p Size:%08X FAILED\n", ptr, size );
+ÂÂÂÂÂÂÂÂdbgprintf("FS:Malloc:%p Size:%08X FAILED\n", ptr, size );
ÂÂÂÂÂÂÂÂwhile(1);
ÂÂÂÂ}
ÂÂÂÂreturn ptr;
@@ -36,7 +36,7 @@
ÂÂÂÂvoid *ptr = heap_alloc_aligned( 0, size, align );
ÂÂÂÂif( ptr == NULL )
ÂÂÂÂ{
-ÂÂÂÂÂÂÂÂdbgprintf("Malloca:%p Size:%08X FAILED\n", ptr, size );
+ÂÂÂÂÂÂÂÂdbgprintf("FS:Malloca:%p Size:%08X FAILED\n", ptr, size );
ÂÂÂÂÂÂÂÂwhile(1);
ÂÂÂÂ}
ÂÂÂÂreturn ptr;
@@ -49,4 +49,4 @@
ÂÂÂÂ//dbgprintf("Free:%p\n", ptr );
ÂÂÂÂreturn;
-}
\ No newline at end of file
+}<!--c2--></div><!--ec2-->