mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-22 05:15:51 +12:00
Proper handling of SetApplicationCpuTimeLimit
with invalid parameters (#353)
* Add NotImplemented error code * Add proper handling of SetAppCpuTimeLimit with invalid params Set default time limit to 0 * Add AppCpuTimeLimit tests * Replace spaces with tab
This commit is contained in:
parent
6dc75db37f
commit
6c73fb13c5
5 changed files with 324 additions and 9 deletions
55
tests/AppCpuTimeLimit/source/main.c
Normal file
55
tests/AppCpuTimeLimit/source/main.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <3ds.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gfxInitDefault();
|
||||
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
|
||||
printf("--- APT::SetAppCpuTimeLimit ---\n\n");
|
||||
|
||||
// Get initial percentage
|
||||
u32 percentage;
|
||||
APT_GetAppCpuTimeLimit(&percentage);
|
||||
|
||||
printf("Initial percentage: %lu\n\n", percentage);
|
||||
|
||||
// Try all percentages from 0-100%, print failed calls
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
const Result res = APT_SetAppCpuTimeLimit(i);
|
||||
|
||||
if (R_FAILED(res)) {
|
||||
APT_GetAppCpuTimeLimit(&percentage);
|
||||
|
||||
printf("[%d:%lu:%lX]\n", i, percentage, res);
|
||||
}
|
||||
}
|
||||
|
||||
// Send command with invalid fixed value
|
||||
u32 aptcmdbuf[16];
|
||||
aptcmdbuf[0] = 0x004F0080;
|
||||
aptcmdbuf[1] = 0;
|
||||
aptcmdbuf[2] = 20;
|
||||
|
||||
aptSendCommand(aptcmdbuf);
|
||||
|
||||
printf("\nWith fixed = 0: [%08lX:%08lX]\n", aptcmdbuf[0], aptcmdbuf[1]);
|
||||
|
||||
while (aptMainLoop()) {
|
||||
hidScanInput();
|
||||
|
||||
if ((hidKeysDown() & KEY_START) != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
|
||||
gfxExit();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue