- gui sound volume fix.

- various minor code changes.
This commit is contained in:
Fledge68 2022-05-06 17:55:01 -05:00
parent bf5870677a
commit dff4272de0
10 changed files with 77 additions and 71 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -1,6 +1,6 @@
#define APP_NAME "WiiFlow WFL" #define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.5.3" #define APP_VERSION "5.5.4 beta 1"
#define APP_DATA_DIR "wiiflow" #define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow" #define APPS_DIR "apps/wiiflow"

View File

@ -95,6 +95,7 @@ static void getBaseColors(u8 *color0, u8 *color1, const u8 *srcBlock)
{ {
int maxDistance = -1; int maxDistance = -1;
for (int i = 0; i < 15; ++i) for (int i = 0; i < 15; ++i)
{
for (int j = i + 1; j < 16; ++j) for (int j = i + 1; j < 16; ++j)
{ {
int distance = colorDistance(srcBlock + i * 4, srcBlock + j * 4); int distance = colorDistance(srcBlock + i * 4, srcBlock + j * 4);
@ -105,6 +106,7 @@ static void getBaseColors(u8 *color0, u8 *color1, const u8 *srcBlock)
*(u32 *)color1 = ((u32 *)srcBlock)[j]; *(u32 *)color1 = ((u32 *)srcBlock)[j];
} }
} }
}
if (rgb8ToRGB565(color0) < rgb8ToRGB565(color1)) if (rgb8ToRGB565(color0) < rgb8ToRGB565(color1))
{ {
u32 tmp; u32 tmp;
@ -161,7 +163,9 @@ static inline void _convertToCMPR(u8 *dst, const u8 *src, u32 width, u32 height)
u8 color1[4]; u8 color1[4];
for (u32 jj = 0; jj < height; jj += 8) for (u32 jj = 0; jj < height; jj += 8)
{
for (u32 ii = 0; ii < width; ii += 8) for (u32 ii = 0; ii < width; ii += 8)
{
for (u32 k = 0; k < 4; ++k) for (u32 k = 0; k < 4; ++k)
{ {
int i = ii + ((k & 1) << 2); int i = ii + ((k & 1) << 2);
@ -179,6 +183,8 @@ static inline void _convertToCMPR(u8 *dst, const u8 *src, u32 width, u32 height)
dst += 4; dst += 4;
} }
} }
}
}
void STexture::Cleanup(TexData &tex) void STexture::Cleanup(TexData &tex)
{ {
@ -650,7 +656,8 @@ void STexture::_resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight)
void STexture::_calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Height, u32 width, u32 height, u32 minSize, u32 maxSize) void STexture::_calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Height, u32 width, u32 height, u32 minSize, u32 maxSize)
{ {
if (minSize < 8) minSize = 8; if (minSize < 8)
minSize = 8;
lod0Width = upperPower(width); lod0Width = upperPower(width);
lod0Height = upperPower(height); lod0Height = upperPower(height);
if (width - (lod0Width >> 1) < lod0Width >> 3 && minSize <= lod0Width >> 1) if (width - (lod0Width >> 1) < lod0Width >> 3 && minSize <= lod0Width >> 1)
@ -662,8 +669,10 @@ void STexture::_calcMipMaps(u8 &maxLOD, u8 &minLOD, u32 &lod0Width, u32 &lod0Hei
++maxLOD; ++maxLOD;
minLOD = 0; minLOD = 0;
if (maxSize > 8) if (maxSize > 8)
{
for (u32 i = std::max(lod0Width, lod0Height); i > maxSize; i >>= 1) for (u32 i = std::max(lod0Width, lod0Height); i > maxSize; i >>= 1)
++minLOD; ++minLOD;
}
if (minLOD > maxLOD) if (minLOD > maxLOD)
maxLOD = minLOD; maxLOD = minLOD;
} }

View File

@ -13,16 +13,14 @@
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
static u8 *EXECUTE_ADDR = (u8*)0x92000000; static u8 *EXECUTE_ADDR = (u8*)0x92000000;// 92000000 usblgx app booter
static u8 *BOOTER_ADDR = (u8*)0x93300000; static u8 *BOOTER_ADDR = (u8*)0x93300000;//93000000 usblgx app booter
static entry BOOTER_ENTRY = (entry)BOOTER_ADDR; static entry BOOTER_ENTRY = (entry)BOOTER_ADDR;
static __argv *ARGS_ADDR = (__argv*)0x93300800; //more than twice as much as the appbooter, just for safety static __argv *ARGS_ADDR = (__argv*)0x93300800; // 93200000 usblgx app booter
static char *CMD_ADDR = (char*)ARGS_ADDR + sizeof(struct __argv); static char *CMD_ADDR = (char*)ARGS_ADDR + sizeof(struct __argv);
extern "C" { void __exception_closeall(); }
char *homebrew_ptr = NULL; char *homebrew_ptr = NULL;
u32 homebrew_size = 0; u32 homebrew_size = 0;
@ -131,8 +129,8 @@ static int SetupARGV()
position += Arguments[i].size() + 1; position += Arguments[i].size() + 1;
} }
args->commandLine[args->length - 1] = '\0'; args->commandLine[args->length - 1] = '\0';
args->argv = &args->commandLine; //args->argv = &args->commandLine;
args->endARGV = args->argv + 1; //args->endARGV = args->argv + 1;
Arguments.clear(); Arguments.clear();
return 0; return 0;
@ -156,6 +154,7 @@ void writeStub()
free(Stub); free(Stub);
} }
//extern "C" { void __exception_closeall(); }
void BootHomebrew() void BootHomebrew()
{ {
if(!IsDollZ(EXECUTE_ADDR) && !IsSpecialELF(EXECUTE_ADDR)) if(!IsDollZ(EXECUTE_ADDR) && !IsSpecialELF(EXECUTE_ADDR))
@ -163,17 +162,18 @@ void BootHomebrew()
else else
gprintf("Homebrew Boot Arguments disabled\n"); gprintf("Homebrew Boot Arguments disabled\n");
u32 cpu_isr;
memcpy(BOOTER_ADDR, appbooter_ptr, appbooter_size); memcpy(BOOTER_ADDR, appbooter_ptr, appbooter_size);
DCFlushRange(BOOTER_ADDR, appbooter_size); DCFlushRange(BOOTER_ADDR, appbooter_size);
ICInvalidateRange(BOOTER_ADDR, appbooter_size); ICInvalidateRange(BOOTER_ADDR, appbooter_size);
free(appbooter_ptr); free(appbooter_ptr);
//JumpToEntry(BOOTER_ENTRY); JumpToEntry(BOOTER_ENTRY);
/*u32 cpu_isr;
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
_CPU_ISR_Disable( cpu_isr ); _CPU_ISR_Disable( cpu_isr );
__exception_closeall(); __exception_closeall();
BOOTER_ENTRY(); BOOTER_ENTRY();
_CPU_ISR_Restore( cpu_isr ); _CPU_ISR_Restore( cpu_isr );*/
} }
extern "C" { extern void __exception_closeall(); } extern "C" { extern void __exception_closeall(); }
@ -182,10 +182,11 @@ void JumpToEntry(entry EntryPoint)
{ {
AppEntrypoint = (u32)EntryPoint; AppEntrypoint = (u32)EntryPoint;
gprintf("Jumping to %08x\n", AppEntrypoint); gprintf("Jumping to %08x\n", AppEntrypoint);
u32 level = IRQ_Disable(); SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);// does __IOS_ShutdownSubsystems() and __lwp_thread_closeall() before IRQ_Disable()
__IOS_ShutdownSubsystems(); u32 level = IRQ_Disable();// does _CPU_ISR_Disable()
//__IOS_ShutdownSubsystems();
__exception_closeall(); __exception_closeall();
__lwp_thread_closeall(); //dont like it but whatever //__lwp_thread_closeall(); //dont like it but whatever
asm volatile ( asm volatile (
"lis %r3, AppEntrypoint@h\n" "lis %r3, AppEntrypoint@h\n"
"ori %r3, %r3, AppEntrypoint@l\n" "ori %r3, %r3, AppEntrypoint@l\n"

View File

@ -258,10 +258,6 @@ static void Create_Channel_List()
/* add plugin rom, song, or video to the list. */ /* add plugin rom, song, or video to the list. */
static void Add_Plugin_Game(char *FullPath) static void Add_Plugin_Game(char *FullPath)
{ {
/* Get roms's title without the extra ()'s or []'s */
string ShortName = m_plugin.GetRomName(FullPath);
//gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
/* only add disc 1 of multi disc games */ /* only add disc 1 of multi disc games */
const char *RomFilename = strrchr(FullPath, '/') + 1; const char *RomFilename = strrchr(FullPath, '/') + 1;
@ -271,6 +267,10 @@ static void Add_Plugin_Game(char *FullPath)
return; return;
} }
/* Get roms's title without the extra ()'s or []'s */
string ShortName = m_plugin.GetRomName(FullPath);
//gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
/* get rom's ID */ /* get rom's ID */
string romID = ""; string romID = "";
if(gameTDB.IsLoaded()) if(gameTDB.IsLoaded())

View File

@ -73,7 +73,7 @@ static u32 ios_60[16] ATTRIBUTE_ALIGN(32)=
0x20203750+1, // ios_printf (thumb) 0x20203750+1, // ios_printf (thumb)
}; };
static u32 patch_datas[8] ATTRIBUTE_ALIGN(32); u32 patch_datas[8] ATTRIBUTE_ALIGN(32);
static int my_thread_id = 0; static int my_thread_id = 0;
static data_elf my_data_elf; static data_elf my_data_elf;
@ -165,7 +165,7 @@ int load_ehc_module()
#define IOCTL_FAT_UMOUNTUSB 0xF3 #define IOCTL_FAT_UMOUNTUSB 0xF3
#define IOCTL_FFS_MODE 0x80 #define IOCTL_FFS_MODE 0x80
/*
void disable_ffs_patch(void) void disable_ffs_patch(void)
{ {
@ -231,14 +231,14 @@ s32 ret;
} }
usleep(350*1000); usleep(350*1000);
/* Create heap */ // Create heap
if (hid < 0) { if (hid < 0) {
hid = iosCreateHeap(0x100); hid = iosCreateHeap(0x100);
if (hid < 0) if (hid < 0)
return -1; return -1;
} }
/* Open USB device */ // Open USB device
fd = IOS_Open(fs, 0); fd = IOS_Open(fs, 0);
if (fd < 0) if (fd < 0)
@ -291,45 +291,30 @@ static char fs[] ATTRIBUTE_ALIGN(32) = "fat";
s32 hid = -1, fd = -1; s32 hid = -1, fd = -1;
s32 ret; s32 ret;
/* Create heap */ // Create heap
if (hid < 0) { if (hid < 0) {
hid = iosCreateHeap(0x100); hid = iosCreateHeap(0x100);
if (hid < 0) if (hid < 0)
return -1; return -1;
} }
/* Open USB device */ // Open USB device
fd = IOS_Open(fs, 0); fd = IOS_Open(fs, 0);
if (fd < 0) if (fd < 0)
{
if(hid>=0)
{ {
iosDestroyHeap(hid); iosDestroyHeap(hid);
hid = -1; hid = -1;
}
return -1; return -1;
} }
ret=IOS_IoctlvFormat(hid, fd, IOCTL_FFS_MODE, "i:", mode); ret=IOS_IoctlvFormat(hid, fd, IOCTL_FFS_MODE, "i:", mode);
if (fd >= 0) {
IOS_Close(fd); IOS_Close(fd);
fd = -1; fd = -1;
}
if(hid>=0)
{
iosDestroyHeap(hid); iosDestroyHeap(hid);
hid=-1; hid=-1;
}
return ret; return ret;
} }*/
void enable_ES_ioctlv_vector(void) void enable_ES_ioctlv_vector(void)
{ {
@ -344,7 +329,7 @@ void Set_DIP_BCA_Datas(u8 *bca_data)
mload_write(bca_data, 64); mload_write(bca_data, 64);
mload_close(); mload_close();
} }
/*
void test_and_patch_for_port1() void test_and_patch_for_port1()
{ {
// test for port 1 // test for port 1
@ -390,7 +375,7 @@ void free_usb_ports()
mload_getw((void *) (addr+0x48), &dat); mload_getw((void *) (addr+0x48), &dat);
if((dat & 0x2001)==1) mload_setw((void *) (addr+0x48), 0x2000); if((dat & 0x2001)==1) mload_setw((void *) (addr+0x48), 0x2000);
} }*/
#endif #endif

