mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-updated nintendont support
This commit is contained in:
parent
c5e1c014af
commit
dbb9266eaf
@ -150,15 +150,24 @@ void DML_New_WriteOptions()
|
||||
|
||||
// Nintendont
|
||||
NIN_CFG NinCfg;
|
||||
|
||||
void Nintendont_SetOptions(const char *game, u8 NMM, u8 videoSetting, bool widescreen)
|
||||
u8 NinDevice;
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, u8 NMM, u8 videoSetting, bool widescreen)
|
||||
{
|
||||
NinDevice = DeviceHandle.PathToDriveType(game);
|
||||
memset(&NinCfg, 0, sizeof(NIN_CFG));
|
||||
NinCfg.Magicbytes = 0x01070CF6;
|
||||
NinCfg.Version = 0x00000001;
|
||||
NinCfg.Config |= NIN_CFG_AUTO_BOOT;
|
||||
NinCfg.Config |= NIN_CFG_GAME_PATH; /* temporary */
|
||||
NinCfg.Version = NIN_CFG_VERSION;
|
||||
NinCfg.MaxPads = NIN_CFG_MAXPAD;
|
||||
|
||||
NinCfg.Config |= NIN_CFG_AUTO_BOOT;
|
||||
if(NinDevice != SD)
|
||||
NinCfg.Config |= NIN_CFG_USB;
|
||||
|
||||
if(IsOnWiiU() == true)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
NinCfg.Config |= NIN_CFG_HID;
|
||||
}
|
||||
if(videoSetting == 0)
|
||||
NinCfg.VideoMode |= NIN_VID_NONE;
|
||||
else if(videoSetting == 1)
|
||||
@ -171,19 +180,30 @@ void Nintendont_SetOptions(const char *game, u8 NMM, u8 videoSetting, bool wides
|
||||
if(NMM > 0)
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
|
||||
strncpy(NinCfg.GamePath, strchr(game, '/') + 1, 254);
|
||||
strncpy(NinCfg.GamePath, strchr(game, '/'), 254);
|
||||
if(strstr(NinCfg.GamePath, "boot.bin") != NULL)
|
||||
{
|
||||
*strrchr(NinCfg.GamePath, '/') = '\0'; //boot.bin
|
||||
*(strrchr(NinCfg.GamePath, '/')+1) = '\0'; //sys
|
||||
}
|
||||
gprintf("Nintendont Game Path: %s\n", NinCfg.GamePath);
|
||||
memcpy(&NinCfg.GameID, gameID, 4);
|
||||
gprintf("Nintendont Game Path: %s, ID: %08x\n", NinCfg.GamePath, NinCfg.GameID);
|
||||
}
|
||||
|
||||
void Nintendont_WriteOptions()
|
||||
{
|
||||
gprintf("Writing Nintendont CFG: %s\n", NIN_CFG_PATH);
|
||||
fsop_WriteFile(NIN_CFG_PATH, &NinCfg, sizeof(NIN_CFG));
|
||||
/* general loader */
|
||||
if(DeviceHandle.SD_Inserted())
|
||||
{
|
||||
gprintf("Writing Nintendont CFG: sd:/%s\n", NIN_CFG_PATH);
|
||||
fsop_WriteFile(fmt("sd:/%s", NIN_CFG_PATH), &NinCfg, sizeof(NIN_CFG));
|
||||
}
|
||||
/* for kernel */
|
||||
if(NinDevice != SD)
|
||||
{
|
||||
gprintf("Writing Nintendont USB Kernel CFG: %s:/%s\n", DeviceName[NinDevice], NIN_CFG_PATH);
|
||||
fsop_WriteFile(fmt("%s:/%s", DeviceName[NinDevice], NIN_CFG_PATH), &NinCfg, sizeof(NIN_CFG));
|
||||
}
|
||||
}
|
||||
|
||||
bool Nintendont_GetLoader()
|
||||
@ -503,7 +523,7 @@ u8 get_wii_language()
|
||||
}
|
||||
}
|
||||
|
||||
void GC_SetLanguage(u8 lang)
|
||||
void GC_SetLanguage(u8 lang, u8 loader)
|
||||
{
|
||||
if (lang == 0)
|
||||
lang = get_wii_language();
|
||||
@ -513,7 +533,32 @@ void GC_SetLanguage(u8 lang)
|
||||
syssram *sram;
|
||||
sram = __SYS_LockSram();
|
||||
sram->lang = lang;
|
||||
|
||||
__SYS_UnlockSram(1); // 1 -> write changes
|
||||
while(!__SYS_SyncSram());
|
||||
|
||||
/* write language for nintendont */
|
||||
if(loader == 2)
|
||||
{
|
||||
switch(lang)
|
||||
{
|
||||
case SRAM_GERMAN:
|
||||
NinCfg.Language = NIN_LAN_GERMAN;
|
||||
break;
|
||||
case SRAM_FRENCH:
|
||||
NinCfg.Language = NIN_LAN_FRENCH;
|
||||
break;
|
||||
case SRAM_SPANISH:
|
||||
NinCfg.Language = NIN_LAN_SPANISH;
|
||||
break;
|
||||
case SRAM_ITALIAN:
|
||||
NinCfg.Language = NIN_LAN_ITALIAN;
|
||||
break;
|
||||
case SRAM_DUTCH:
|
||||
NinCfg.Language = NIN_LAN_DUTCH;
|
||||
break;
|
||||
default:
|
||||
NinCfg.Language = NIN_LAN_ENGLISH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,11 +75,11 @@ void DML_New_WriteOptions();
|
||||
|
||||
// Nintendont
|
||||
#include "nin_cfg.h"
|
||||
#define NIN_CFG_PATH "sd:/nincfg.bin"
|
||||
#define NIN_CFG_PATH "nincfg.bin"
|
||||
#define NIN_LOADER_PATH "%s:/apps/Nintendont/boot.dol"
|
||||
|
||||
bool Nintendont_GetLoader();
|
||||
void Nintendont_SetOptions(const char *game, u8 NMM, u8 videoSetting, bool widescreen);
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, u8 NMM, u8 videoSetting, bool widescreen);
|
||||
void Nintendont_WriteOptions();
|
||||
|
||||
// Devolution
|
||||
@ -114,6 +114,6 @@ void DEVO_Boot();
|
||||
|
||||
// General
|
||||
void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader);
|
||||
void GC_SetLanguage(u8 lang);
|
||||
void GC_SetLanguage(u8 lang, u8 loader);
|
||||
|
||||
#endif //_GC_HPP_
|
||||
|
@ -1,27 +1,37 @@
|
||||
typedef struct NIN_CFG
|
||||
|
||||
#ifndef __COMMON_CONFIG_H__
|
||||
#define __COMMON_CONFIG_H__
|
||||
|
||||
#define NIN_CFG_VERSION 0x00000002
|
||||
|
||||
#define NIN_CFG_MAXPAD 4
|
||||
|
||||
typedef struct NIN_CFG
|
||||
{
|
||||
u32 Magicbytes; // 0x01070CF6
|
||||
u32 Version; // 0x00000001
|
||||
u32 Config;
|
||||
u32 VideoMode;
|
||||
u32 Language; // NYI
|
||||
unsigned int Magicbytes; // 0x01070CF6
|
||||
unsigned int Version; // 0x00000001
|
||||
unsigned int Config;
|
||||
unsigned int VideoMode;
|
||||
unsigned int Language;
|
||||
char GamePath[255];
|
||||
char CheatPath[255];
|
||||
unsigned int MaxPads;
|
||||
unsigned int GameID;
|
||||
} NIN_CFG;
|
||||
|
||||
enum ninconfig
|
||||
{
|
||||
NIN_CFG_CHEATS = (1<<0), // NYI
|
||||
NIN_CFG_DEBUGGER = (1<<1), // NYI
|
||||
NIN_CFG_DEBUGWAIT = (1<<2), // NYI
|
||||
NIN_CFG_CHEATS = (1<<0),
|
||||
NIN_CFG_DEBUGGER = (1<<1), // Only for Wii Version
|
||||
NIN_CFG_DEBUGWAIT = (1<<2), // Only for Wii Version
|
||||
NIN_CFG_MEMCARDEMU = (1<<3),
|
||||
NIN_CFG_GAME_PATH = (1<<4),
|
||||
NIN_CFG_CHEAT_PATH = (1<<5),
|
||||
NIN_CFG_FORCE_WIDE = (1<<6),
|
||||
NIN_CFG_FORCE_PROG = (1<<7),
|
||||
NIN_CFG_AUTO_BOOT = (1<<8),
|
||||
NIN_CFG_HID = (1<<9),
|
||||
NIN_CFG_OSREPORT = (1<<10), // Only for Wii
|
||||
NIN_CFG_CHEAT_PATH = (1<<4),
|
||||
NIN_CFG_FORCE_WIDE = (1<<5),
|
||||
NIN_CFG_FORCE_PROG = (1<<6),
|
||||
NIN_CFG_AUTO_BOOT = (1<<7),
|
||||
NIN_CFG_HID = (1<<8),
|
||||
NIN_CFG_OSREPORT = (1<<9),
|
||||
NIN_CFG_USB = (1<<10),
|
||||
};
|
||||
|
||||
enum ninvideomode
|
||||
@ -38,4 +48,34 @@ enum ninvideomode
|
||||
NIN_VID_FORCE_MPAL = (1<<3),
|
||||
|
||||
NIN_VID_FORCE_MASK = NIN_VID_FORCE_PAL50|NIN_VID_FORCE_PAL60|NIN_VID_FORCE_NTSC|NIN_VID_FORCE_MPAL,
|
||||
|
||||
NIN_VID_PROG = (1<<4), //important to prevent blackscreens
|
||||
};
|
||||
|
||||
enum ninlanguage
|
||||
{
|
||||
NIN_LAN_ENGLISH = 0,
|
||||
NIN_LAN_GERMAN = 1,
|
||||
NIN_LAN_FRENCH = 2,
|
||||
NIN_LAN_SPANISH = 3,
|
||||
NIN_LAN_ITALIAN = 4,
|
||||
NIN_LAN_DUTCH = 5,
|
||||
|
||||
/* Auto will use English for E/P region codes and
|
||||
only other languages when these region codes are used: D/F/S/I/J */
|
||||
|
||||
NIN_LAN_AUTO = -1,
|
||||
};
|
||||
|
||||
enum VideoModes
|
||||
{
|
||||
GCVideoModeNone = 0,
|
||||
GCVideoModePAL60 = 1,
|
||||
GCVideoModeNTSC = 2,
|
||||
GCVideoModePROG = 3,
|
||||
};
|
||||
|
||||
#define NIN_RAW_MEMCARD_SIZE 2*1024*1024 //2MB
|
||||
#define NIN_MEMCARD_BLOCKS 0x00000010 //251 Blocks
|
||||
|
||||
#endif
|
||||
|
@ -897,7 +897,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
|
||||
u8 GClanguage = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
|
||||
GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1;
|
||||
|
||||
if(id[3] == 'E' || id[3] == 'J')
|
||||
GClanguage = 1; //=english
|
||||
u8 videoMode = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||
videoMode = (videoMode == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1u) : videoMode-1;
|
||||
if(disc || videoMode == 0)
|
||||
@ -1029,7 +1030,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
else if(loader == 1)
|
||||
DEVO_GetLoader(m_dataDir.c_str());
|
||||
else if(loader == 2)
|
||||
Nintendont_SetOptions(path, NMM, videoSetting, widescreen);
|
||||
Nintendont_SetOptions(path, id, NMM, videoSetting, widescreen);
|
||||
|
||||
m_gcfg1.save(true);
|
||||
m_gcfg2.save(true);
|
||||
@ -1038,7 +1039,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
cleanup();
|
||||
|
||||
GC_SetVideoMode(videoMode, (disc ? 1 : videoSetting), loader);
|
||||
GC_SetLanguage(GClanguage);
|
||||
GC_SetLanguage(GClanguage, loader);
|
||||
/* NTSC-J Patch by FIX94 */
|
||||
if(id[3] == 'J')
|
||||
*HW_PPCSPEED = 0x0002A9E0;
|
||||
|
Loading…
Reference in New Issue
Block a user