Add deflicker filter options

This commit is contained in:
wiidev 2021-08-01 18:00:21 +01:00
parent 6d240872bb
commit 08a44a2b57
34 changed files with 711 additions and 66 deletions

View File

@ -585,6 +585,9 @@ msgstr "Puvodní nastavení her"
msgid "Default Settings"
msgstr "Puvodní nastavení"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Smazat"
@ -1644,15 +1647,30 @@ msgstr "List"
msgid "OFF"
msgstr "Vypnuto"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Zapnuto"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Standard spil-indstillinger"
msgid "Default Settings"
msgstr "Standardindstillinger"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Slet"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "Fra"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Til"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Standaard spel instellingen"
msgid "Default Settings"
msgstr "Standaardinstellingen"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Verwijderen"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "Uit"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Aan"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr ""
msgid "Default Settings"
msgstr ""
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr ""
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr ""
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr ""
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Oletus peliasetukset"
msgid "Default Settings"
msgstr "Oletusasetukset"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Tuhoa"
@ -1644,15 +1647,30 @@ msgstr "marras"
msgid "OFF"
msgstr "Pois"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Päälle"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Réinitialiser les paramètres du jeu"
msgid "Default Settings"
msgstr "Réinitialiser les paramètres"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Supprimer"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "Inactif"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Actif"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr "Actif (Multi)"
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Spieleinstellungen zurücksetzen"
msgid "Default Settings"
msgstr "Einstellungen zurücksetzen"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Löschen"
@ -1644,15 +1647,30 @@ msgstr "November"
msgid "OFF"
msgstr "AUS"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "OK"
msgid "ON"
msgstr "AN"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Βασικές ρυθμίσεις παιχνιδιών"
msgid "Default Settings"
msgstr "Βασικές ρυθμίσεις"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Διαγραφή"
@ -1644,15 +1647,30 @@ msgstr "Noέμβριος"
msgid "OFF"
msgstr "OXI"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "NAI"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Alapértelmezett beállítások"
msgid "Default Settings"
msgstr "Alapértelmezett beállítások"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Törlés"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "KI"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "BE"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Impostazioni di gioco predefinite"
msgid "Default Settings"
msgstr "Impostazioni predefinite"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Elimina"
@ -1644,15 +1647,30 @@ msgstr "Novembre"
msgid "OFF"
msgstr "OFF"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "OK"
msgid "ON"
msgstr "ON"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "設定を初期化"
msgid "Default Settings"
msgstr "設定を初期化"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "削除しますか"
@ -1644,15 +1647,30 @@ msgstr "11月"
msgid "OFF"
msgstr "使わない"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "使う"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "기본 게임설정"
msgid "Default Settings"
msgstr "기본 설정"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "삭제"
@ -1644,15 +1647,30 @@ msgstr "11 월"
msgid "OFF"
msgstr "꺼짐"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "확인"
msgid "ON"
msgstr "켜짐"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr "켜짐 (멀티)"
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr "OS보고서"

View File

@ -585,6 +585,9 @@ msgstr "Standard innstillinger"
msgid "Default Settings"
msgstr "Standard innstillinger"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Slett"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "AV"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "PÅ"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Domyslne ustawienia gier"
msgid "Default Settings"
msgstr "Domyslne ustawienia"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Usun"
@ -1644,15 +1647,30 @@ msgstr "Listopad"
msgid "OFF"
msgstr "Wylacz"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "Wlacz"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Opções Padrão"
msgid "Default Settings"
msgstr "Configurações Padrão"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Eliminar"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "NÃO"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "SIM"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Definições Jogo Predefinidas"
msgid "Default Settings"
msgstr "Definições Predefinidas"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Eliminar"
@ -1644,15 +1647,30 @@ msgstr "Nov"
msgid "OFF"
msgstr "OFF"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "OK"
msgid "ON"
msgstr "ON"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Установки игры по умолчанию"
msgid "Default Settings"
msgstr "Установки по умолчанию"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Удалить"
@ -1644,15 +1647,30 @@ msgstr "Ноя"
msgid "OFF"
msgstr "ВЫКЛ"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "OK"
msgid "ON"
msgstr "ВКЛ"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "缺省游戏设定"
msgid "Default Settings"
msgstr "缺省设置"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "删除"
@ -1644,15 +1647,30 @@ msgstr "十一月"
msgid "OFF"
msgstr "关闭"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "确定"
msgid "ON"
msgstr "开启"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Restaurar configuración"
msgid "Default Settings"
msgstr "Restaurar configuración"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Borrar"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "Desactivado"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "Aceptar"
msgid "ON"
msgstr "Activado"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr "1 global"
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Ställ till spelstandard"
msgid "Default Settings"
msgstr "Standardinställningar"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Radera"
@ -1644,15 +1647,30 @@ msgstr ""
msgid "OFF"
msgstr "AV"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "PÅ"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "初始化遊戲設定"
msgid "Default Settings"
msgstr "初始化設定"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "刪除"
@ -1644,15 +1647,30 @@ msgstr "十一月"
msgid "OFF"
msgstr "關閉"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "確定"
msgid "ON"
msgstr "開啟"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "ค่าแรกกำหนด"
msgid "Default Settings"
msgstr "ค่าแรกกำหนด"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "ลบ"
@ -1644,15 +1647,30 @@ msgstr "พย."
msgid "OFF"
msgstr "ปิด"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr "ตกลง"
msgid "ON"
msgstr "เปิด"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -585,6 +585,9 @@ msgstr "Varsayılan Oyun ayarları"
msgid "Default Settings"
msgstr "Varsayılan Ayarlar"
msgid "Deflicker Filter"
msgstr ""
msgid "Delete"
msgstr "Sil"
@ -1644,15 +1647,30 @@ msgstr "Kas"
msgid "OFF"
msgstr "KAPALI"
msgid "OFF (Extended)"
msgstr ""
msgid "OFF (Safe)"
msgstr ""
msgid "OK"
msgstr ""
msgid "ON"
msgstr "AÇIK"
msgid "ON (Low)"
msgstr ""
msgid "ON (Medium)"
msgstr ""
msgid "ON (Multi)"
msgstr ""
msgid "ON (High)"
msgstr ""
msgid "OSReport"
msgstr ""

View File

@ -161,8 +161,6 @@ std::vector<struct discHdr> &Channels::GetEmuHeaders(void)
u8 *Channels::GetDol(const u64 &title, u8 *tmdBuffer)
{
static const u8 dolsign[6] = {0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
static u8 dolhead[32] ATTRIBUTE_ALIGN(32);
u8 *buffer = NULL;
u32 filesize = 0;
u32 bootcontent = 0xDEADBEAF;
@ -179,22 +177,8 @@ u8 *Channels::GetDol(const u64 &title, u8 *tmdBuffer)
{
for (u32 i = 0; i < tmd_file->num_contents; ++i)
{
if (tmd_file->contents[i].index == tmd_file->boot_index)
continue; // Skip loader
snprintf(filepath, ISFS_MAXPATH, "/title/%08x/%08x/content/%08x.app", (unsigned int)high, (unsigned int)low, (unsigned int)tmd_file->contents[i].cid);
s32 fd = ISFS_Open(filepath, ISFS_OPEN_READ);
if (fd < 0)
continue;
s32 ret = ISFS_Read(fd, dolhead, 32);
ISFS_Close(fd);
if (ret != 32)
continue;
if (memcmp(dolhead, dolsign, sizeof(dolsign)) == 0)
// It won't match a dol signature
if (tmd_file->contents[i].index == 1)
{
bootcontent = tmd_file->contents[i].cid;
break;

View File

@ -58,9 +58,13 @@ void ClearDOLList()
}
void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer, const char *serverAddr)
u8 vipatch, u8 deflicker, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer, const char *serverAddr)
{
int i;
u8 vfilter_off[7] = {0, 0, 21, 22, 21, 0, 0};
u8 vfilter_low[7] = {4, 4, 16, 16, 16, 4, 4};
u8 vfilter_medium[7] = {4, 8, 12, 16, 12, 8, 4};
u8 vfilter_high[7] = {8, 8, 10, 12, 10, 8, 8};
// If a wip file is loaded for this game this does nothing - Dimok
PoPPatch();
@ -90,7 +94,31 @@ void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 language
do_wip_code(dst, len);
Anti_002_fix(dst, len);
anti_002_fix(dst, len);
if (deflicker == DEFLICKER_ON_LOW)
{
patch_vfilters(dst, len, vfilter_low);
patch_vfilters_rouge(dst, len, vfilter_low);
}
else if (deflicker == DEFLICKER_ON_MEDIUM)
{
patch_vfilters(dst, len, vfilter_medium);
patch_vfilters_rouge(dst, len, vfilter_medium);
}
else if (deflicker == DEFLICKER_ON_HIGH)
{
patch_vfilters(dst, len, vfilter_high);
patch_vfilters_rouge(dst, len, vfilter_high);
}
else if (deflicker != DEFLICKER_AUTO)
{
patch_vfilters(dst, len, vfilter_off);
patch_vfilters_rouge(dst, len, vfilter_off);
// This might break fade and brightness effects
if (deflicker == DEFLICKER_OFF_EXTENDED)
deflicker_patch(dst, len);
}
if (returnTo)
PatchReturnTo(dst, len, (u32)returnTo);
@ -122,11 +150,44 @@ void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 language
}
/** Anti 002 fix for IOS 249 rev > 12 thanks to WiiPower **/
bool Anti_002_fix(u8 *Address, int Size)
void anti_002_fix(u8 *addr, u32 len)
{
u8 SearchPattern[12] = {0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00};
u8 PatchData[12] = {0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00};
return PatchDOL(Address, Size, (const u8 *)SearchPattern, sizeof(SearchPattern), (const u8 *)PatchData, sizeof(PatchData));
u32 SearchPattern[3] = {0x2C000000, 0x48000214, 0x3C608000};
u8 *addr_start = addr;
u8 *addr_end = addr + len;
while (addr_start <= addr_end - sizeof(SearchPattern))
{
if (memcmp(addr_start, SearchPattern, sizeof(SearchPattern)) == 0)
{
*((u32 *)addr_start + 1) = 0x40820214;
return;
}
addr_start += 4;
}
}
/** Patch GXSetCopyFilter to disable the deflicker filter **/
void deflicker_patch(u8 *addr, u32 len)
{
u32 SearchPattern[18] = {
0x3D20CC01, 0x39400061, 0x99498000,
0x2C050000, 0x38800053, 0x39600000,
0x90098000, 0x38000054, 0x39800000,
0x508BC00E, 0x99498000, 0x500CC00E,
0x90698000, 0x99498000, 0x90E98000,
0x99498000, 0x91098000, 0x41820040};
u8 *addr_start = addr;
u8 *addr_end = addr + len;
while (addr_start <= addr_end - sizeof(SearchPattern))
{
if (memcmp(addr_start, SearchPattern, sizeof(SearchPattern)) == 0)
{
*((u32 *)addr_start + 17) = 0x48000040; // Change beq to b
gprintf("Patched GXSetCopyFilter @ %p\n", addr_start);
return;
}
addr_start += 4;
}
}
/**
@ -1002,6 +1063,39 @@ static GXRModeObj TVPal524ProgAa_RVL = {
}
};
static GXRModeObj TVPal528IntDf_RVL = {
4, // viDisplayMode
640, // fbWidth
528, // efbHeight
528, // xfbHeight
40, // viXOrigin (720 - 640)/2
23, // viYOrigin (574 - 528)/2
640, // viWidth
528, // viHeight
VI_XFBMODE_DF, // xFBmode
GX_FALSE, // field_rendering
GX_FALSE, // aa
// sample points arranged in increasing Y order
{
{6, 6}, {6, 6}, {6, 6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6, 6}, {6, 6}, {6, 6}, // pix 1
{6, 6}, {6, 6}, {6, 6}, // pix 2
{6, 6}, {6, 6}, {6, 6} // pix 3
},
// vertical filter[7], 1/64 units, 6 bits each
{
8, // line n-1
8, // line n-1
10, // line n
12, // line n
10, // line n
8, // line n+1
8 // line n+1
}
};
static GXRModeObj *vmodes[] = {
&TVNtsc240Ds,
&TVNtsc240DsAa,
@ -1021,7 +1115,7 @@ static GXRModeObj *vmodes[] = {
&TVPal524ProgAa_RVL,
&TVPal524IntAa,
&TVPal528Int,
&TVPal528IntDf,
&TVPal528IntDf_RVL,
&TVPal528Prog_RVL,
&TVPal528ProgSoft_RVL,
&TVPal576IntDfScale,
@ -1055,7 +1149,7 @@ static const char *vmodes_name[] = {
"TVPal524ProgAa_RVL",
"TVPal524IntAa",
"TVPal528Int",
"TVPal528IntDf",
"TVPal528IntDf_RVL",
"TVPal528Prog_RVL",
"TVPal528ProgSoft_RVL",
"TVPal576IntDfScale",
@ -1078,7 +1172,7 @@ static GXRModeObj *PAL2NTSC[] = {
&TVPal264IntAa, &TVNtsc240IntAa,
&TVPal524IntAa, &TVNtsc480IntAa,
&TVPal528Int, &TVNtsc480Int,
&TVPal528IntDf, &TVNtsc480IntDf,
&TVPal528IntDf_RVL, &TVNtsc480IntDf,
&TVPal528Prog_RVL, &TVNtsc480Prog,
&TVPal576IntDfScale, &TVNtsc480IntDf,
&TVEurgb60Hz240Ds, &TVNtsc240Ds,
@ -1099,7 +1193,7 @@ static GXRModeObj *NTSC2PAL[] = {
&TVNtsc240Int, &TVPal264Int,
&TVNtsc240IntAa, &TVPal264IntAa,
&TVNtsc480Int, &TVPal528Int,
&TVNtsc480IntDf, &TVPal528IntDf,
&TVNtsc480IntDf, &TVPal528IntDf_RVL,
&TVNtsc480IntAa, &TVPal524IntAa,
&TVNtsc480Prog, &TVPal528Prog_RVL,
0, 0};
@ -1115,6 +1209,20 @@ static GXRModeObj *NTSC2PAL60[] = {
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
0, 0};
static u8 PATTERN[12][2] = {
{6, 6}, {6, 6}, {6, 6},
{6, 6}, {6, 6}, {6, 6},
{6, 6}, {6, 6}, {6, 6},
{6, 6}, {6, 6}, {6, 6}
};
static u8 PATTERN_AA[12][2] = {
{3, 2}, {9, 6}, {3, 10},
{3, 2}, {9, 6}, {3, 10},
{9, 2}, {3, 6}, {9, 10},
{9, 2}, {3, 6}, {9, 10}
};
static bool compare_videomodes(GXRModeObj *mode1, GXRModeObj *mode2)
{
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight
@ -1152,6 +1260,8 @@ static bool compare_videomodes(GXRModeObj *mode1, GXRModeObj *mode2)
static void patch_videomode(GXRModeObj *mode1, GXRModeObj *mode2)
{
mode1->viTVMode = mode2->viTVMode;
if (mode1->viWidth == 640 || mode1->viWidth == 708)
{
mode1->fbWidth = mode2->fbWidth;
mode1->efbHeight = mode2->efbHeight;
mode1->xfbHeight = mode2->xfbHeight;
@ -1159,6 +1269,9 @@ static void patch_videomode(GXRModeObj *mode1, GXRModeObj *mode2)
mode1->viYOrigin = mode2->viYOrigin;
mode1->viWidth = mode2->viWidth;
mode1->viHeight = mode2->viHeight;
} else {
gprintf("Skipped patching dimensions %d x %d\n", mode1->viWidth, mode1->viHeight);
}
mode1->xfbMode = mode2->xfbMode;
mode1->field_rendering = mode2->field_rendering;
mode1->aa = mode2->aa;
@ -1242,6 +1355,61 @@ static bool Search_and_patch_Video_Modes(u8 *Address, u32 Size, GXRModeObj *Tabl
return found;
}
// Patch known and unknown vfilters within GXRModeObj structures
void patch_vfilters(u8 *addr, u32 len, u8 *vfilter)
{
while (len >= sizeof(GXRModeObj))
{
GXRModeObj *vidmode = (GXRModeObj *)addr;
if ((memcmp(vidmode->sample_pattern, PATTERN, 24) == 0 || memcmp(vidmode->sample_pattern, PATTERN_AA, 24) == 0) &&
(vidmode->fbWidth == 640 || vidmode->fbWidth == 608 || vidmode->fbWidth == 512) &&
(vidmode->field_rendering == 0 || vidmode->field_rendering == 1) &&
(vidmode->aa == 0 || vidmode->aa == 1))
{
gprintf("Replaced vfilter %02x%02x%02x%02x%02x%02x%02x @ %p (GXRModeObj)\n",
vidmode->vfilter[0], vidmode->vfilter[1], vidmode->vfilter[2], vidmode->vfilter[3],
vidmode->vfilter[4], vidmode->vfilter[5], vidmode->vfilter[6], addr);
memcpy(vidmode->vfilter, vfilter, 7);
addr += (sizeof(GXRModeObj) - 4);
len -= (sizeof(GXRModeObj) - 4);
}
addr += 4;
len -= 4;
}
}
void patch_vfilters_rouge(u8 *addr, u32 len, u8 *vfilter)
{
u8 known_vfilters[7][7] = {
{8, 8, 10, 12, 10, 8, 8},
{4, 8, 12, 16, 12, 8, 4},
{7, 7, 12, 12, 12, 7, 7},
{5, 5, 15, 14, 15, 5, 5},
{4, 4, 15, 18, 15, 4, 4},
{4, 4, 16, 16, 16, 4, 4},
{2, 2, 17, 22, 17, 2, 2}
};
u8 *addr_end = addr + len - 8;
while (addr <= addr_end)
{
u8 known_vfilter[7];
for (int i = 0; i < 7; i++)
{
for (int x = 0; x < 7; x++)
known_vfilter[x] = known_vfilters[i][x];
if (!addr[7] && memcmp(addr, known_vfilter, 7) == 0)
{
gprintf("Replaced vfilter %02x%02x%02x%02x%02x%02x%02x @ %p\n", addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5], addr[6], addr);
memcpy(addr, vfilter, 7);
addr += 7;
break;
}
}
addr += 1;
}
}
static bool Search_and_patch_Video_To(void *Address, u32 Size, GXRModeObj *Table[], GXRModeObj *rmode, bool patchAll)
{
u8 *Addr = (u8 *)Address;
@ -1259,22 +1427,24 @@ static bool Search_and_patch_Video_To(void *Address, u32 Size, GXRModeObj *Table
while (Size >= sizeof(GXRModeObj))
{
// Video mode pattern found
if ((((GXRModeObj *)Addr)->fbWidth == 0x0280 && ((GXRModeObj *)Addr)->viWidth == 0x02c4) || // TVEurgb60Hz480Prog
(((GXRModeObj *)Addr)->fbWidth == 0x0280 && ((GXRModeObj *)Addr)->viWidth == 0x0280)) // All other video modes
if ((memcmp(((GXRModeObj *)Addr)->sample_pattern, PATTERN, 24) == 0 || memcmp(((GXRModeObj *)Addr)->sample_pattern, PATTERN_AA, 24) == 0) &&
(((GXRModeObj *)Addr)->fbWidth == 640 || ((GXRModeObj *)Addr)->fbWidth == 608 || ((GXRModeObj *)Addr)->fbWidth == 512) &&
(((GXRModeObj *)Addr)->field_rendering == 0 || ((GXRModeObj *)Addr)->field_rendering == 1) &&
(((GXRModeObj *)Addr)->aa == 0 || ((GXRModeObj *)Addr)->aa == 1)
)
{
// display found video mode patterns
GXRModeObj *vidmode = (GXRModeObj *)Addr;
gprintf("Video pattern found \t%08x %04x %04x %04x %04x %04x %04x %04x %08x %04x %04x ",
gprintf("GXRModeObj \t%08x %04x %04x %04x %04x %04x %04x %04x %08x %04x %04x "
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x "
"%02x%02x%02x%02x%02x%02x%02x \n",
vidmode->viTVMode, vidmode->fbWidth, vidmode->efbHeight, vidmode->xfbHeight, vidmode->viXOrigin, vidmode->viYOrigin,
vidmode->viWidth, vidmode->viHeight, vidmode->xfbMode, vidmode->field_rendering, vidmode->aa);
gprintf("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x ",
vidmode->viWidth, vidmode->viHeight, vidmode->xfbMode, vidmode->field_rendering, vidmode->aa,
vidmode->sample_pattern[0][0], vidmode->sample_pattern[1][0], vidmode->sample_pattern[2][0], vidmode->sample_pattern[3][0], vidmode->sample_pattern[4][0],
vidmode->sample_pattern[5][0], vidmode->sample_pattern[6][0], vidmode->sample_pattern[7][0], vidmode->sample_pattern[8][0], vidmode->sample_pattern[9][0],
vidmode->sample_pattern[10][0], vidmode->sample_pattern[11][0], vidmode->sample_pattern[0][1], vidmode->sample_pattern[1][1], vidmode->sample_pattern[2][1],
vidmode->sample_pattern[3][1], vidmode->sample_pattern[4][1], vidmode->sample_pattern[5][1], vidmode->sample_pattern[6][1], vidmode->sample_pattern[7][1],
vidmode->sample_pattern[8][1], vidmode->sample_pattern[9][1], vidmode->sample_pattern[10][1], vidmode->sample_pattern[11][1]);
gprintf("%02x%02x%02x%02x%02x%02x%02x \n",
vidmode->sample_pattern[8][1], vidmode->sample_pattern[9][1], vidmode->sample_pattern[10][1], vidmode->sample_pattern[11][1],
vidmode->vfilter[0], vidmode->vfilter[1], vidmode->vfilter[2], vidmode->vfilter[3], vidmode->vfilter[4], vidmode->vfilter[5], vidmode->vfilter[6]);
found = 0;
@ -1399,7 +1569,7 @@ bool PatchReturnTo(void *Address, int Size, u32 id)
while (Addr <= Addr_end - 12)
{
// find a safe place or the patch to hang out
// find a safe place for the patch to hang out
if (!ad[3] && memcmp(Addr, SearchPattern2, 12) == 0)
{
ad[3] = (u32)Addr + 0x30;

View File

@ -10,8 +10,11 @@ extern "C" {
void RegisterDOL(u8 *dst, int len);
void ClearDOLList();
void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 languageChoice, u8 patchcountrystring,
u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer, const char *serverAddr);
bool Anti_002_fix(u8 *Address, int Size);
u8 vipatch, u8 deflicker, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer, const char *serverAddr);
void anti_002_fix(u8 *addr, u32 len);
void deflicker_patch(u8 *addr, u32 len);
void patch_vfilters(u8 *addr, u32 len, u8 *vfilter);
void patch_vfilters_rouge(u8 *addr, u32 len, u8 *vfilter);
void PrivateServerPatcher(void *addr, u32 len, u8 privateServer, const char *serverAddr);
void PatchFix480p();
s8 do_new_wiimmfi();

View File

@ -189,6 +189,7 @@ bool CGameSettings::Save()
fprintf(f, "video:%d; ", GameList[i].video);
fprintf(f, "videoPatchDol:%d; ", GameList[i].videoPatchDol);
fprintf(f, "patchFix480p:%d; ", GameList[i].patchFix480p);
fprintf(f, "deflicker:%d; ", GameList[i].deflicker);
fprintf(f, "aspectratio:%d; ", GameList[i].aspectratio);
fprintf(f, "language:%d; ", GameList[i].language);
fprintf(f, "ocarina:%d; ", GameList[i].ocarina);
@ -272,6 +273,11 @@ bool CGameSettings::SetSetting(GameCFG & game, const char *name, const char *val
game.patchFix480p = atoi(value);
return true;
}
else if (strcmp(name, "deflicker") == 0)
{
game.deflicker = atoi(value);
return true;
}
else if(strcmp(name, "aspectratio") == 0)
{
game.aspectratio = atoi(value);
@ -672,6 +678,7 @@ void CGameSettings::SetDefault(GameCFG &game)
game.video = INHERIT;
game.videoPatchDol = INHERIT;
game.patchFix480p = INHERIT;
game.deflicker = INHERIT;
game.aspectratio = INHERIT;
game.language = INHERIT;
game.ocarina = INHERIT;

View File

@ -13,6 +13,7 @@ typedef struct _GameCFG
short video;
short videoPatchDol;
short patchFix480p;
short deflicker;
short aspectratio;
short language;
short ocarina;
@ -78,6 +79,7 @@ typedef struct _GameCFG
memcpy(this->id, game.id, sizeof(game.id));
this->video = game.video;
this->videoPatchDol = game.videoPatchDol;
this->deflicker = game.deflicker;
this->patchFix480p = game.patchFix480p;
this->aspectratio = game.aspectratio;
this->language = game.language;

View File

@ -108,6 +108,7 @@ void CSettings::SetDefault()
videopatch = OFF;
videoPatchDol = OFF;
patchFix480p = ON;
deflicker = DEFLICKER_AUTO;
language = CONSOLE_DEFAULT;
ocarina = OFF;
hddinfo = CLOCK_HR12;
@ -322,6 +323,7 @@ bool CSettings::Save()
fprintf(file, "videopatch = %d\n", videopatch);
fprintf(file, "videoPatchDol = %d\n", videoPatchDol);
fprintf(file, "patchFix480p = %d\n", patchFix480p);
fprintf(file, "deflicker = %d\n", deflicker);
fprintf(file, "language = %d\n", language);
fprintf(file, "ocarina = %d\n", ocarina);
fprintf(file, "hddinfo = %d\n", hddinfo);
@ -572,6 +574,11 @@ bool CSettings::SetSetting(char *name, char *value)
patchFix480p = atoi(value);
return true;
}
else if (strcmp(name, "deflicker") == 0)
{
deflicker = atoi(value);
return true;
}
else if (strcmp(name, "language") == 0)
{
language = atoi(value);

View File

@ -111,6 +111,7 @@ class CSettings
short videopatch;
short videoPatchDol;
short patchFix480p;
short deflicker;
short sinfo;
short hddinfo;
short rumble;

View File

@ -112,6 +112,17 @@ enum
MAX_ON_OFF
};
enum
{
DEFLICKER_AUTO,
DEFLICKER_OFF,
DEFLICKER_OFF_EXTENDED,
DEFLICKER_ON_LOW,
DEFLICKER_ON_MEDIUM,
DEFLICKER_ON_HIGH,
DEFLICKER_MAX
};
enum
{
CLOCK_HR12 = 1, // use OFF for clock off

View File

@ -51,7 +51,7 @@ static const char * VideoModeText[] =
trNOOP( "Force NTSC" ),
trNOOP( "Region Patch" ),
trNOOP( "Force PAL480p" ),
trNOOP( "Force NTSC480p" ),
trNOOP( "Force NTSC480p" )
};
static const char * VideoPatchDolText[] =
@ -59,7 +59,17 @@ static const char * VideoPatchDolText[] =
trNOOP( "OFF" ),
trNOOP( "Region Patch" ),
trNOOP( "ON" ),
trNOOP( "All" ),
trNOOP( "All" )
};
static const char * DeflickerText[] =
{
trNOOP( "Auto" ),
trNOOP( "OFF (Safe)" ),
trNOOP( "OFF (Extended)" ),
trNOOP( "ON (Low)" ),
trNOOP( "ON (Medium)" ),
trNOOP( "ON (High)" )
};
static const char * AspectText[] =
@ -81,7 +91,7 @@ static const char * LanguageText[] =
trNOOP( "SChinese" ),
trNOOP( "TChinese" ),
trNOOP( "Korean" ),
trNOOP( "Console Default" ),
trNOOP( "Console Default" )
};
static const char * ParentalText[] =
@ -99,7 +109,7 @@ static const char * AlternateDOLText[] =
trNOOP( "Select a DOL from Game" ),
trNOOP( "Load From SD/USB" ),
trNOOP( "List on Gamelaunch" ),
trNOOP( "Default" ),
trNOOP( "Default" )
};
static const char * NandEmuText[] =
@ -119,7 +129,7 @@ static const char * HooktypeText[] =
trNOOP( "GXDraw" ),
trNOOP( "GXFlush" ),
trNOOP( "OSSleepThread" ),
trNOOP( "AXNextFrame" ),
trNOOP( "AXNextFrame" )
};
static const char * PrivServText[] =
@ -128,7 +138,7 @@ static const char * PrivServText[] =
trNOOP( "NoSSL only" ),
trNOOP( "Wiimmfi" ),
trNOOP( "AltWFC" ),
trNOOP( "Custom" ),
trNOOP( "Custom" )
};
static const char blocked[22] =
@ -195,6 +205,7 @@ void GameLoadSM::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "480p Pixel Fix Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Deflicker Filter" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
Options->SetName(Idx++, "%s", tr( "Game Language" ));
@ -268,6 +279,12 @@ void GameLoadSM::SetOptionValues()
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.vipatch]));
//! Settings: Deflicker Filter
if(GameConfig.deflicker == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(DeflickerText[GameConfig.deflicker]));
//! Settings: Aspect Ratio
if(GameConfig.aspectratio == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
@ -457,6 +474,12 @@ int GameLoadSM::GetMenuInternal()
if (++GameConfig.vipatch >= MAX_ON_OFF) GameConfig.vipatch = INHERIT;
}
//! Settings: Deflicker Filter
else if (ret == ++Idx)
{
if (++GameConfig.deflicker >= DEFLICKER_MAX) GameConfig.deflicker = INHERIT;
}
//! Settings: Aspect Ratio
else if (ret == ++Idx)
{

View File

@ -72,6 +72,16 @@ static const char * VideoPatchDolText[] =
trNOOP( "All" ),
};
static const char * DeflickerText[] =
{
trNOOP( "Auto" ),
trNOOP( "OFF (Safe)" ),
trNOOP( "OFF (Extended)" ),
trNOOP( "ON (Low)" ),
trNOOP( "ON (Medium)" ),
trNOOP( "ON (High)" )
};
static const char * LanguageText[] =
{
trNOOP( "Japanese" ),
@ -240,6 +250,7 @@ void LoaderSettings::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "480p Pixel Fix Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Deflicker Filter" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
@ -333,6 +344,9 @@ void LoaderSettings::SetOptionValues()
//! Settings: VIDTV Patch
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.videopatch] ));
//! Settings: Deflicker Filter
Options->SetValue(Idx++, "%s", tr( DeflickerText[Settings.deflicker] ));
//! Settings: Aspect Ratio
Options->SetValue(Idx++, "%s", tr( AspectText[Settings.GameAspectRatio] ));
@ -590,6 +604,12 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.videopatch >= MAX_ON_OFF) Settings.videopatch = 0;
}
//! Settings: Deflicker Filter
else if (ret == ++Idx)
{
if (++Settings.deflicker >= DEFLICKER_MAX) Settings.deflicker = 0;
}
//! Settings: Aspect Ratio
else if (ret == ++Idx )
{

View File

@ -269,6 +269,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
u8 PrivServChoice = game_cfg->PrivateServer == INHERIT ? Settings.PrivateServer : game_cfg->PrivateServer;
const char *customAddress = game_cfg->CustomAddress.size() == 0 ? Settings.CustomAddress : game_cfg->CustomAddress.c_str();
u8 viChoice = game_cfg->vipatch == INHERIT ? Settings.videopatch : game_cfg->vipatch;
u8 deflicker = game_cfg->deflicker == INHERIT ? Settings.deflicker : game_cfg->deflicker;
u8 sneekChoice = game_cfg->sneekVideoPatch == INHERIT ? Settings.sneekVideoPatch : game_cfg->sneekVideoPatch;
u8 iosChoice = game_cfg->ios == INHERIT ? Settings.cios : game_cfg->ios;
u8 countrystrings = game_cfg->patchcountrystrings == INHERIT ? Settings.patchcountrystrings : game_cfg->patchcountrystrings;
@ -451,12 +452,14 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
if (PrivServChoice != PRIVSERV_WIIMMFI || memcmp(gameHeader.id, "RMC", 3) != 0)
{
//! Either the server is not Wiimmfi, or, if it is Wiimmfi, the game isn't MKWii - patch the old way
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, returnToChoice, PrivServChoice, customAddress);
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice,
deflicker, sneekChoice, Hooktype, returnToChoice, PrivServChoice, customAddress);
}
else
{
//! Wiimmfi patch for Mario Kart Wii - patch with PRIVSERV_OFF and handle all the patching within do_new_wiimmfi()
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, returnToChoice, PRIVSERV_OFF, customAddress);
gamepatches(videoChoice, videoPatchDolChoice, aspectChoice, languageChoice, countrystrings, viChoice,
deflicker, sneekChoice, Hooktype, returnToChoice, PRIVSERV_OFF, customAddress);
}