Skip to content

Commit

Permalink
[backport] If the DMA transfer isn't done, wait
Browse files Browse the repository at this point in the history
Backport of 7515637 from nightly-v4 branch
  • Loading branch information
ChainSwordCS committed Oct 14, 2023
1 parent 77367f6 commit fae2a9d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
Binary file modified ChirunoMod.cia
Binary file not shown.
Binary file modified ChirunoMod_nodebug.cia
Binary file not shown.
Binary file modified ChirunoMod_verbosedebug.cia
Binary file not shown.
32 changes: 31 additions & 1 deletion soos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,22 @@ void netfuncOld3DS(void* __dummy_arg__)
for(int loopy = 1; loopy > 0; loopy--)
{
//soc->setPakSize(0);
tryStopDma();

int dmaState = 0;
for(int i = 0; i < 60; i++)
{
svcGetDmaState(&dmaState, dmahand);
if(dmaState == 4 || dmaState == 0)
break;
svcSleepThread(5e4);
}

tryStopDma();

#if DEBUG_BASIC==1
if(dmaState != 4 && dmaState != 0)
printf("DMA transfer not finished, stopping manually...\ndmaState=%i\n", dmaState);
#endif

int imgsize = 0;

Expand Down Expand Up @@ -1783,8 +1798,23 @@ void netfuncNew3DS(void* __dummy_arg__)
for(int loopy = 1; loopy > 0; loopy--)
{
//soc->setPakSize(0);

int dmaState = 0;
for(int i = 0; i < 60; i++)
{
svcGetDmaState(&dmaState, dmahand);
if(dmaState == 4 || dmaState == 0)
break;
svcSleepThread(5e4);
}

tryStopDma();

#if DEBUG_BASIC==1
if(dmaState != 4 && dmaState != 0)
printf("DMA transfer not finished, stopping manually...\ndmaState=%i\n", dmaState);
#endif

//New3DS-Specific
svcFlushProcessDataCache(0xFFFF8001, (u8*)screenbuf, capin.screencapture[scr].framebuf_widthbytesize * 400);

Expand Down

0 comments on commit fae2a9d

Please sign in to comment.