(CTR) Use rarch_sleep and some style nits
This commit is contained in:
parent
8d4f6a172c
commit
88692cbb07
|
@ -128,7 +128,7 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
|
||||||
{
|
{
|
||||||
do{
|
do{
|
||||||
/* todo: compute the correct sleep period */
|
/* todo: compute the correct sleep period */
|
||||||
svcSleepThread(100000);
|
rarch_sleep(1);
|
||||||
current_tick = svcGetSystemTick();
|
current_tick = svcGetSystemTick();
|
||||||
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample;
|
||||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK;
|
||||||
|
|
|
@ -29,12 +29,11 @@
|
||||||
|
|
||||||
|
|
||||||
int __stacksize__ = 1*1024*1024;
|
int __stacksize__ = 1*1024*1024;
|
||||||
//char elf_path[512];
|
|
||||||
|
|
||||||
const char* elf_path_cst = "sdmc:/retroarch/test.3dsx";
|
const char* elf_path_cst = "sdmc:/retroarch/test.3dsx";
|
||||||
|
|
||||||
|
|
||||||
void wait_for_input(void);
|
void wait_for_input(void);
|
||||||
|
|
||||||
#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
|
#define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
|
||||||
|
|
||||||
static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||||
|
@ -42,7 +41,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||||
{
|
{
|
||||||
(void)args;
|
(void)args;
|
||||||
|
|
||||||
// return;
|
|
||||||
#ifndef IS_SALAMANDER
|
#ifndef IS_SALAMANDER
|
||||||
#if defined(HAVE_LOGGER)
|
#if defined(HAVE_LOGGER)
|
||||||
logger_init();
|
logger_init();
|
||||||
|
@ -52,9 +50,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// strlcpy(elf_path, argv[0], sizeof(elf_path));
|
|
||||||
|
|
||||||
// fill_pathname_basedir(g_defaults.port_dir, argv[0], sizeof(g_defaults.port_dir));
|
|
||||||
fill_pathname_basedir(g_defaults.port_dir, elf_path_cst, sizeof(g_defaults.port_dir));
|
fill_pathname_basedir(g_defaults.port_dir, elf_path_cst, sizeof(g_defaults.port_dir));
|
||||||
RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir);
|
RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir);
|
||||||
|
|
||||||
|
@ -76,34 +71,36 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||||
"retroarch.cfg", sizeof(g_defaults.config_path));
|
"retroarch.cfg", sizeof(g_defaults.config_path));
|
||||||
|
|
||||||
#ifndef IS_SALAMANDER
|
#ifndef IS_SALAMANDER
|
||||||
// if (argv[1] && (argv[1][0] != '\0'))
|
#if 0
|
||||||
// {
|
if (argv[1] && (argv[1][0] != '\0'))
|
||||||
// static char path[PATH_MAX_LENGTH];
|
{
|
||||||
// struct rarch_main_wrap *args = NULL;
|
static char path[PATH_MAX_LENGTH];
|
||||||
|
struct rarch_main_wrap *args = NULL;
|
||||||
|
|
||||||
// *path = '\0';
|
*path = '\0';
|
||||||
// args = (struct rarch_main_wrap*)params_data;
|
args = (struct rarch_main_wrap*)params_data;
|
||||||
|
|
||||||
// if (args)
|
if (args)
|
||||||
// {
|
{
|
||||||
// strlcpy(path, argv[1], sizeof(path));
|
strlcpy(path, argv[1], sizeof(path));
|
||||||
|
|
||||||
// args->touched = true;
|
args->touched = true;
|
||||||
// args->no_content = false;
|
args->no_content = false;
|
||||||
// args->verbose = false;
|
args->verbose = false;
|
||||||
// args->config_path = NULL;
|
args->config_path = NULL;
|
||||||
// args->sram_path = NULL;
|
args->sram_path = NULL;
|
||||||
// args->state_path = NULL;
|
args->state_path = NULL;
|
||||||
// args->content_path = path;
|
args->content_path = path;
|
||||||
// args->libretro_path = NULL;
|
args->libretro_path = NULL;
|
||||||
|
|
||||||
// RARCH_LOG("argv[0]: %s\n", argv[0]);
|
RARCH_LOG("argv[0]: %s\n", argv[0]);
|
||||||
// RARCH_LOG("argv[1]: %s\n", argv[1]);
|
RARCH_LOG("argv[1]: %s\n", argv[1]);
|
||||||
// RARCH_LOG("argv[2]: %s\n", argv[2]);
|
RARCH_LOG("argv[2]: %s\n", argv[2]);
|
||||||
|
|
||||||
// RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +122,13 @@ static void frontend_ctr_deinit(void *data)
|
||||||
csndExit();
|
csndExit();
|
||||||
gfxExit();
|
gfxExit();
|
||||||
|
|
||||||
// sdmcExit();
|
#if 0
|
||||||
// fsExit();
|
sdmcExit();
|
||||||
// hidExit();
|
fsExit();
|
||||||
// aptExit();
|
hidExit();
|
||||||
// srvExit();
|
aptExit();
|
||||||
|
srvExit();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +139,7 @@ static void frontend_ctr_shutdown(bool unused)
|
||||||
|
|
||||||
#define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H"
|
#define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H"
|
||||||
#define PRINTFPOS_STR(X,Y) "\x1b["X";"Y"H"
|
#define PRINTFPOS_STR(X,Y) "\x1b["X";"Y"H"
|
||||||
|
|
||||||
static void frontend_ctr_init(void *data)
|
static void frontend_ctr_init(void *data)
|
||||||
{
|
{
|
||||||
#ifndef IS_SALAMANDER
|
#ifndef IS_SALAMANDER
|
||||||
|
@ -147,20 +147,21 @@ static void frontend_ctr_init(void *data)
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
global->verbosity = true;
|
global->verbosity = true;
|
||||||
|
|
||||||
// srvInit();
|
#if 0
|
||||||
// aptInit();
|
srvInit();
|
||||||
// hidInit();
|
aptInit();
|
||||||
// fsInit();
|
hidInit();
|
||||||
// sdmcInit();
|
fsInit();
|
||||||
|
sdmcInit();
|
||||||
|
|
||||||
// APT_SetAppCpuTimeLimit(NULL, 80);
|
APT_SetAppCpuTimeLimit(NULL, 80);
|
||||||
// gfxInitDefault();
|
gfxInitDefault();
|
||||||
|
#endif
|
||||||
gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
|
gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
|
||||||
csndInit();
|
csndInit();
|
||||||
gfxSet3D(false);
|
gfxSet3D(false);
|
||||||
consoleInit(GFX_BOTTOM, NULL);
|
consoleInit(GFX_BOTTOM, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,21 +169,29 @@ static int frontend_ctr_get_rating(void)
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select_pressed = false;
|
bool select_pressed = false;
|
||||||
void wait_for_input()
|
|
||||||
|
void wait_for_input(void)
|
||||||
{
|
{
|
||||||
printf("\n\nPress Start.\n\n");fflush(stdout);
|
printf("\n\nPress Start.\n\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
while(aptMainLoop())
|
while(aptMainLoop())
|
||||||
{
|
{
|
||||||
|
u32 kDown;
|
||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
u32 kDown = hidKeysDown();
|
|
||||||
|
kDown = hidKeysDown();
|
||||||
|
|
||||||
if (kDown & KEY_START)
|
if (kDown & KEY_START)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (kDown & KEY_SELECT)
|
if (kDown & KEY_SELECT)
|
||||||
select_pressed = true;
|
select_pressed = true;
|
||||||
|
|
||||||
svcSleepThread(1000000);
|
rarch_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue