-Touched up cogs
-Added mutex functions, hopefully that will fix flashing issues (I really need to start testing this stuff) -Some background optimizations and code cleanup -Added PORTLIBS to Makefile
2
Makefile
@ -46,7 +46,7 @@ LIBS += -lruntimeiospatch
|
|||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBDIRS :=
|
LIBDIRS := $(PORTLIBS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <ogc/lwp.h>
|
#include <ogc/lwp.h>
|
||||||
|
|
||||||
extern lwp_t Cog_Thread;
|
extern lwp_t Cog_Thread;
|
||||||
extern u64 Last_Cog_Turn;
|
|
||||||
extern u8 Cog_Num;
|
extern u8 Cog_Num;
|
||||||
extern vu8 done;
|
extern vu8 done;
|
||||||
|
|
||||||
@ -13,4 +12,9 @@ void * DrawCogThread(void *arg);
|
|||||||
s32 PauseThread(void);
|
s32 PauseThread(void);
|
||||||
s32 ResumeThread(void);
|
s32 ResumeThread(void);
|
||||||
s32 StopThread(void);
|
s32 StopThread(void);
|
||||||
|
void InitMutex(void);
|
||||||
|
void DeinitMutex(void);
|
||||||
|
void LockMutex(void);
|
||||||
|
void UnlockMutex(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
2339
source/gfx/Cog2.h
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
2354
source/gfx/Cog3.h
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
2335
source/gfx/Cog4.h
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
2301
source/gfx/Cog5.h
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
17
source/gui.c
@ -162,12 +162,13 @@ int initGUI(void) {
|
|||||||
tex_Cogs_png[4] = GRRLIB_LoadTexturePNG(Cog5);
|
tex_Cogs_png[4] = GRRLIB_LoadTexturePNG(Cog5);
|
||||||
tex_ScreenBuf = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
|
tex_ScreenBuf = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
|
||||||
InitThread();
|
InitThread();
|
||||||
|
InitMutex();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deinitGUI(void) {
|
void deinitGUI(void) {
|
||||||
StopThread();
|
StopThread();
|
||||||
|
DeinitMutex();
|
||||||
GRRLIB_FreeTTF(myFont);
|
GRRLIB_FreeTTF(myFont);
|
||||||
GRRLIB_FreeTexture(tex_background_png);
|
GRRLIB_FreeTexture(tex_background_png);
|
||||||
GRRLIB_FreeTexture(tex_Checkicon_png);
|
GRRLIB_FreeTexture(tex_Checkicon_png);
|
||||||
@ -225,11 +226,13 @@ int printSuccess(const char* msg) {
|
|||||||
int printLoading(const char* msg) {
|
int printLoading(const char* msg) {
|
||||||
//int i;
|
//int i;
|
||||||
//ResumeThread();
|
//ResumeThread();
|
||||||
|
LockMutex();
|
||||||
u64 current_ticks = gettick();
|
u64 current_ticks = gettick();
|
||||||
//GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE);
|
//GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE);
|
||||||
GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE);
|
GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE);
|
||||||
GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, HEX_WHITE);
|
GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, HEX_WHITE);
|
||||||
CopyBuf();
|
CopyBuf();
|
||||||
|
UnlockMutex();
|
||||||
//for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
|
//for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
|
||||||
while(!CheckTime(current_ticks, 250)) {
|
while(!CheckTime(current_ticks, 250)) {
|
||||||
//DrawBuf();
|
//DrawBuf();
|
||||||
@ -268,6 +271,7 @@ int printLoadingBar(const char* msg, const f32 percent) {
|
|||||||
if (loaded > 536) loaded = 536;
|
if (loaded > 536) loaded = 536;
|
||||||
|
|
||||||
notloaded = 536 - loaded;
|
notloaded = 536 - loaded;
|
||||||
|
LockMutex();
|
||||||
|
|
||||||
//int i;
|
//int i;
|
||||||
GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE);
|
GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE);
|
||||||
@ -276,6 +280,7 @@ int printLoadingBar(const char* msg, const f32 percent) {
|
|||||||
GRRLIB_DrawPart(52, 340, 0, 0, loaded, 36, tex_loadingbarblue_png, 0, 1, 1, HEX_WHITE);
|
GRRLIB_DrawPart(52, 340, 0, 0, loaded, 36, tex_loadingbarblue_png, 0, 1, 1, HEX_WHITE);
|
||||||
GRRLIB_DrawPart(52+loaded, 340, loaded, 0, notloaded, 36, tex_loadingbargrey_png, 0, 1, 1, HEX_WHITE);
|
GRRLIB_DrawPart(52+loaded, 340, loaded, 0, notloaded, 36, tex_loadingbargrey_png, 0, 1, 1, HEX_WHITE);
|
||||||
CopyBuf();
|
CopyBuf();
|
||||||
|
UnlockMutex();
|
||||||
//for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
|
//for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
|
||||||
while(!CheckTime(current_ticks, 250)) {
|
while(!CheckTime(current_ticks, 250)) {
|
||||||
//DrawBuf();
|
//DrawBuf();
|
||||||
@ -313,16 +318,6 @@ int printEndSuccess(const char* msg) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*inline void DrawCog(void) {
|
|
||||||
if (CheckTime(Last_Cog_Turn, 25)) {
|
|
||||||
Cog_Num++;
|
|
||||||
if (Cog_Num > 4) Cog_Num = 0;
|
|
||||||
Last_Cog_Turn = gettick();
|
|
||||||
}
|
|
||||||
GRRLIB_DrawImg(220, 150, tex_Cogs_png[Cog_Num], 0, 1, 1, HEX_WHITE);
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int printEndError(const char* msg) {
|
int printEndError(const char* msg) {
|
||||||
int i;
|
int i;
|
||||||
PauseThread();
|
PauseThread();
|
||||||
|
@ -1048,15 +1048,15 @@ int main(int argc, char **argv)
|
|||||||
int lineOffset = 0;
|
int lineOffset = 0;
|
||||||
for (i = 0; i < nbTitles; i++)
|
for (i = 0; i < nbTitles; i++)
|
||||||
{
|
{
|
||||||
lineOffset = i;
|
lineOffset = i + LAST;
|
||||||
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
|
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
|
||||||
|
|
||||||
if (ios[i].titleID == 256) {
|
if (ios[i].titleID == 256) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "BC v%d", ios[i].revision);
|
sprintf(ReportBuffer[lineOffset], "BC v%d", ios[i].revision);
|
||||||
} else if (ios[i].titleID == 257) {
|
} else if (ios[i].titleID == 257) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "MIOS v%d%s", ios[i].revision, miosInfo);
|
sprintf(ReportBuffer[lineOffset], "MIOS v%d%s", ios[i].revision, miosInfo);
|
||||||
} else if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS == 75) {
|
} else if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS == 75) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d[38+37] (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
|
sprintf(ReportBuffer[lineOffset], "IOS%d[38+37] (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
|
||||||
} else {
|
} else {
|
||||||
if(ios[i].mloadVersion > 0 && ios[i].baseIOS > 0) {
|
if(ios[i].mloadVersion > 0 && ios[i].baseIOS > 0) {
|
||||||
int v, s;
|
int v, s;
|
||||||
@ -1067,50 +1067,48 @@ int main(int argc, char **argv)
|
|||||||
v = 4;
|
v = 4;
|
||||||
s = 0;
|
s = 0;
|
||||||
}
|
}
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d[%d] (rev %d, Info: hermes-v%d.%d):", ios[i].titleID, ios[i].baseIOS, ios[i].revision, v, s);
|
sprintf(ReportBuffer[lineOffset], "IOS%d[%d] (rev %d, Info: hermes-v%d.%d):", ios[i].titleID, ios[i].baseIOS, ios[i].revision, v, s);
|
||||||
} else if(ios[i].baseIOS > 0) {
|
} else if(ios[i].baseIOS > 0) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d[%d] (rev %d, Info: %s):", ios[i].titleID, ios[i].baseIOS, ios[i].revision, ios[i].info);
|
sprintf(ReportBuffer[lineOffset], "IOS%d[%d] (rev %d, Info: %s):", ios[i].titleID, ios[i].baseIOS, ios[i].revision, ios[i].info);
|
||||||
} else if (strcmp(ios[i].info, "NULL") != 0 && !ios[i].isStub) {
|
} else if (strcmp(ios[i].info, "NULL") != 0 && !ios[i].isStub) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
|
sprintf(ReportBuffer[lineOffset], "IOS%d (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
|
||||||
} else if (ios[i].titleID == 249 && ios[i].revision > 11 && ios[i].revision < 18) {
|
} else if (ios[i].titleID == 249 && ios[i].revision > 11 && ios[i].revision < 18) {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d[38] (rev %d):", ios[i].titleID, ios[i].revision);
|
sprintf(ReportBuffer[lineOffset], "IOS%d[38] (rev %d):", ios[i].titleID, ios[i].revision);
|
||||||
} else {
|
} else {
|
||||||
sprintf(ReportBuffer[LAST+lineOffset], "IOS%d (rev %d):", ios[i].titleID, ios[i].revision);
|
sprintf(ReportBuffer[lineOffset], "IOS%d (rev %d):", ios[i].titleID, ios[i].revision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check BootMii As IOS (BootMii As IOS is installed on IOS254 rev 31338)
|
// Check BootMii As IOS (BootMii As IOS is installed on IOS254 rev 31338)
|
||||||
if (ios[i].titleID == 254 && (ios[i].revision == 31338 || ios[i].revision == 65281))
|
if (ios[i].titleID == 254 && (ios[i].revision == 31338 || ios[i].revision == 65281))
|
||||||
strcat (ReportBuffer[LAST+lineOffset]," BootMii");
|
strcat (ReportBuffer[lineOffset]," BootMii");
|
||||||
else if (ios[i].titleID == 253 && ios[i].revision == 65535)
|
else if (ios[i].titleID == 253 && ios[i].revision == 65535)
|
||||||
strcat (ReportBuffer[LAST+lineOffset]," NANDEmu");
|
strcat (ReportBuffer[lineOffset]," NANDEmu");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ios[i].isStub && strcmp(ios[i].info, "NULL") == 0) {
|
if (ios[i].isStub && strcmp(ios[i].info, "NULL") == 0) {
|
||||||
gprintf("1. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
gprintf("1. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
||||||
strcat (ReportBuffer[LAST+lineOffset], TXT_Stub);
|
strcat (ReportBuffer[lineOffset], TXT_Stub);
|
||||||
} else if (ios[i].isStub && strcmp(ios[i].info, "NULL") != 0) {
|
} else if (ios[i].isStub && strcmp(ios[i].info, "NULL") != 0) {
|
||||||
gprintf("2. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
gprintf("2. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
||||||
strcat (ReportBuffer[LAST+lineOffset], ios[i].info);
|
strcat (ReportBuffer[lineOffset], ios[i].info);
|
||||||
} else if(ios[i].titleID == 256 || ios[i].titleID == 257) {
|
} else if(ios[i].titleID != 256 && ios[i].titleID != 257) {
|
||||||
//Do nothing
|
if(ios[i].infoFakeSignature) strcat(ReportBuffer[lineOffset], TXT_Trucha);
|
||||||
} else {
|
if(ios[i].infoESIdentify) strcat(ReportBuffer[lineOffset], TXT_ES);
|
||||||
if(ios[i].infoFakeSignature) strcat(ReportBuffer[LAST+lineOffset], TXT_Trucha);
|
if(ios[i].infoFlashAccess) strcat(ReportBuffer[lineOffset], TXT_Flash);
|
||||||
if(ios[i].infoESIdentify) strcat(ReportBuffer[LAST+lineOffset], TXT_ES);
|
if(ios[i].infoNANDAccess) strcat(ReportBuffer[lineOffset], TXT_NAND);
|
||||||
if(ios[i].infoFlashAccess) strcat(ReportBuffer[LAST+lineOffset], TXT_Flash);
|
if(ios[i].infoVersionPatch) strcat(ReportBuffer[lineOffset], TXT_VersionP);
|
||||||
if(ios[i].infoNANDAccess) strcat(ReportBuffer[LAST+lineOffset], TXT_NAND);
|
if(ios[i].infoBoot2Access) strcat(ReportBuffer[lineOffset], TXT_Boot2);
|
||||||
if(ios[i].infoVersionPatch) strcat(ReportBuffer[LAST+lineOffset], TXT_VersionP);
|
if(ios[i].infoUSB2) strcat(ReportBuffer[lineOffset], TXT_USB);
|
||||||
if(ios[i].infoBoot2Access) strcat(ReportBuffer[LAST+lineOffset], TXT_Boot2);
|
if(!ios[i].infoFakeSignature && !ios[i].infoESIdentify && !ios[i].infoFlashAccess && !ios[i].infoNANDAccess && !ios[i].infoUSB2 && !ios[i].infoVersionPatch) strcat(ReportBuffer[lineOffset], TXT_NoPatch);
|
||||||
if(ios[i].infoUSB2) strcat(ReportBuffer[LAST+lineOffset], TXT_USB);
|
|
||||||
if(!ios[i].infoFakeSignature && !ios[i].infoESIdentify && !ios[i].infoFlashAccess && !ios[i].infoNANDAccess && !ios[i].infoUSB2 && !ios[i].infoVersionPatch) strcat(ReportBuffer[LAST+lineOffset], TXT_NoPatch);
|
|
||||||
|
|
||||||
ReportBuffer[LAST+lineOffset][strlen(ReportBuffer[LAST+lineOffset])-1]='\0';
|
ReportBuffer[lineOffset][strlen(ReportBuffer[lineOffset])-1]='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(ReportBuffer[17+lineOffset], TXT_ReportDate);
|
int NumLines = lineOffset+1;
|
||||||
int NumLines = 17+lineOffset;
|
sprintf(ReportBuffer[NumLines], TXT_ReportDate);
|
||||||
|
|
||||||
// Mount the SD Card
|
// Mount the SD Card
|
||||||
printLoading(MSG_MountSD);
|
printLoading(MSG_MountSD);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ogc/lwp_watchdog.h>
|
#include <ogc/lwp_watchdog.h>
|
||||||
#include <ogc/lwp.h>
|
#include <ogc/lwp.h>
|
||||||
|
#include <ogc/mutex.h>
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
@ -13,7 +14,9 @@ lwp_t Cog_Thread;
|
|||||||
u8 stack[STACKSIZE] ATTRIBUTE_ALIGN (32);
|
u8 stack[STACKSIZE] ATTRIBUTE_ALIGN (32);
|
||||||
vu8 done = 0;
|
vu8 done = 0;
|
||||||
u8 Cog_Num = 0;
|
u8 Cog_Num = 0;
|
||||||
u64 Last_Cog_Turn = 0;
|
static u64 Last_Cog_Turn = 0;
|
||||||
|
static mutex_t GUI_mutex = LWP_THREAD_NULL;
|
||||||
|
static bool mutex_initialized = false;
|
||||||
|
|
||||||
void * DrawCogThread(void *arg) {
|
void * DrawCogThread(void *arg) {
|
||||||
while(!done) { // Keep the thread running until done != 0
|
while(!done) { // Keep the thread running until done != 0
|
||||||
@ -51,3 +54,21 @@ inline s32 StopThread(void) {
|
|||||||
ResumeThread();
|
ResumeThread();
|
||||||
return LWP_JoinThread(Cog_Thread, NULL);
|
return LWP_JoinThread(Cog_Thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void InitMutex(void) {
|
||||||
|
if (GUI_mutex == LWP_THREAD_NULL) LWP_MutexInit(&GUI_mutex, false);
|
||||||
|
mutex_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void DeinitMutex(void) {
|
||||||
|
if (GUI_mutex != LWP_THREAD_NULL) LWP_MutexDestroy(GUI_mutex);
|
||||||
|
mutex_initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void LockMutex(void) {
|
||||||
|
if (mutex_initialized) LWP_MutexLock(GUI_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void UnlockMutex(void) {
|
||||||
|
if (mutex_initialized) LWP_MutexUnlock(GUI_mutex);
|
||||||
|
}
|