View File

@ -468,7 +468,6 @@ bool CMenu::init(bool usb_mounted)
/* set sound volumes */ /* set sound volumes */
CoverFlow.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255)); CoverFlow.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
m_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 255));
m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255); m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255);
m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true); m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true);
@ -938,6 +937,7 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
void CMenu::_buildMenus(void) void CMenu::_buildMenus(void)
{ {
m_btnMgr.init(); m_btnMgr.init();
m_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 255));
m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true)); m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true));
// Default fonts // Default fonts
theme.btnFont = _dfltFont(BUTTONFONT); theme.btnFont = _dfltFont(BUTTONFONT);

View File

@ -295,6 +295,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
ShutdownBeforeExit();// before launching homebrew or plugin dol ShutdownBeforeExit();// before launching homebrew or plugin dol
NandHandle.Patch_AHB(); NandHandle.Patch_AHB();
IOS_ReloadIOS(58); IOS_ReloadIOS(58);
WII_Initialize();
BootHomebrew(); BootHomebrew();
Sys_Exit(); Sys_Exit();
} }

View File

@ -559,14 +559,23 @@ int CMenu::_cacheCovers()
/* get cover png path */ /* get cover png path */
bool blankCover = false; bool blankCover = false;
bool fullCover = true; bool fullCover = true;
if(smallBox)// homebrew or sourceflow
{
fullCover = false;
strlcpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath));
if(!fsop_FileExist(coverPath))
continue;
}
else
{
strlcpy(coverPath, getBoxPath(&(*hdr)), sizeof(coverPath)); strlcpy(coverPath, getBoxPath(&(*hdr)), sizeof(coverPath));
//gprintf("boxpath=%s\n", coverPath); //gprintf("boxpath=%s\n", coverPath);
if(!fsop_FileExist(coverPath) || smallBox) if(!fsop_FileExist(coverPath))
{ {
fullCover = false; fullCover = false;
strlcpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath)); strlcpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath));
//gprintf("frontpath=%s\n", coverPath); //gprintf("frontpath=%s\n", coverPath);
if(!fsop_FileExist(coverPath) && !smallBox) if(!fsop_FileExist(coverPath))
{ {
fullCover = true; fullCover = true;
strlcpy(coverPath, getBlankCoverPath(&(*hdr)), sizeof(coverPath)); strlcpy(coverPath, getBlankCoverPath(&(*hdr)), sizeof(coverPath));
@ -576,6 +585,7 @@ int CMenu::_cacheCovers()
continue; continue;
} }
} }
}
/* get cache folder path */ /* get cache folder path */
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
@ -606,15 +616,15 @@ int CMenu::_cacheCovers()
/* if wfc doesn't exist or is flat and have full cover */ /* if wfc doesn't exist or is flat and have full cover */
if(!fsop_FileExist(wfcPath) || (!CoverFlow.fullCoverCached(wfcPath) && fullCover)) if(!fsop_FileExist(wfcPath) || (!CoverFlow.fullCoverCached(wfcPath) && fullCover))
{ {
/* create cache subfolders if needed */ // create cache subfolders if needed
if(!fsop_FolderExist(cachePath)) if(!fsop_FolderExist(cachePath))
fsop_MakeFolder(cachePath); fsop_MakeFolder(cachePath);
/* create cover texture */ // create cover texture
CoverFlow.cacheCoverFile(wfcPath, coverPath, fullCover); CoverFlow.cacheCoverFile(wfcPath, coverPath, fullCover);
} }
// cache wii and channel banners /* cache wii and channel banners */
if(hdr->type == TYPE_WII_GAME || hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL) if(hdr->type == TYPE_WII_GAME || hdr->type == TYPE_CHANNEL || hdr->type == TYPE_EMUCHANNEL)
{ {
CurrentBanner.ClearBanner(); CurrentBanner.ClearBanner();