G6 driver debugging
Moderator: ScummVM Team
G6 driver debugging
Hi,
I'm currently tring to see wh the G6 drivers doens't work so well with scummvm.
So I patched scummvm beta 3 with the G6 dldi v0.16, saved a dott game and observed that it didn't work.
To debug I added manually the G6 driver into scummvm code and voila! it work.
To be sure that it's dldi related I need people to test this version of scummvm.
http://www.gigeshare.com/preview/1f88a2 ... 27ng71a5a/
As there is already the G6 driver inside the .nds there is no need to patch, just copy-paste the .nds into the NDS directory of your G6.
And don't forget to make a backup of all your savegames before !
I'm currently tring to see wh the G6 drivers doens't work so well with scummvm.
So I patched scummvm beta 3 with the G6 dldi v0.16, saved a dott game and observed that it didn't work.
To debug I added manually the G6 driver into scummvm code and voila! it work.
To be sure that it's dldi related I need people to test this version of scummvm.
http://www.gigeshare.com/preview/1f88a2 ... 27ng71a5a/
As there is already the G6 driver inside the .nds there is no need to patch, just copy-paste the .nds into the NDS directory of your G6.
And don't forget to make a backup of all your savegames before !
I agree with you. The only reason I can think of is I made a bad copy paste while doing the DLDI driveragentq wrote:As far as I know, the DLDI code should act exactly the same way as any driver compiled into the code. So what could be different about it?
Is it perhaps a bug in the patcher?
There must be a reason why all the other DLDIs work, right?
I'll see this tonight after work.
The source code on Chishm's page is clearly not going to work for byte-aligned data:
Code: Select all
bool writeSectors (u32 sector, u32 numSectors, void* _buffer) {
bool retval;
u16 numsectowrite;
int nbsecwrite;
u16 *buffer = (u16 *)_buffer; // This line will cause problems if _buffer is not at an even address!
Interesting, could be the problem. Will look at this.agentq wrote:The source code on Chishm's page is clearly not going to work for byte-aligned data:
Code: Select all
bool writeSectors (u32 sector, u32 numSectors, void* _buffer) { bool retval; u16 numsectowrite; int nbsecwrite; u16 *buffer = (u16 *)_buffer; // This line will cause problems if _buffer is not at an even address!
After checking in asm this is not a problem since the compiler doesn't modify the register that hold void* _buffer (R2 here).
Code: Select all
.text:000026E4 MOV R4, R2
.text:000026E8 loc_26E8 ; CODE XREF: writeSectors+E4j
.text:000026E8 MOV R0, R6
.text:000026EC MOV R1, R5
.text:000026F0 MOV R2, R4
.text:000026F4 BL WriteBlockFunc ; PIC mode
It might not modify the register, but that's only half the problem. What about when you deference the pointer? The ARM cpu cannot deference a misaligned u16*. If you have one, you will end up in trouble.
Take another look at the code and you will see that this does happen:
Take another look at the code and you will see that this does happen:
Code: Select all
void static DMAWriteWordData(u16 buffer[],u32 nbword)
{
u16 word,wordanc;
u32 i;
for (i=0;i<nbword;i++)
WriteWordData(buffer[i]); // buffer[i] won't evaluate correctly if buffer[] is misaligned