Revert the changes to CDVD, and clean up the changes I made to ElfHeader.cpp, getting rid of some extraneous commented out test code, and refining the comments I left a bit.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1613 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-08-09 10:43:29 +00:00
parent 5bdc1947f4
commit c0a0cd6bed
2 changed files with 14 additions and 20 deletions

View File

@ -1094,8 +1094,9 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
break; break;
case N_CD_READ: // CdRead case N_CD_READ: // CdRead
cdvd.SeekToSector = (cdvd.Param[0] << 0) | (cdvd.Param[1] << 8) | (cdvd.Param[2]<< 16) | (cdvd.Param[3] << 24); // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7].
cdvd.nSectors = (cdvd.Param[4] << 0) | (cdvd.Param[5] << 8) | (cdvd.Param[6]<< 16) | (cdvd.Param[7] << 24); cdvd.SeekToSector = *(u32*) (cdvd.Param+0);
cdvd.nSectors = *(u32*)(cdvd.Param+4);
cdvd.RetryCnt = (cdvd.Param[8] == 0) ? 0x100 : cdvd.Param[8]; cdvd.RetryCnt = (cdvd.Param[8] == 0) ? 0x100 : cdvd.Param[8];
cdvd.SpindlCtrl = cdvd.Param[9]; cdvd.SpindlCtrl = cdvd.Param[9];
cdvd.Speed = 24; cdvd.Speed = 24;
@ -1129,8 +1130,9 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
case N_CD_READ_CDDA: // CdReadCDDA case N_CD_READ_CDDA: // CdReadCDDA
case N_CD_READ_XCDDA: // CdReadXCDDA case N_CD_READ_XCDDA: // CdReadXCDDA
cdvd.SeekToSector = (cdvd.Param[0] << 0) | (cdvd.Param[1] << 8) | (cdvd.Param[2]<< 16) | (cdvd.Param[3] << 24); // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7].
cdvd.nSectors = (cdvd.Param[4] << 0) | (cdvd.Param[5] << 8) | (cdvd.Param[6]<< 16) | (cdvd.Param[7] << 24); cdvd.SeekToSector = *(u32*) (cdvd.Param+0);
cdvd.nSectors = *(u32*)(cdvd.Param+4);
if (cdvd.Param[8] == 0) if (cdvd.Param[8] == 0)
cdvd.RetryCnt = 0x100; cdvd.RetryCnt = 0x100;
@ -1175,8 +1177,9 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
break; break;
case N_DVD_READ: // DvdRead case N_DVD_READ: // DvdRead
cdvd.SeekToSector = (cdvd.Param[0] << 0) | (cdvd.Param[1] << 8) | (cdvd.Param[2]<< 16) | (cdvd.Param[3] << 24); // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7].
cdvd.nSectors = (cdvd.Param[4] << 0) | (cdvd.Param[5] << 8) | (cdvd.Param[6]<< 16) | (cdvd.Param[7] << 24); cdvd.SeekToSector = *(u32*) (cdvd.Param+0);
cdvd.nSectors = *(u32*)(cdvd.Param+4);
if (cdvd.Param[8] == 0) if (cdvd.Param[8] == 0)
cdvd.RetryCnt = 0x100; cdvd.RetryCnt = 0x100;

View File

@ -182,7 +182,6 @@ static uint parseCommandLine( const char *filename )
else else
p = filename; p = filename;
//DevCon::WriteLn("parseCommandLine: args = '%s'; p = '%s'", params args, p);
args_ptr -= strlen( p ) + 1; args_ptr -= strlen( p ) + 1;
@ -192,41 +191,34 @@ static uint parseCommandLine( const char *filename )
// Start from the end of where we wrote to, not including all the zero'd out area. // Start from the end of where we wrote to, not including all the zero'd out area.
for ( i = args_end - args_ptr + 1, argc = 0; i > 0; i-- ) for ( i = args_end - args_ptr + 1, argc = 0; i > 0; i-- )
{ {
// Decrease i until arg_ptr + i points at a spot that is not a space or 0 (or i is 0).
while (i && isEmpty(args_ptr + i )) { i--; } while (i && isEmpty(args_ptr + i )) { i--; }
// If the last char is a space, set it to 0. // If the last char is a space, set it to 0.
if ( PS2MEM_BASE[ args_ptr + i + 1 ] == ' ') PS2MEM_BASE[ args_ptr + i + 1 ] = 0; if ( PS2MEM_BASE[ args_ptr + i + 1 ] == ' ') PS2MEM_BASE[ args_ptr + i + 1 ] = 0;
// Decrease i until we run into another space or 0 (or i is 0).
// (in other words, so far, we went backwards by a word.)
while (i && !isEmpty(args_ptr + i )) { i--; } while (i && !isEmpty(args_ptr + i )) { i--; }
// if the spot we are on is not a space or null (ie, i<=0, given the last while statement): // Now that we've gone back a word, increase the number of arguments,
if (!isEmpty(args_ptr + i )) // and mark the location of the argument.
if (!isEmpty(args_ptr + i )) // i <= 0
{ {
// Presumably increases the number of arguments, and lets the ps2 know about this argument. // If the spot we are on is not a space or null , use it.
argc++; argc++;
ret = args_ptr - 4 - 4 - argc * 4; ret = args_ptr - 4 - 4 - argc * 4;
//DevCon::WriteLn("parseCommandLine: i = %d", params i);
if (ret < 0 ) return 0; if (ret < 0 ) return 0;
((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i; ((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i;
//DevCon::WriteLn("PS2MEM_BASE[%d / 4 - %d (%d)] = %d", params args_ptr, argc, (args_ptr / 4 - argc), (args_ptr + i));
} }
else else
{ {
// If we ran into a word.
if (!isEmpty(args_ptr + i + 1)) if (!isEmpty(args_ptr + i + 1))
{ {
// Presumably increases the number of arguments, and lets the ps2 know about this argument. // Otherwise, use the next character .
argc++; argc++;
ret = args_ptr - 4 - 4 - argc * 4; ret = args_ptr - 4 - 4 - argc * 4;
//DevCon::WriteLn("parseCommandLine: i = %d", params i);
if (ret < 0 ) return 0; if (ret < 0 ) return 0;
((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i + 1; ((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i + 1;
//DevCon::WriteLn("PS2MEM_BASE[%d / 4 - %d (%d)] = %d", params args_ptr, argc, (args_ptr / 4 - argc), (args_ptr + i));
} }
} }
} }
@ -234,7 +226,6 @@ static uint parseCommandLine( const char *filename )
// Pass the number of arguments, and if we have arguments. // Pass the number of arguments, and if we have arguments.
((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 1 ] = argc; //how many args ((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 1 ] = argc; //how many args
((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 2 ] = ( argc > 0); //have args? //not used, cannot be filled at all ((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 2 ] = ( argc > 0); //have args? //not used, cannot be filled at all
//DevCon::WriteLn("parseCommandLine: argc = %d", params argc);
return ret; return ret;
} }