mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
(Wii) forward arguments to loaded DOL files, fixes paths
This commit is contained in:
parent
fe5a11b051
commit
cc52ee9754
@ -5,6 +5,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
#include <gctypes.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
|
||||||
#include "../../retroarch_logger.h"
|
#include "../../retroarch_logger.h"
|
||||||
@ -22,7 +23,9 @@ typedef struct _dolheader
|
|||||||
uint32_t entry_point;
|
uint32_t entry_point;
|
||||||
} dolheader;
|
} dolheader;
|
||||||
|
|
||||||
uint32_t load_dol_image (void *dolstart)
|
static char dol_argv_commandline[1024];
|
||||||
|
|
||||||
|
uint32_t *load_dol_image (void *dolstart)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
dolheader *dolfile;
|
dolheader *dolfile;
|
||||||
@ -35,7 +38,7 @@ uint32_t load_dol_image (void *dolstart)
|
|||||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RARCH_LOG("loading text section %u @ 0x%08x (0x%08x bytes)\n",
|
RARCH_LOG("loading text section %u @ 0x%08x (0x%08x bytes)\n",
|
||||||
i, dolfile->text_start[i], dolfile->text_size[i]);
|
i, dolfile->text_start[i], dolfile->text_size[i]);
|
||||||
|
|
||||||
ICInvalidateRange ((void *) dolfile->text_start[i],
|
ICInvalidateRange ((void *) dolfile->text_start[i],
|
||||||
@ -50,13 +53,13 @@ uint32_t load_dol_image (void *dolstart)
|
|||||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RARCH_LOG("loading data section %u @ 0x%08x (0x%08x bytes)\n", i,
|
RARCH_LOG("loading data section %u @ 0x%08x (0x%08x bytes)\n", i,
|
||||||
dolfile->data_start[i], dolfile->data_size[i]);
|
dolfile->data_start[i], dolfile->data_size[i]);
|
||||||
|
|
||||||
memmove ((void*) dolfile->data_start[i], dolstart+dolfile->data_pos[i],
|
memmove ((void*) dolfile->data_start[i], dolstart+dolfile->data_pos[i],
|
||||||
dolfile->data_size[i]);
|
dolfile->data_size[i]);
|
||||||
|
|
||||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i], dolfile->data_size[i]);
|
DCFlushRangeNoSync ((void *) dolfile->data_start[i], dolfile->data_size[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_LOG("clearing bss\n");
|
RARCH_LOG("clearing bss\n");
|
||||||
@ -64,9 +67,20 @@ uint32_t load_dol_image (void *dolstart)
|
|||||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||||
|
|
||||||
return dolfile->entry_point;
|
return (uint32_t *) dolfile->entry_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: this does not update the path to point to the new loading .dol file.
|
||||||
|
// we only ues it for keeping the current path anyway.
|
||||||
|
void dol_copy_argv(struct __argv *argv)
|
||||||
|
{
|
||||||
|
memcpy(dol_argv_commandline, __system_argv->commandLine, __system_argv->length);
|
||||||
|
DCFlushRange((void *) dol_argv_commandline, sizeof(dol_argv_commandline));
|
||||||
|
argv->argvMagic = ARGV_MAGIC;
|
||||||
|
argv->commandLine = dol_argv_commandline;
|
||||||
|
argv->length = __system_argv->length;
|
||||||
|
DCFlushRange((void *) argv, sizeof(struct __argv));
|
||||||
|
}
|
||||||
|
@ -24,10 +24,8 @@
|
|||||||
|
|
||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
|
|
||||||
uint32_t load_dol_image (void *dolstart);
|
uint32_t *load_dol_image (void *dolstart);
|
||||||
|
void dol_copy_argv(struct __argv *argv);
|
||||||
extern void __exception_closeall(void);
|
|
||||||
extern int32_t __IOS_ShutdownSubSystems(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <ogc/lwp_threads.h>
|
#include <ogc/lwp_threads.h>
|
||||||
#include <ogc/system.h>
|
#include <ogc/system.h>
|
||||||
|
#include <gctypes.h>
|
||||||
#include "exec/dol.h"
|
#include "exec/dol.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,12 +88,16 @@ void rarch_console_exec(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
fatUnmount("carda:");
|
fatUnmount("carda:");
|
||||||
fatUnmount("cardb:");
|
fatUnmount("cardb:");
|
||||||
void (*ep)() = (void(*)())load_dol_image(mem);
|
uint32_t *ep = load_dol_image(mem);
|
||||||
RARCH_LOG("jumping to 0x%08X\n", (uint32_t)ep);
|
|
||||||
|
if (ep[1] == ARGV_MAGIC)
|
||||||
|
dol_copy_argv((struct __argv *) &ep[2]);
|
||||||
|
|
||||||
|
RARCH_LOG("jumping to 0x%08X\n", (uint32_t) ep);
|
||||||
|
|
||||||
SYS_ResetSystem(SYS_SHUTDOWN,0,0);
|
SYS_ResetSystem(SYS_SHUTDOWN,0,0);
|
||||||
|
|
||||||
__lwp_thread_stopmultitasking(ep);
|
__lwp_thread_stopmultitasking((void(*)()) ep);
|
||||||
#else
|
#else
|
||||||
RARCH_WARN("External loading of executables is not supported for this platform.\n");
|
RARCH_WARN("External loading of executables is not supported for this platform.\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,11 +48,11 @@ static void find_and_set_first_file(void)
|
|||||||
//Last fallback - we'll need to start the first executable file
|
//Last fallback - we'll need to start the first executable file
|
||||||
// we can find in the RetroArch cores directory
|
// we can find in the RetroArch cores directory
|
||||||
|
|
||||||
char first_file[512];
|
char first_file[512] = {0};
|
||||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file),
|
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file),
|
||||||
LIBRETRO_DIR_PATH, "dol");
|
LIBRETRO_DIR_PATH, "dol");
|
||||||
|
|
||||||
if(first_file)
|
if(first_file[0])
|
||||||
strlcpy(libretro_path, first_file, sizeof(libretro_path));
|
strlcpy(libretro_path, first_file, sizeof(libretro_path));
|
||||||
else
|
else
|
||||||
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
|
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
|
||||||
@ -89,8 +89,8 @@ static void init_settings(void)
|
|||||||
if(config_file_exists)
|
if(config_file_exists)
|
||||||
{
|
{
|
||||||
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
|
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
|
||||||
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
|
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
|
||||||
snprintf(libretro_path, sizeof(libretro_path), tmp_str);
|
snprintf(libretro_path, sizeof(libretro_path), tmp_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!config_file_exists || !strcmp(libretro_path, ""))
|
if(!config_file_exists || !strcmp(libretro_path, ""))
|
||||||
@ -111,14 +111,14 @@ static void get_environment_settings(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LOGGER
|
|
||||||
logger_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
L2Enhance();
|
L2Enhance();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LOGGER
|
||||||
|
logger_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
fatInitDefault();
|
fatInitDefault();
|
||||||
getcwd(app_dir, sizeof(app_dir));
|
getcwd(app_dir, sizeof(app_dir));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user