mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 17:17:09 -04:00
PSP: Switching from launcher to game now kinda works
This commit is contained in:
parent
eb164f588a
commit
bb55a87bdb
@ -426,26 +426,31 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
|
||||
static char gameArgs[GAME_MAX_CMDARGS][STRING_SIZE];
|
||||
static int gameNumArgs;
|
||||
static cc_bool gameHasArgs;
|
||||
|
||||
cc_result Process_StartGame2(const cc_string* args, int numArgs) {
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
{
|
||||
String_CopyToRawArray(gameArgs[i], &args[i]);
|
||||
}
|
||||
|
||||
Platform_LogConst("START GAME");
|
||||
gameHasArgs = true;
|
||||
gameNumArgs = numArgs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetGameArgs(cc_string* args) {
|
||||
int count = gameNumArgs;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
args[i] = String_FromRawArray(gameArgs[i]);
|
||||
}
|
||||
|
||||
// clear arguments so after game is closed, launcher is started
|
||||
gameNumArgs = 0;
|
||||
return count;
|
||||
gameNumArgs = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, cc_string* args) {
|
||||
if (gameHasArgs) return GetGameArgs(args);
|
||||
|
||||
@ -559,4 +564,4 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) {
|
||||
cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -422,7 +422,7 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
|
||||
cc_result res = Socket_Poll(s, SOCKET_POLL_WRITE, writable);
|
||||
if (res || *writable) return res;
|
||||
|
||||
/* https://stackoverflow.com/questions/29479953/so-error-value-after-successful-socket-operation */
|
||||
// https://stackoverflow.com/questions/29479953/so-error-value-after-successful-socket-operation
|
||||
sceNetInetGetsockopt(s, SOL_SOCKET, SO_ERROR, &res, &resultSize);
|
||||
return res;
|
||||
}
|
||||
@ -431,8 +431,51 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------Process/Module------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static char gameArgs[GAME_MAX_CMDARGS][STRING_SIZE];
|
||||
static int gameNumArgs;
|
||||
static cc_bool gameHasArgs;
|
||||
|
||||
cc_result Process_StartGame2(const cc_string* args, int numArgs) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
{
|
||||
String_CopyToRawArray(gameArgs[i], &args[i]);
|
||||
}
|
||||
|
||||
Platform_LogConst("START GAME");
|
||||
gameHasArgs = true;
|
||||
gameNumArgs = numArgs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetGameArgs(cc_string* args) {
|
||||
int count = gameNumArgs;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
args[i] = String_FromRawArray(gameArgs[i]);
|
||||
}
|
||||
|
||||
// clear arguments so after game is closed, launcher is started
|
||||
gameNumArgs = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, cc_string* args) {
|
||||
if (gameHasArgs) return GetGameArgs(args);
|
||||
argc--; argv++; // skip executable path argument
|
||||
|
||||
int count = min(argc, GAME_MAX_CMDARGS);
|
||||
Platform_Log1("ARGS: %i", &count);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
args[i] = String_FromReadonly(argv[i]);
|
||||
Platform_Log2(" ARG %i = %c", &i, argv[i]);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
|
||||
return 0; // TODO switch to RomFS ??
|
||||
}
|
||||
|
||||
void Process_Exit(cc_result code) { exit(code); }
|
||||
@ -519,23 +562,4 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) {
|
||||
cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------Configuration-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, cc_string* args) {
|
||||
int i, count;
|
||||
argc--; argv++; /* skip executable path argument */
|
||||
|
||||
count = min(argc, GAME_MAX_CMDARGS);
|
||||
for (i = 0; i < count; i++) {
|
||||
args[i] = String_FromReadonly(argv[i]);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
|
||||
return 0; /* TODO switch to RomFS ?? */
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -138,7 +138,7 @@ void android_main(void) {
|
||||
SetupProgram(0, NULL);
|
||||
for (;;) { RunProgram(0, NULL); }
|
||||
}
|
||||
#elif defined CC_BUILD_3DS
|
||||
#elif defined CC_BUILD_3DS || defined CC_BUILD_PSP
|
||||
int main(int argc, char** argv) {
|
||||
SetupProgram(argc, argc);
|
||||
for (;;) { RunProgram(argc, argv); }
|
||||
|
@ -76,8 +76,8 @@ void Window_ProcessEvents(void) {
|
||||
|
||||
Input_SetNonRepeatable(IPT_ENTER, mods & PSP_CTRL_START);
|
||||
Input_SetNonRepeatable(IPT_ESCAPE, mods & PSP_CTRL_SELECT);
|
||||
// fake tab with down for Launcher
|
||||
Input_SetNonRepeatable(IPT_TAB, mods & PSP_CTRL_DOWN);
|
||||
// fake tab with PSP_CTRL_SQUARE for Launcher too
|
||||
Input_SetNonRepeatable(IPT_TAB, mods & PSP_CTRL_SQUARE);
|
||||
|
||||
Input_SetNonRepeatable(KeyBinds[KEYBIND_LEFT], mods & PSP_CTRL_LEFT);
|
||||
Input_SetNonRepeatable(IPT_LEFT, mods & PSP_CTRL_LEFT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user