Skip to content

Commit

Permalink
return the proper counter value
Browse files Browse the repository at this point in the history
still not ok
  • Loading branch information
ahezard committed May 21, 2019
1 parent 94a4f5d commit 32064ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 8 additions & 2 deletions retail/bootloader/source/arm7/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,13 +878,19 @@ static void patchCardReadPdash(cardengineArm9* ce9, const tNDSHeader* ndsHeader)

// Pokemon Dash USA
if (strcmp(romTid, "APDE") == 0) {
sdPatchEntry = 0x206D38C;
sdPatchEntry = 0x206CFE8;
// TODO : try to target 206CFE8, more similar to cardread
// r0 cardstruct 218A6E0 ptr 20D6120
// r1 src
// r2 dst
// r3 len
// return r0=number of time executed ?? 206D1A8
}

if(sdPatchEntry) {
// Patch
u32* pDashReadPatch = ce9->patches->pdash_read;
memcpy(sdPatchEntry, pDashReadPatch, 0x70);
memcpy(sdPatchEntry, pDashReadPatch, 0x40);
}
}

Expand Down
11 changes: 5 additions & 6 deletions retail/cardengine/arm9/source/card_engine_header.s
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,16 @@ cardReadRef11:
.arm
pdash_read:
push {r1-r11, lr}
mov r0, r4 @DST
mov r1, r5 @SRC
mov r2, r6 @LEN
mov r3, r10 @cardStruct
add r3, r3, #0x2C
@mov r0, r4 @DST
@mov r1, r5 @SRC
@mov r2, r6 @LEN
@mov r3, r10 @cardStruct
add r0, r0, #0x2C
ldr r6, cardReadRef12
ldr r7, ce9location12
add r6, r6, r7
bl _blx_r6_stub_pdash
pop {r1-r11, pc}
mov r0,#1
bx lr
_blx_r6_stub_pdash:
bx r6
Expand Down
6 changes: 4 additions & 2 deletions retail/cardengine/arm9/source/cardengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ u32 cardReadDma() {
return 0;
}

int cardReadPDash(u8* dst, u32 src, u32 len, vu32* volatile cardStruct) {
static int counter=0;
int cardReadPDash(vu32* volatile cardStruct, u32 src, u8* dst, u32 len) {
u32 commandRead;
u32 sector = (src/readSize)*readSize;

Expand Down Expand Up @@ -466,7 +467,8 @@ int cardReadPDash(u8* dst, u32 src, u32 len, vu32* volatile cardStruct) {

dmaLed = false;

return 0;
counter++;
return counter;
}

int cardRead(u32* cacheStruct, u8* dst0, u32 src0, u32 len0) {
Expand Down

0 comments on commit 32064ab

Please sign in to comment.