(view as text)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c96f87c..10ba7c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -472,16 +472,7 @@ endif()
########################################
# Setup include directories (and make sure they are preferred over the Externals)
#
-include_directories(Source/Core/AudioCommon)
-include_directories(Source/Core/Common)
-include_directories(Source/Core/Core)
-include_directories(Source/Core/DebuggerUICommon)
-include_directories(Source/Core/DebuggerWX)
-include_directories(Source/Core/DiscIO)
-include_directories(Source/Core/DolphinWX)
-include_directories(Source/Core/InputCommon)
-include_directories(Source/Core/VideoCommon)
-include_directories(Source/Core/VideoUICommon)
+include_directories(Source/Core)
########################################
# Process externals and setup their include directories
diff --git a/Languages/po/ar.po b/Languages/po/ar.po
index 95034ae..c3f2cfd 100644
--- a/Languages/po/ar.po
+++ b/Languages/po/ar.po
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Arabic (http://www.transifex.com/projects/p/dolphin-emu/"
"language/ar/)\n"
"Language: ar\n"
@@ -5821,6 +5821,3 @@ msgstr "zNear تصحيح: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "أو"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "الحد من عدد الإطارات في الثانية "
diff --git a/Languages/po/ca.po b/Languages/po/ca.po
index 649b3f6..a5fe555 100644
--- a/Languages/po/ca.po
+++ b/Languages/po/ca.po
@@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Catalan (http://www.transifex.com/projects/p/dolphin-emu/"
"language/ca/)\n"
"Language: ca\n"
@@ -1324,6 +1324,14 @@ msgid ""
"If so, then you may need to re-specify your memory card location in the "
"options."
msgstr ""
+"No s'ha pogut escriure al fitxer de la targeta de memòria %s.\n"
+"\n"
+"Estàs executant Dolphin des d'un CD/DVD, o potser l'arxiu de guardat està "
+"protegit contra escriptura?\n"
+"\n"
+"Estàs rebent aquest missatge després de moure el directori de l'emulador?\n"
+"Si és així, llavors és possible que tinguis de tornar a especificar la "
+"ubicació a la targeta de memòria en les opcions."
#: Source/Core/DolphinWX/ISOProperties.cpp:1149
msgid "Couldn't find open command for extension 'ini'!"
@@ -3560,6 +3568,12 @@ msgid ""
"\n"
"If unsure, leave this unchecked."
msgstr ""
+"Fa els objectes distants més visibles eliminant la boira, incrementat el el "
+"detall general.\n"
+"Desactivar la boria trencarà alguns jocs que depenen en una emulació "
+"adequada de la boira.\n"
+"\n"
+"Si no n'estàs segur, deixa-ho desmarcat."
#: Source/Core/DolphinWX/WiimoteConfigDiag.cpp:114
#: Source/Core/DolphinWX/WiimoteConfigDiag.cpp:117
@@ -4651,6 +4665,11 @@ msgid ""
"\n"
"If unsure, use OpenGL."
msgstr ""
+"Selecciona una API gràfica per ús intern.\n"
+"El renderitzat per software només es fa servir per la depuració, així que a "
+"menys que tinguis una raò per fer-lo servir voldràs seleccionar OpenGL.\n"
+"\n"
+"Si no n'estàs segur, fes servir OpenGL."
#: Source/Core/DolphinWX/VideoConfigDiag.cpp:70
msgid ""
@@ -4663,6 +4682,15 @@ msgid ""
"\n"
"If unsure, use OpenGL."
msgstr ""
+"Selecciona una API gràfica per ús intern.\n"
+"El renderitzat per software només es fa servir per la depuració, així que "
+"voldràs utilitzar Direct3D o OpenGL. Diferents jocs es comportaran de manera "
+"diferent en cada motor gràfic, pero la millor experiència d'emulació es "
+"recomana provar els dos i triar el que millor et funcioni.\n"
+"Tingues en compte que el Direct3D no està disponible en versions antigues de "
+"Windows.\n"
+"\n"
+"Si no n'estàs segur, fes servir OpenGL."
#: Source/Core/DolphinWX/NetWindow.cpp:313
msgid "Send"
@@ -4716,9 +4744,8 @@ msgid "Settings..."
msgstr "Configuració..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: No es pot crear l'arxiu de configuració"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -5130,6 +5157,8 @@ msgid ""
"Synchronizes the GPU and CPU threads to help prevent random freezes in Dual "
"Core mode. (ON = Compatible, OFF = Fast)"
msgstr ""
+"Sincronitza els processos de la GPU i CPU per ajudar a prevenir congelacions "
+"aleatòries en em mode doble nucli. (ON = Compatible, OFF= Ràpid)"
#: Source/Core/DolphinWX/ConfigMain.cpp:726
#: Source/Core/DolphinWX/ConfigMain.cpp:780
@@ -5584,6 +5613,11 @@ msgid ""
"\n"
"If unsure, leave this checked."
msgstr ""
+"Utilitza un algorisme menys precis per calcular valors de profunditat.\n"
+"Causa problemes en alguns jocs però pot donar un augment decent a la "
+"velocitat.\n"
+"\n"
+"Si no n'estàs segur, deixa-ho marcat."
#: Source/Core/DolphinWX/VideoConfigDiag.cpp:120
msgid ""
@@ -5710,6 +5744,8 @@ msgid ""
"Warning: Netplay/movies will desync because your CPU does not support DAZ "
"and Dolphin does not emulate it anymore."
msgstr ""
+"Avís: Netplay/pel·lícules estaran desincronitzades perquè la seva CPU no "
+"suporta DAZ i Dolphin no l'emula més."
#: Source/Core/DolphinWX/MemcardManager.cpp:578
#, c-format
@@ -5910,7 +5946,7 @@ msgstr "La creació de la veu principal XAudio2 ha fallat:%#X"
#: Source/Core/AudioCommon/XAudio2_7Stream.cpp:93
#, c-format
msgid "XAudio2_7 CreateSourceVoice failed: %#X"
-msgstr ""
+msgstr "XAudio2_7 CreateSourceVoice ha fallat: %#X"
#: Source/Core/AudioCommon/XAudio2_7Stream.cpp:181
#, c-format
@@ -5920,7 +5956,7 @@ msgstr "XAudio2_7 init ha fallat: %#X"
#: Source/Core/AudioCommon/XAudio2_7Stream.cpp:191
#, c-format
msgid "XAudio2_7 master voice creation failed: %#X"
-msgstr ""
+msgstr "XAudio2_7 creació de veu mestra ha fallat: %#X"
#: Source/Core/DolphinWX/FifoPlayerDlg.cpp:776
msgid "XF reg"
@@ -5960,6 +5996,9 @@ msgid ""
"Would you like to stop now to fix the problem?\n"
"If you select \"No\", audio might be garbled."
msgstr ""
+"La teva ROM DSP té el has incorrecte.\n"
+"Vols parar ara per solucionar el problema?\n"
+"Si selecciones \"No, l'audio podria quedar distorsionat."
#: Source/Core/Core/CoreParameter.cpp:180
msgid ""
@@ -6042,6 +6081,3 @@ msgstr "Correcció ZAprop"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| O"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limitar per FPS "
diff --git a/Languages/po/cs.po b/Languages/po/cs.po
index e5690e6..cbb17b7 100644
--- a/Languages/po/cs.po
+++ b/Languages/po/cs.po
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 09:32+0000\n"
-"Last-Translator: Zbyněk Schwarz <zbynek.schwarz@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/dolphin-emu/"
"language/cs/)\n"
"Language: cs\n"
@@ -4771,9 +4771,8 @@ msgid "Settings..."
msgstr "Nastavení..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Nelze vytvořit soubor nastavení"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6108,23 +6107,3 @@ msgstr "Korekce zNear:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| NEBO"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Ukládat předvyt. obj. do vyr. pam."
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limitovat podle SzS"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EXPERIMENTÁLNÍ]\n"
-#~ "Trochu zrychlí emulaci ukládáním předvytvořených objektů do vyrovnávací "
-#~ "paměti\n"
-#~ "Může ale také způsobovat problémy\n"
-#~ "\n"
-#~ "Pokud si nejste jisti, nechejte toto odškrtnuté."
diff --git a/Languages/po/de.po b/Languages/po/de.po
index 3d367e5..e3a113b 100644
--- a/Languages/po/de.po
+++ b/Languages/po/de.po
@@ -17,8 +17,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-08 20:05+0000\n"
-"Last-Translator: Tilka <tilkax@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 18:17+0000\n"
+"Last-Translator: M T <michtrz@gmail.com>\n"
"Language-Team: German (http://www.transifex.com/projects/p/dolphin-emu/"
"language/de/)\n"
"Language: de\n"
@@ -4820,9 +4820,8 @@ msgid "Settings..."
msgstr "Einstellungen..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Einstellungsdatei konnte nicht erstellt werden"
+msgstr "SetupWiiMem: Die Datei setting.txt kann nicht erstellt werden"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6171,23 +6170,3 @@ msgstr "zNear-Korrektur:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| ODER"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Anzeigeliste zwischenspeichern"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "FPS beschränken"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EXPERIMENTELL]\n"
-#~ "Beschleunigt die Emulation ein wenig indem Displaylisten in den Cache "
-#~ "geladen werden.\n"
-#~ "Verursacht jedoch möglicherweise Probleme.\n"
-#~ "\n"
-#~ "Im Zweifel deaktiviert lassen."
diff --git a/Languages/po/el.po b/Languages/po/el.po
index b03ed87..1fc46d7 100644
--- a/Languages/po/el.po
+++ b/Languages/po/el.po
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Greek (http://www.transifex.com/projects/p/dolphin-emu/"
"language/el/)\n"
"Language: el\n"
@@ -4797,9 +4797,8 @@ msgid "Settings..."
msgstr "Ρυθμίσεις..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Αδυναμία δημιουργίας αρχείου ρυθμίσεων"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6158,6 +6157,3 @@ msgstr "zNear Διόρθωση: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Περιορισμός με βάση τα Καρέ"
diff --git a/Languages/po/es.po b/Languages/po/es.po
index ad1000c..3360b8b 100644
--- a/Languages/po/es.po
+++ b/Languages/po/es.po
@@ -4,7 +4,7 @@
#
# Translators:
# Dario_ff <dariosamo@gmail.com>, 2011
-# Petiso_Carambanal <diegoae@gmail.com>, 2013
+# Petiso_Carambanal <diegoae@gmail.com>, 2013-2014
# dfersd01 <dfersd@yahoo.com>, 2013
# Puniasterus <puniasterus@gmail.com>, 2013-2014
# Puniasterus <puniasterus@gmail.com>, 2013
@@ -14,8 +14,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Spanish (http://www.transifex.com/projects/p/dolphin-emu/"
"language/es/)\n"
"Language: es\n"
@@ -4817,9 +4817,8 @@ msgid "Settings..."
msgstr "Configuración..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: No se puede crear el archivo de configuración"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6163,6 +6162,3 @@ msgstr "Correción zNear:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Usar FPS para limitar"
diff --git a/Languages/po/fa.po b/Languages/po/fa.po
index e5f7c20..da30fba 100644
--- a/Languages/po/fa.po
+++ b/Languages/po/fa.po
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Persian (http://www.transifex.com/projects/p/dolphin-emu/"
"language/fa/)\n"
"Language: fa\n"
@@ -5990,6 +5990,3 @@ msgstr "اصلاح z نزدیک:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| یا"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "محدود کردن توسط تعداد فریم ها بر ثانیه"
diff --git a/Languages/po/fr.po b/Languages/po/fr.po
index 9050962..c88f808 100644
--- a/Languages/po/fr.po
+++ b/Languages/po/fr.po
@@ -17,7 +17,7 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-06 22:35+0000\n"
+"PO-Revision-Date: 2014-02-16 12:00+0000\n"
"Last-Translator: FRtranslator <pascal2j-language@yahoo.com>\n"
"Language-Team: French (http://www.transifex.com/projects/p/dolphin-emu/"
"language/fr/)\n"
@@ -4833,9 +4833,8 @@ msgid "Settings..."
msgstr "Configurer..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Impossible de créer le fichier de paramètres"
+msgstr "SetupWiiMemory : Impossible de créer le fichier setting.txt"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -5480,7 +5479,7 @@ msgstr ""
"Ceci limite la vitesse du jeu au nombre spécifié d'images par seconde (60 i/"
"s pour le NTSC, 50 i/s pour le PAL). Vous pouvez à la place utiliser Audio "
"pour gérer via le DSP (peut éliminer les problèmes audio, mais peut "
-"provoquer un bruit constant selon les jeux).²"
+"provoquer un bruit constant selon les jeux)."
#: Source/Core/DolphinWX/ConfigMain.cpp:491
msgid ""
@@ -6181,23 +6180,3 @@ msgstr "Correction zNear :"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OU"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Mise en cache des Listes d'affichage"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Nb de FPS comme limite"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Accélère légèrement l'émulation en mettant en cache les listes "
-#~ "d'affichage.\n"
-#~ "Il est possible que cela cause des pépins.\n"
-#~ "\n"
-#~ "Dans le doute, décochez cette case."
diff --git a/Languages/po/he.po b/Languages/po/he.po
index c0ba67e..e292f62 100644
--- a/Languages/po/he.po
+++ b/Languages/po/he.po
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Hebrew (http://www.transifex.com/projects/p/dolphin-emu/"
"language/he/)\n"
"Language: he\n"
diff --git a/Languages/po/hu.po b/Languages/po/hu.po
index feeeedd..5c2deeb 100644
--- a/Languages/po/hu.po
+++ b/Languages/po/hu.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Hungarian (http://www.transifex.com/projects/p/dolphin-emu/"
"language/hu/)\n"
"Language: hu\n"
@@ -6019,6 +6019,3 @@ msgstr "zNear javítás: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| VAGY"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "FPS alapú korlátozás"
diff --git a/Languages/po/it.po b/Languages/po/it.po
index e0c694c..b01ecbb 100644
--- a/Languages/po/it.po
+++ b/Languages/po/it.po
@@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-06 18:27+0000\n"
+"PO-Revision-Date: 2014-02-16 12:28+0000\n"
"Last-Translator: Mewster <mewster@libero.it>\n"
"Language-Team: Italian (http://www.transifex.com/projects/p/dolphin-emu/"
"language/it/)\n"
@@ -4817,9 +4817,8 @@ msgid "Settings..."
msgstr "Impostazioni..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Impossibile creare file di configurazione"
+msgstr "SetupWiiMemory: Impossibile creare il file setting.txt"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6161,22 +6160,3 @@ msgstr "Correzione zNear: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Cache delle Display List"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limita per FPS"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[SPERIMENTALE]\n"
-#~ "Velocizza leggermente l'emulazione salvando in cache le display list.\n"
-#~ "Potrebbe causare dei problemi.\n"
-#~ "\n"
-#~ "Nel dubbio, lascia deselezionato."
diff --git a/Languages/po/ja.po b/Languages/po/ja.po
index bcaa24a..a32f60a 100644
--- a/Languages/po/ja.po
+++ b/Languages/po/ja.po
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-09 19:44+0000\n"
-"Last-Translator: Lioncash <mathew1800@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Japanese (http://www.transifex.com/projects/p/dolphin-emu/"
"language/ja/)\n"
"Language: ja\n"
@@ -4767,9 +4767,8 @@ msgid "Settings..."
msgstr "設定"
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Cant create setting file"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6081,6 +6080,3 @@ msgstr "zNear 補正値:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| (...もしくは)"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "FPSによる制限を有効化"
diff --git a/Languages/po/ko.po b/Languages/po/ko.po
index 433fc4d..2facc07 100644
--- a/Languages/po/ko.po
+++ b/Languages/po/ko.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Korean (http://www.transifex.com/projects/p/dolphin-emu/"
"language/ko/)\n"
"Language: ko\n"
@@ -4754,9 +4754,8 @@ msgid "Settings..."
msgstr "설정..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: 설정 파일을 생성할 수 없음"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6081,6 +6080,3 @@ msgstr "z근거리 정정:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "FPS로 제한"
diff --git a/Languages/po/nb.po b/Languages/po/nb.po
index 3ac5953..c06e73b 100644
--- a/Languages/po/nb.po
+++ b/Languages/po/nb.po
@@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Norwegian Bokmål (http://www.transifex.com/projects/p/dolphin-"
"emu/language/nb/)\n"
"Language: nb\n"
@@ -4839,9 +4839,8 @@ msgid "Settings..."
msgstr "Innstillinger..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Kan ikke lage innstillingsfil"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6168,6 +6167,3 @@ msgstr "zNear korreksjon: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| ELLER"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Begrens med FPS (bilder-per-sekund)"
diff --git a/Languages/po/nl.po b/Languages/po/nl.po
index a14c7b3..12f85d9 100644
--- a/Languages/po/nl.po
+++ b/Languages/po/nl.po
@@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Dutch (http://www.transifex.com/projects/p/dolphin-emu/"
"language/nl/)\n"
"Language: nl\n"
@@ -4726,9 +4726,8 @@ msgid "Settings..."
msgstr "Instellingen..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Kan het instellingen bestand niet aanmaken"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6058,6 +6057,3 @@ msgstr "zDichtbij correctie:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OF"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limiteer met behulp van FPS"
diff --git a/Languages/po/pl.po b/Languages/po/pl.po
index 9226d1a..5c50711 100644
--- a/Languages/po/pl.po
+++ b/Languages/po/pl.po
@@ -11,7 +11,7 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 12:56+0000\n"
+"PO-Revision-Date: 2014-02-16 18:16+0000\n"
"Last-Translator: M T <michtrz@gmail.com>\n"
"Language-Team: Polish (http://www.transifex.com/projects/p/dolphin-emu/"
"language/pl/)\n"
@@ -4774,9 +4774,8 @@ msgid "Settings..."
msgstr "Ustawienia..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Nie można utworzyć pliku konfiguracyjnego"
+msgstr "SetupWiiMem: Nie można utworzyć pliku setting.txt"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6105,22 +6104,3 @@ msgstr "zNear Correction: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Buforuj listę wyświetlania"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limit FPS"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EKSPERYMENTALNE]\n"
-#~ "Przyspiesza emulację nieznacznie poprzez buforowanie listy wyświetlania.\n"
-#~ "Możliwe błędy.\n"
-#~ "\n"
-#~ "W razie wątpliwości, pozostaw wyłączone."
diff --git a/Languages/po/pt.po b/Languages/po/pt.po
index fdf2d17..c064583 100644
--- a/Languages/po/pt.po
+++ b/Languages/po/pt.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Portuguese (http://www.transifex.com/projects/p/dolphin-emu/"
"language/pt/)\n"
"Language: pt\n"
@@ -5913,6 +5913,3 @@ msgstr "Correcção zNear: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OU"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limitar por FPS"
diff --git a/Languages/po/pt_BR.po b/Languages/po/pt_BR.po
index ae22d59..ab57795 100644
--- a/Languages/po/pt_BR.po
+++ b/Languages/po/pt_BR.po
@@ -16,7 +16,7 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-09 03:14+0000\n"
+"PO-Revision-Date: 2014-02-16 16:37+0000\n"
"Last-Translator: Mateus Cassiano <jhonn.copperfield@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/"
"dolphin-emu/language/pt_BR/)\n"
@@ -4793,9 +4793,8 @@ msgid "Settings..."
msgstr "Configurações..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Não foi possível criar o arquivo de configurações"
+msgstr "SetupWiiMemory: Não foi possível criar o arquivo setting.txt"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6135,23 +6134,3 @@ msgstr "Correção do zNear:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| OR"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Cache de Display Lists"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Limitar por FPS"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Aumenta a velocidade da emulação usando um cache temporário de Display "
-#~ "Lists.\n"
-#~ "Pode causar problemas.\n"
-#~ "\n"
-#~ "Se estiver em dúvida, deixe isto desativado."
diff --git a/Languages/po/ru.po b/Languages/po/ru.po
index a865675..69bdd06 100644
--- a/Languages/po/ru.po
+++ b/Languages/po/ru.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Russian (http://www.transifex.com/projects/p/dolphin-emu/"
"language/ru/)\n"
"Language: ru\n"
@@ -5679,6 +5679,3 @@ msgstr "zNear Коррекция: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| ИЛИ"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Лимитировать FPS"
diff --git a/Languages/po/sr.po b/Languages/po/sr.po
index 0a4c94e..acd1529 100644
--- a/Languages/po/sr.po
+++ b/Languages/po/sr.po
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Serbian (http://www.transifex.com/projects/p/dolphin-emu/"
"language/sr/)\n"
"Language: sr\n"
diff --git a/Languages/po/sv.po b/Languages/po/sv.po
index 9827f78..dc458fd 100644
--- a/Languages/po/sv.po
+++ b/Languages/po/sv.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 11:06+0000\n"
-"Last-Translator: DolphinPhoenix <anton_r_3@hotmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Swedish (http://www.transifex.com/projects/p/dolphin-emu/"
"language/sv/)\n"
"Language: sv\n"
@@ -86,7 +86,7 @@ msgid ""
" Card file size is invalid (0x%x bytes)"
msgstr ""
"%s misslyckades att läsas in som ett minneskort \n"
-" Kortets filstorlek är ogiltig (0x%x bytes)"
+" Kortets filstorlek är ogiltig (0x%x byte)"
#: Source/Core/Core/HW/GCMemcard.cpp:66
#, c-format
@@ -95,7 +95,7 @@ msgid ""
" Card size is invalid (0x%x bytes)"
msgstr ""
"%s misslyckades att läsas in som ett minneskort \n"
-" Kortets storlek är ogiltig (0x%x bytes)"
+" Kortets storlek är ogiltig (0x%x byte)"
#: Source/Core/Core/HW/GCMemcard.cpp:46
#, c-format
@@ -103,9 +103,9 @@ msgid ""
"%s failed to load as a memorycard \n"
"file is not large enough to be a valid memory card file (0x%x bytes)"
msgstr ""
-"%s misslyckades att läsas in som ett minneskort.\n"
+"%s misslyckades att läsas in som ett minneskort\n"
"Filen är inte tillräckligt stor för att vara en giltig minneskortsfil (0x%x "
-"bytes)"
+"byte)"
#: Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp:412
#, c-format
@@ -2567,8 +2567,8 @@ msgstr "Snabb version av MMU. Fungerar inte för alla spel."
msgid ""
"Fatal desync. Aborting playback. (Error in PlayWiimote: %u != %u, byte %u.)%s"
msgstr ""
-"Allvarlig desynkronisering. Avbryter Aborting uppspelning. (Fel i "
-"PlayWiimote: %u != %u, byte %u.)%s"
+"Allvarlig desynkronisering. Avbryter uppspelning. (Fel i PlayWiimote: %u != "
+"%u, byte %u.)%s"
#: Source/Core/DolphinWX/FrameTools.cpp:202
msgid "Fifo Player"
@@ -3192,7 +3192,7 @@ msgstr "Installera till Wii-meny"
msgid ""
"InstallExceptionHandler called, but this platform does not yet support it."
msgstr ""
-"InstallExceptionHandler anropade, man denna plattform stödjer inte det ännu."
+"InstallExceptionHandler anropades, men denna plattform stödjer inte det ännu."
#: Source/Core/DolphinWX/FrameTools.cpp:1387
msgid "Installing WAD..."
@@ -3641,7 +3641,7 @@ msgstr "Minneskortet har redan en sparning för denna titel"
#: Source/Core/DolphinWX/MemcardManager.cpp:278
msgid "Memcard already opened"
-msgstr "Minneskort är redan öppnat"
+msgstr "Minneskortet har redan öppnats"
#: Source/Core/DolphinWX/FifoPlayerDlg.cpp:924
msgid "Memory Byte"
@@ -4249,21 +4249,21 @@ msgstr "Efterprocesseringseffekt:"
#: Source/Core/Core/Movie.cpp:932
#, c-format
msgid "Premature movie end in PlayController. %u + 8 > %u"
-msgstr "För tidigt filmslut i PlayController. %u + 8 > %u"
+msgstr "Tidigt filmslut i PlayController. %u + 8 > %u"
#: Source/Core/Core/Movie.cpp:1052
#, c-format
msgid "Premature movie end in PlayWiimote. %u + %d > %u"
-msgstr "För tidigt filmslut i PlayWiimote. %u + %d > %u"
+msgstr "Tidigt filmslut i PlayWiimote. %u + %d > %u"
#: Source/Core/Core/Movie.cpp:1028
#, c-format
msgid "Premature movie end in PlayWiimote. %u > %u"
-msgstr "För tidigt filmslut i PlayWiimote. %u > %u"
+msgstr "Tidigt filmslut i PlayWiimote. %u > %u"
#: Source/Core/DolphinWX/PHackSettings.cpp:35
msgid "Presets: "
-msgstr "Snabbväljare:"
+msgstr "Förval:"
#: Source/Core/DolphinWX/MemcardManager.cpp:192
msgid "Prev Page"
@@ -4369,7 +4369,7 @@ msgstr "Inspelningsinformation"
#: Source/Core/DolphinWX/FifoPlayerDlg.cpp:189
msgid "Recording Options"
-msgstr "Inspelningsinställningar"
+msgstr "Inspelningsalternativ"
#: Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.cpp:25
msgid "Red"
@@ -4604,7 +4604,7 @@ msgstr "Sök undermappar"
#: Source/Core/DolphinWX/FifoPlayerDlg.cpp:238
msgid "Search current Object"
-msgstr "Spara aktuellt objekt"
+msgstr "Sök aktuellt objekt"
#: Source/Core/DolphinWX/FifoPlayerDlg.cpp:242
msgid "Search for hex Value:"
@@ -4650,7 +4650,7 @@ msgstr "Välj flytande fönster"
#: Source/Core/DolphinWX/FrameTools.cpp:617
msgid "Select the file to load"
-msgstr "Öppna fil"
+msgstr "Öppna fil att läsa in"
#: Source/Core/DolphinWX/FrameTools.cpp:1333
msgid "Select the save file"
@@ -4792,9 +4792,8 @@ msgid "Settings..."
msgstr "Inställningar..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Kan inte skapa inställningsfil"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -4806,7 +4805,7 @@ msgstr "Kort namn:"
#: Source/Core/DolphinWX/TASInputDlg.cpp:92
msgid "Shoulder Buttons"
-msgstr "Avtyckarknappar"
+msgstr "Axelknappar"
#: Source/Core/DolphinWX/FrameTools.cpp:221
msgid "Show &Console"
@@ -5041,7 +5040,7 @@ msgstr "Ögonblicksbild"
#: Source/Core/VideoBackends/Software/SWmain.cpp:58
msgid "Software Renderer"
-msgstr "Programrenderare"
+msgstr "Programvarurenderare"
#: Source/Core/DolphinWX/VideoConfigDiag.h:83
msgid ""
@@ -5516,7 +5515,7 @@ msgstr "Försökte läsa in en okänd filtyp."
#: Source/Core/Core/HW/GCPadEmu.cpp:67
msgid "Triggers"
-msgstr "Axelknappar"
+msgstr "Avtryckare"
#: Source/Core/Common/SysConf.h:77 Source/Core/Common/SysConf.h:100
msgid "Trying to read from invalid SYSCONF"
@@ -6134,22 +6133,3 @@ msgstr "zNear-korrektion: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| ELLER"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "Cachevisningslista"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "Begränsa efter bildrutefrekvens"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[EXPERIMENTELL]\n"
-#~ "Snabbar upp emulatorn lite grann genom att cachelagra visningslistan.\n"
-#~ "Kan möjligtvis orsaka fel.\n"
-#~ "\n"
-#~ "Om du är osäker kan du lämna detta omarkerat."
diff --git a/Languages/po/tr.po b/Languages/po/tr.po
index 361035b..38d0b29 100644
--- a/Languages/po/tr.po
+++ b/Languages/po/tr.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Turkish (http://www.transifex.com/projects/p/dolphin-emu/"
"language/tr/)\n"
"Language: tr\n"
@@ -4780,9 +4780,8 @@ msgid "Settings..."
msgstr "Ayarlar..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "SetupWiiMem: Ayar dosyası oluşturulamıyor"
+msgstr ""
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6112,6 +6111,3 @@ msgstr "zNear Düzeltmesi:"
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| VEYA"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "FPS Sınırlaması"
diff --git a/Languages/po/zh_CN.po b/Languages/po/zh_CN.po
index 3819ca1..e6b895a 100644
--- a/Languages/po/zh_CN.po
+++ b/Languages/po/zh_CN.po
@@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-08 01:11+0000\n"
+"PO-Revision-Date: 2014-02-16 13:59+0000\n"
"Last-Translator: lxf2000 <gaoboyuan8@qq.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/projects/p/dolphin-"
"emu/language/zh_CN/)\n"
@@ -4673,7 +4673,7 @@ msgstr "发送"
#: Source/Core/DolphinWX/WiimoteConfigDiag.cpp:111
msgid "Sensor Bar Position:"
-msgstr "传感器栏位置:"
+msgstr "感应条位置:"
#: Source/Core/DolphinWX/WXInputBase.cpp:64
msgid "Separator"
@@ -4713,9 +4713,8 @@ msgid "Settings..."
msgstr "设置..."
#: Source/Core/Core/Boot/Boot_BS2Emu.cpp:221
-#, fuzzy
msgid "SetupWiiMemory: Cant create setting.txt file"
-msgstr "安装Wii内存:无法创建设置文件"
+msgstr "SetupWiiMemory: 无法创建 setting.txt 文件"
#: Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp:288
msgid "Shake"
@@ -6021,22 +6020,3 @@ msgstr "近剪裁平面修正: "
#: Source/Core/DolphinWX/InputConfigDiag.cpp:531
msgid "| OR"
msgstr "| 或"
-
-#~ msgid "Cache Display Lists"
-#~ msgstr "缓存显示列表"
-
-#~ msgid "Limit by FPS"
-#~ msgstr "依据 FPS 限速"
-
-#~ msgid ""
-#~ "[EXPERIMENTAL]\n"
-#~ "Speeds up emulation a bit by caching display lists.\n"
-#~ "Possibly causes issues though.\n"
-#~ "\n"
-#~ "If unsure, leave this unchecked."
-#~ msgstr ""
-#~ "[实验性]\n"
-#~ "通过缓存显示列表略微提高模拟速度。\n"
-#~ "另一方面也可能产生问题。\n"
-#~ "\n"
-#~ "如果没有把握,请不要勾选此项。"
diff --git a/Languages/po/zh_TW.po b/Languages/po/zh_TW.po
index 88c5ec1..ed28bb4 100644
--- a/Languages/po/zh_TW.po
+++ b/Languages/po/zh_TW.po
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Dolphin Emulator\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-02-12 00:00+0000\n"
-"PO-Revision-Date: 2014-02-05 08:16+0000\n"
-"Last-Translator: delroth <delroth@gmail.com>\n"
+"PO-Revision-Date: 2014-02-16 11:47+0000\n"
+"Last-Translator: dolphinbot <delroth@dolphin-emu.org>\n"
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/projects/p/dolphin-"
"emu/language/zh_TW/)\n"
"Language: zh_TW\n"
diff --git a/Source/Core/AudioCommon/AOSoundStream.cpp b/Source/Core/AudioCommon/AOSoundStream.cpp
index 5a657a5..4925d3a 100644
--- a/Source/Core/AudioCommon/AOSoundStream.cpp
+++ b/Source/Core/AudioCommon/AOSoundStream.cpp
@@ -5,8 +5,8 @@
#include <functional>
#include <string.h>
-#include "AOSoundStream.h"
-#include "Mixer.h"
+#include "AudioCommon/AOSoundStream.h"
+#include "AudioCommon/Mixer.h"
#if defined(HAVE_AO) && HAVE_AO
diff --git a/Source/Core/AudioCommon/AOSoundStream.h b/Source/Core/AudioCommon/AOSoundStream.h
index 5301084..d2097ca 100644
--- a/Source/Core/AudioCommon/AOSoundStream.h
+++ b/Source/Core/AudioCommon/AOSoundStream.h
@@ -4,8 +4,8 @@
#pragma once
-#include "SoundStream.h"
-#include "Thread.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
#if defined(HAVE_AO) && HAVE_AO
#include <ao/ao.h>
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp
index 4c84ae6..a88fae0 100644
--- a/Source/Core/AudioCommon/AlsaSoundStream.cpp
+++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp
@@ -4,9 +4,9 @@
#include <functional>
-#include "Common.h"
-#include "Thread.h"
-#include "AlsaSoundStream.h"
+#include "AudioCommon/AlsaSoundStream.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
#define FRAME_COUNT_MIN 256
#define BUFFER_SIZE_MAX 8192
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.h b/Source/Core/AudioCommon/AlsaSoundStream.h
index defa3c4..78a8576 100644
--- a/Source/Core/AudioCommon/AlsaSoundStream.h
+++ b/Source/Core/AudioCommon/AlsaSoundStream.h
@@ -8,10 +8,9 @@
#include <alsa/asoundlib.h>
#endif
-#include "Common.h"
-#include "SoundStream.h"
-
-#include "Thread.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
class AlsaSound : public SoundStream
{
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp
index 7bb1e09..a8229b3 100644
--- a/Source/Core/AudioCommon/AudioCommon.cpp
+++ b/Source/Core/AudioCommon/AudioCommon.cpp
@@ -2,21 +2,24 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "AudioCommon.h"
-#include "FileUtil.h"
-#include "Mixer.h"
-#include "NullSoundStream.h"
-#include "DSoundStream.h"
-#include "XAudio2_7Stream.h"
-#include "XAudio2Stream.h"
-#include "AOSoundStream.h"
-#include "AlsaSoundStream.h"
-#include "CoreAudioSoundStream.h"
-#include "OpenALStream.h"
-#include "PulseAudioStream.h"
-#include "OpenSLESStream.h"
-#include "../Core/Movie.h"
-#include "../Core/ConfigManager.h"
+
+#include "AudioCommon/AlsaSoundStream.h"
+#include "AudioCommon/AOSoundStream.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/CoreAudioSoundStream.h"
+#include "AudioCommon/DSoundStream.h"
+#include "AudioCommon/Mixer.h"
+#include "AudioCommon/NullSoundStream.h"
+#include "AudioCommon/OpenALStream.h"
+#include "AudioCommon/OpenSLESStream.h"
+#include "AudioCommon/PulseAudioStream.h"
+#include "AudioCommon/XAudio2_7Stream.h"
+#include "AudioCommon/XAudio2Stream.h"
+
+#include "Common/FileUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Movie.h"
// This shouldn't be a global, at least not here.
SoundStream *soundStream = nullptr;
diff --git a/Source/Core/AudioCommon/AudioCommon.h b/Source/Core/AudioCommon/AudioCommon.h
index f1aece0..054c0fe 100644
--- a/Source/Core/AudioCommon/AudioCommon.h
+++ b/Source/Core/AudioCommon/AudioCommon.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "SoundStream.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Common.h"
class CMixer;
diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
index 967eaa4..a46edbb 100644
--- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
+++ b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
@@ -4,7 +4,7 @@
#include <CoreServices/CoreServices.h>
-#include "CoreAudioSoundStream.h"
+#include "AudioCommon/CoreAudioSoundStream.h"
OSStatus CoreAudioSound::callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.h b/Source/Core/AudioCommon/CoreAudioSoundStream.h
index 5ebbbb9..4df7c60 100644
--- a/Source/Core/AudioCommon/CoreAudioSoundStream.h
+++ b/Source/Core/AudioCommon/CoreAudioSoundStream.h
@@ -8,7 +8,7 @@
#include <AudioUnit/AudioUnit.h>
#endif
-#include "SoundStream.h"
+#include "AudioCommon/SoundStream.h"
class CoreAudioSound : public SoundStream
{
diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp
index 399541c..418239f 100644
--- a/Source/Core/AudioCommon/DPL2Decoder.cpp
+++ b/Source/Core/AudioCommon/DPL2Decoder.cpp
@@ -7,13 +7,14 @@
// * Copyright (c) 2004-2006 Milan Cutka
// * based on mplayer HRTF plugin by ylai
+#include <cmath>
+#include <cstdlib>
#include <functional>
-#include <vector>
-#include <math.h>
-#include <stdlib.h>
#include <string.h>
-#include "DPL2Decoder.h"
-#include "MathUtil.h"
+#include <vector>
+
+#include "AudioCommon/DPL2Decoder.h"
+#include "Common/MathUtil.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
diff --git a/Source/Core/AudioCommon/DSoundStream.cpp b/Source/Core/AudioCommon/DSoundStream.cpp
index c5d2e3a..76eb404 100644
--- a/Source/Core/AudioCommon/DSoundStream.cpp
+++ b/Source/Core/AudioCommon/DSoundStream.cpp
@@ -7,8 +7,8 @@
#include <windows.h>
-#include "AudioCommon.h"
-#include "DSoundStream.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/DSoundStream.h"
bool DSound::CreateBuffer()
{
diff --git a/Source/Core/AudioCommon/DSoundStream.h b/Source/Core/AudioCommon/DSoundStream.h
index def27ba..b79cb0d 100644
--- a/Source/Core/AudioCommon/DSoundStream.h
+++ b/Source/Core/AudioCommon/DSoundStream.h
@@ -4,8 +4,8 @@
#pragma once
-#include "SoundStream.h"
-#include "Thread.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
#ifdef _WIN32
#include <Windows.h>
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp
index 788a3a2..15a7b4d 100644
--- a/Source/Core/AudioCommon/Mixer.cpp
+++ b/Source/Core/AudioCommon/Mixer.cpp
@@ -2,23 +2,24 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Atomic.h"
-#include "Mixer.h"
-#include "AudioCommon.h"
-#include "CPUDetect.h"
-#include "../Core/Host.h"
-
-#include "../Core/HW/AudioInterface.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/Mixer.h"
+#include "Common/Atomic.h"
+#include "Common/CPUDetect.h"
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/VideoInterface.h"
// UGLINESS
-#include "../Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PowerPC.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
#endif
// Executed from sound stream thread
-unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
+unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_framelimit)
{
if (!samples)
return 0;
@@ -32,16 +33,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
return numSamples;
}
- unsigned int numLeft = GetNumSamples();
- if (m_AIplaying) {
- if (numLeft < numSamples)//cannot do much about this
- m_AIplaying = false;
- if (numLeft < MAX_SAMPLES/4)//low watermark
- m_AIplaying = false;
- } else {
- if (numLeft > MAX_SAMPLES/2)//high watermark
- m_AIplaying = true;
- }
+ unsigned int currentSample = 0;
// Cache access in non-volatile variable
// This is the only function changing the read value, so it's safe to
@@ -53,100 +45,68 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
u32 indexR = Common::AtomicLoad(m_indexR);
u32 indexW = Common::AtomicLoad(m_indexW);
- if (m_AIplaying) {
- numLeft = (numLeft > numSamples) ? numSamples : numLeft;
+ float numLeft = ((indexW - indexR) & INDEX_MASK) / 2;
+ m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG;
+ float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR;
+ if(offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
+ if(offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
- if (AudioInterface::GetAIDSampleRate() == m_sampleRate) // (1:1)
- {
-#if _M_SSE >= 0x301
- if (cpu_info.bSSSE3 && !((numLeft * 2) % 8))
- {
- static const __m128i sr_mask =
- _mm_set_epi32(0x0C0D0E0FL, 0x08090A0BL,
- 0x04050607L, 0x00010203L);
-
- for (unsigned int i = 0; i < numLeft * 2; i += 8)
- {
- _mm_storeu_si128((__m128i *)&samples[i], _mm_shuffle_epi8(_mm_loadu_si128((__m128i *)&m_buffer[(indexR + i) & INDEX_MASK]), sr_mask));
- }
- }
- else
-#endif
- {
- for (unsigned int i = 0; i < numLeft * 2; i+=2)
- {
- samples[i] = Common::swap16(m_buffer[(indexR + i + 1) & INDEX_MASK]);
- samples[i+1] = Common::swap16(m_buffer[(indexR + i) & INDEX_MASK]);
- }
- }
- indexR += numLeft * 2;
- }
- else //linear interpolation
- {
- //render numleft sample pairs to samples[]
- //advance indexR with sample position
- //remember fractional offset
-
- static u32 frac = 0;
- const u32 ratio = (u32)( 65536.0f * (float)AudioInterface::GetAIDSampleRate() / (float)m_sampleRate );
-
- for (u32 i = 0; i < numLeft * 2; i+=2) {
- u32 indexR2 = indexR + 2; //next sample
- if ((indexR2 & INDEX_MASK) == (indexW & INDEX_MASK)) //..if it exists
- indexR2 = indexR;
-
- s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current
- s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); //next
- int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
- samples[i+1] = sampleL;
-
- s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current
- s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next
- int sampleR = ((r1 << 16) + (r2 - r1) * (u16)frac) >> 16;
- samples[i] = sampleR;
-
- frac += ratio;
- indexR += 2 * (u16)(frac >> 16);
- frac &= 0xffff;
- }
- }
+ //render numleft sample pairs to samples[]
+ //advance indexR with sample position
+ //remember fractional offset
+
+ u32 framelimit = SConfig::GetInstance().m_Framelimit;
+ float aid_sample_rate = AudioInterface::GetAIDSampleRate() + offset;
+ if (consider_framelimit && framelimit > 2)
+ {
+ aid_sample_rate = aid_sample_rate * (framelimit - 1) * 5 / VideoInterface::TargetRefreshRate;
+ }
+
+ static u32 frac = 0;
+ const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate );
+
+ if(ratio > 0x10000)
+ ERROR_LOG(AUDIO, "ratio out of range");
+
+ for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) {
+ u32 indexR2 = indexR + 2; //next sample
- } else {
- numLeft = 0;
+ s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current
+ s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); //next
+ int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
+ samples[currentSample+1] = sampleL;
+
+ s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current
+ s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next
+ int sampleR = ((r1 << 16) + (r2 - r1) * (u16)frac) >> 16;
+ samples[currentSample] = sampleR;
+
+ frac += ratio;
+ indexR += 2 * (u16)(frac >> 16);
+ frac &= 0xffff;
}
// Padding
- if (numSamples > numLeft)
+ unsigned short s[2];
+ s[0] = Common::swap16(m_buffer[(indexR - 1) & INDEX_MASK]);
+ s[1] = Common::swap16(m_buffer[(indexR - 2) & INDEX_MASK]);
+ for (; currentSample < numSamples*2; currentSample+=2)
{
- unsigned short s[2];
- s[0] = Common::swap16(m_buffer[(indexR - 1) & INDEX_MASK]);
- s[1] = Common::swap16(m_buffer[(indexR - 2) & INDEX_MASK]);
- for (unsigned int i = numLeft*2; i < numSamples*2; i+=2)
- *(u32*)(samples+i) = *(u32*)(s);
-// memset(&samples[numLeft * 2], 0, (numSamples - numLeft) * 4);
+ samples[currentSample] = s[0];
+ samples[currentSample+1] = s[1];
}
// Flush cached variable
Common::AtomicStore(m_indexR, indexR);
- //when logging, also throttle HLE audio
- if (m_logAudio) {
- if (m_AIplaying) {
- Premix(samples, numLeft);
+ // Add the DSPHLE sound, re-sampling is done inside
+ Premix(samples, numSamples);
- AudioInterface::Callback_GetStreaming(samples, numLeft, m_sampleRate);
-
- g_wave_writer.AddStereoSamples(samples, numLeft);
- }
- }
- else { //or mix as usual
- // Add the DSPHLE sound, re-sampling is done inside
- Premix(samples, numSamples);
-
- // Add the DTK Music
- // Re-sampling is done inside
- AudioInterface::Callback_GetStreaming(samples, numSamples, m_sampleRate);
- }
+ // Add the DTK Music
+ // Re-sampling is done inside
+ AudioInterface::Callback_GetStreaming(samples, numSamples, m_sampleRate);
+ if (m_logAudio)
+ g_wave_writer.AddStereoSamples(samples, numSamples);
return numSamples;
}
@@ -198,24 +158,3 @@ void CMixer::PushSamples(const short *samples, unsigned int num_samples)
return;
}
-unsigned int CMixer::GetNumSamples()
-{
- // Guess how many samples would be available after interpolation.
- // As interpolation needs at least on sample from the future to
- // linear interpolate between them, one sample less is available.
- // We also can't say the current interpolation state (specially
- // the frac), so to be sure, subtract one again to be sure not
- // to underflow the fifo.
-
- u32 numSamples = ((Common::AtomicLoad(m_indexW) - Common::AtomicLoad(m_indexR)) & INDEX_MASK) / 2;
-
- if (AudioInterface::GetAIDSampleRate() == m_sampleRate)
- ; //numSamples = numSamples; // 1:1
- else if (m_sampleRate == 48000 && AudioInterface::GetAIDSampleRate() == 32000)
- numSamples = numSamples * 3 / 2 - 2; // most common case
- else
- numSamples = numSamples * m_sampleRate / AudioInterface::GetAIDSampleRate() - 2;
-
- return numSamples;
-}
-
diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h
index 6b2c4b9..2fb2d29 100644
--- a/Source/Core/AudioCommon/Mixer.h
+++ b/Source/Core/AudioCommon/Mixer.h
@@ -4,13 +4,17 @@
#pragma once
-#include "WaveFile.h"
-#include "StdMutex.h"
+#include "AudioCommon/WaveFile.h"
+#include "Common/StdMutex.h"
// 16 bit Stereo
-#define MAX_SAMPLES (1024 * 8)
-#define INDEX_MASK (MAX_SAMPLES * 2 - 1)
-#define RESERVED_SAMPLES (256)
+#define MAX_SAMPLES (1024 * 2) // 64ms
+#define INDEX_MASK (MAX_SAMPLES * 2 - 1)
+
+#define LOW_WATERMARK 1280 // 40 ms
+#define MAX_FREQ_SHIFT 200 // per 32000 Hz
+#define CONTROL_FACTOR 0.2 // in freq_shift per fifo size offset
+#define CONTROL_AVG 32
class CMixer {
@@ -24,7 +28,7 @@ public:
, m_logAudio(0)
, m_indexW(0)
, m_indexR(0)
- , m_AIplaying(true)
+ , m_numLeftI(0.0f)
{
// AyuanX: The internal (Core & DSP) sample rate is fixed at 32KHz
// So when AI/DAC sample rate differs than 32KHz, we have to do re-sampling
@@ -38,9 +42,8 @@ public:
virtual ~CMixer() {}
// Called from audio threads
- virtual unsigned int Mix(short* samples, unsigned int numSamples);
+ virtual unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true);
virtual void Premix(short * /*samples*/, unsigned int /*numSamples*/) {}
- unsigned int GetNumSamples();
// Called from main thread
virtual void PushSamples(const short* samples, unsigned int num_samples);
@@ -98,8 +101,8 @@ protected:
volatile u32 m_indexW;
volatile u32 m_indexR;
- bool m_AIplaying;
std::mutex m_csMixing;
+ float m_numLeftI;
volatile float m_speed; // Current rate of the emulation (1.0 = 100% speed)
private:
diff --git a/Source/Core/AudioCommon/NullSoundStream.cpp b/Source/Core/AudioCommon/NullSoundStream.cpp
index 99bf8aa..fcd577f 100644
--- a/Source/Core/AudioCommon/NullSoundStream.cpp
+++ b/Source/Core/AudioCommon/NullSoundStream.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "NullSoundStream.h"
-#include "../Core/HW/SystemTimers.h"
-#include "../Core/HW/AudioInterface.h"
+#include "AudioCommon/NullSoundStream.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/SystemTimers.h"
void NullSound::SoundLoop()
{
diff --git a/Source/Core/AudioCommon/NullSoundStream.h b/Source/Core/AudioCommon/NullSoundStream.h
index bcc96a9..4b971c9 100644
--- a/Source/Core/AudioCommon/NullSoundStream.h
+++ b/Source/Core/AudioCommon/NullSoundStream.h
@@ -4,8 +4,8 @@
#pragma once
-#include <stdlib.h>
-#include "SoundStream.h"
+#include <cstdlib>
+#include "AudioCommon/SoundStream.h"
#define BUF_SIZE (48000 * 4 / 32)
diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp
index ce59dc6..46f7cc3 100644
--- a/Source/Core/AudioCommon/OpenALStream.cpp
+++ b/Source/Core/AudioCommon/OpenALStream.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "aldlist.h"
-#include "OpenALStream.h"
-#include "DPL2Decoder.h"
+#include "AudioCommon/aldlist.h"
+#include "AudioCommon/DPL2Decoder.h"
+#include "AudioCommon/OpenALStream.h"
#if defined HAVE_OPENAL && HAVE_OPENAL
@@ -192,7 +192,7 @@ void OpenALStream::SoundLoop()
unsigned int minSamples = surround_capable ? 240 : 0; // DPL2 accepts 240 samples minimum (FWRDURATION)
numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples;
- numSamples = m_mixer->Mix(realtimeBuffer, numSamples);
+ numSamples = m_mixer->Mix(realtimeBuffer, numSamples, false);
// Convert the samples from short to float
float dest[OAL_MAX_SAMPLES * STEREO_CHANNELS];
diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h
index 2667f90..1317a61 100644
--- a/Source/Core/AudioCommon/OpenALStream.h
+++ b/Source/Core/AudioCommon/OpenALStream.h
@@ -4,8 +4,11 @@
#pragma once
-#include "SoundStream.h"
-#include "Thread.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
+#include "Core/Core.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/SystemTimers.h"
#if defined HAVE_OPENAL && HAVE_OPENAL
#ifdef _WIN32
@@ -21,23 +24,20 @@
#include <AL/alext.h>
#endif
-#include "Core.h"
-#include "HW/SystemTimers.h"
-#include "HW/AudioInterface.h"
#include <soundtouch/SoundTouch.h>
#include <soundtouch/STTypes.h>
// 16 bit Stereo
-#define SFX_MAX_SOURCE 1
-#define OAL_MAX_BUFFERS 32
-#define OAL_MAX_SAMPLES 256
-#define STEREO_CHANNELS 2
-#define SURROUND_CHANNELS 6 // number of channels in surround mode
-#define SIZE_SHORT 2
-#define SIZE_FLOAT 4 // size of a float in bytes
-#define FRAME_STEREO_SHORT STEREO_CHANNELS * SIZE_SHORT
-#define FRAME_STEREO_FLOAT STEREO_CHANNELS * SIZE_FLOAT
-#define FRAME_SURROUND_FLOAT SURROUND_CHANNELS * SIZE_FLOAT
+#define SFX_MAX_SOURCE 1
+#define OAL_MAX_BUFFERS 32
+#define OAL_MAX_SAMPLES 256
+#define STEREO_CHANNELS 2
+#define SURROUND_CHANNELS 6 // number of channels in surround mode
+#define SIZE_SHORT 2
+#define SIZE_FLOAT 4 // size of a float in bytes
+#define FRAME_STEREO_SHORT STEREO_CHANNELS * SIZE_SHORT
+#define FRAME_STEREO_FLOAT STEREO_CHANNELS * SIZE_FLOAT
+#define FRAME_SURROUND_FLOAT SURROUND_CHANNELS * SIZE_FLOAT
#endif
class OpenALStream: public SoundStream
diff --git a/Source/Core/AudioCommon/OpenSLESStream.cpp b/Source/Core/AudioCommon/OpenSLESStream.cpp
index 67e77a4..847fcdf 100644
--- a/Source/Core/AudioCommon/OpenSLESStream.cpp
+++ b/Source/Core/AudioCommon/OpenSLESStream.cpp
@@ -3,13 +3,14 @@
// Refer to the license.txt file included.
#ifdef ANDROID
-#include "Common.h"
#include <assert.h>
-#include "OpenSLESStream.h"
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
+#include "AudioCommon/OpenSLESStream.h"
+#include "Common/Common.h"
+
// engine interfaces
static SLObjectItf engineObject;
static SLEngineItf engineEngine;
@@ -44,7 +45,7 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) {
_assert_msg_(AUDIO, SL_RESULT_SUCCESS == result, "Couldn't enqueue audio stream.");
- curBuffer ^= 1; // Switch buffer
+ curBuffer ^= 1; // Switch buffer
// Render to the fresh buffer
g_mixer->Mix(reinterpret_cast<short *>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES);
}
diff --git a/Source/Core/AudioCommon/OpenSLESStream.h b/Source/Core/AudioCommon/OpenSLESStream.h
index a75aab5..dcc94cd 100644
--- a/Source/Core/AudioCommon/OpenSLESStream.h
+++ b/Source/Core/AudioCommon/OpenSLESStream.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Thread.h"
-#include "SoundStream.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
class OpenSLESStream : public SoundStream
{
diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp
index fe68d0e..647798c 100644
--- a/Source/Core/AudioCommon/PulseAudioStream.cpp
+++ b/Source/Core/AudioCommon/PulseAudioStream.cpp
@@ -4,10 +4,9 @@
#include <functional>
-#include "Common.h"
-#include "Thread.h"
-
-#include "PulseAudioStream.h"
+#include "AudioCommon/PulseAudioStream.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
namespace
{
diff --git a/Source/Core/AudioCommon/PulseAudioStream.h b/Source/Core/AudioCommon/PulseAudioStream.h
index c9ccfb8..732772a 100644
--- a/Source/Core/AudioCommon/PulseAudioStream.h
+++ b/Source/Core/AudioCommon/PulseAudioStream.h
@@ -10,10 +10,9 @@
#include <atomic>
-#include "Common.h"
-#include "SoundStream.h"
-
-#include "Thread.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
class PulseAudio : public SoundStream
{
diff --git a/Source/Core/AudioCommon/SoundStream.h b/Source/Core/AudioCommon/SoundStream.h
index dd130e8..0e4736d 100644
--- a/Source/Core/AudioCommon/SoundStream.h
+++ b/Source/Core/AudioCommon/SoundStream.h
@@ -4,9 +4,9 @@
#pragma once
-#include "Common.h"
-#include "Mixer.h"
-#include "WaveFile.h"
+#include "AudioCommon/Mixer.h"
+#include "AudioCommon/WaveFile.h"
+#include "Common/Common.h"
class SoundStream
{
diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp
index f73b484..776d0d6 100644
--- a/Source/Core/AudioCommon/WaveFile.cpp
+++ b/Source/Core/AudioCommon/WaveFile.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "WaveFile.h"
-#include "../Core/ConfigManager.h"
+#include "AudioCommon/WaveFile.h"
+#include "Common/Common.h"
+#include "Core/ConfigManager.h"
enum {BUF_SIZE = 32*1024};
diff --git a/Source/Core/AudioCommon/WaveFile.h b/Source/Core/AudioCommon/WaveFile.h
index e96f64a..baa7b04 100644
--- a/Source/Core/AudioCommon/WaveFile.h
+++ b/Source/Core/AudioCommon/WaveFile.h
@@ -14,7 +14,7 @@
#pragma once
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
class WaveFileWriter
{
diff --git a/Source/Core/AudioCommon/XAudio2Stream.cpp b/Source/Core/AudioCommon/XAudio2Stream.cpp
index 8c8a225..117484c 100644
--- a/Source/Core/AudioCommon/XAudio2Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2Stream.cpp
@@ -3,8 +3,8 @@
// Refer to the license.txt file included.
#include <xaudio2.h>
-#include "AudioCommon.h"
-#include "XAudio2Stream.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/XAudio2Stream.h"
#ifndef XAUDIO2_DLL
#error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path.
@@ -62,16 +62,16 @@ StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer,
{
WAVEFORMATEXTENSIBLE wfx = {};
- wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
- wfx.Format.nChannels = 2;
- wfx.Format.wBitsPerSample = 16;
- wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
- wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
- wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+ wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
+ wfx.Format.nChannels = 2;
+ wfx.Format.wBitsPerSample = 16;
+ wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
+ wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
+ wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16;
- wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
+ wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
// create source voice
HRESULT hr;
@@ -217,11 +217,11 @@ void XAudio2::Update()
//static int xi = 0;
//if (100000 == ++xi)
//{
- // xi = 0;
- // XAUDIO2_PERFORMANCE_DATA perfData;
- // pXAudio2->GetPerformanceData(&perfData);
- // NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
- // NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
+ // xi = 0;
+ // XAUDIO2_PERFORMANCE_DATA perfData;
+ // pXAudio2->GetPerformanceData(&perfData);
+ // NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
+ // NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
//}
}
@@ -250,7 +250,7 @@ void XAudio2::Stop()
m_mastering_voice = nullptr;
}
- m_xaudio2.reset(); // release interface
+ m_xaudio2.reset(); // release interface
if (m_xaudio2_dll)
{
diff --git a/Source/Core/AudioCommon/XAudio2Stream.h b/Source/Core/AudioCommon/XAudio2Stream.h
index d85aafc..de38c87 100644
--- a/Source/Core/AudioCommon/XAudio2Stream.h
+++ b/Source/Core/AudioCommon/XAudio2Stream.h
@@ -9,8 +9,9 @@
#pragma once
#include <memory>
-#include "Thread.h"
-#include "SoundStream.h"
+
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
#ifdef _WIN32
diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.cpp b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
index 782a29a..3a98dc0 100644
--- a/Source/Core/AudioCommon/XAudio2_7Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
@@ -7,8 +7,8 @@
// instead of other possible places. This may be accomplished by adding the path to
// the AdditionalIncludeDirectories for this file via msbuild.
-#include "AudioCommon.h"
-#include "XAudio2_7Stream.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/XAudio2_7Stream.h"
#ifdef HAVE_DXSDK
#include <dxsdkver.h>
@@ -75,16 +75,16 @@ StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *p
{
WAVEFORMATEXTENSIBLE wfx = {};
- wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
- wfx.Format.nChannels = 2;
- wfx.Format.wBitsPerSample = 16;
- wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
- wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
- wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+ wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
+ wfx.Format.nChannels = 2;
+ wfx.Format.wBitsPerSample = 16;
+ wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
+ wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
+ wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16;
- wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
+ wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
// create source voice
HRESULT hr;
@@ -218,11 +218,11 @@ void XAudio2_7::Update()
//static int xi = 0;
//if (100000 == ++xi)
//{
- // xi = 0;
- // XAUDIO2_PERFORMANCE_DATA perfData;
- // pXAudio2->GetPerformanceData(&perfData);
- // NOTICE_LOG(DSPHLE, "XAudio2_7 latency (samples): %i", perfData.CurrentLatencyInSamples);
- // NOTICE_LOG(DSPHLE, "XAudio2_7 total glitches: %i", perfData.GlitchesSinceEngineStarted);
+ // xi = 0;
+ // XAUDIO2_PERFORMANCE_DATA perfData;
+ // pXAudio2->GetPerformanceData(&perfData);
+ // NOTICE_LOG(DSPHLE, "XAudio2_7 latency (samples): %i", perfData.CurrentLatencyInSamples);
+ // NOTICE_LOG(DSPHLE, "XAudio2_7 total glitches: %i", perfData.GlitchesSinceEngineStarted);
//}
}
@@ -251,7 +251,7 @@ void XAudio2_7::Stop()
m_mastering_voice = nullptr;
}
- m_xaudio2.reset(); // release interface
+ m_xaudio2.reset(); // release interface
if (m_xaudio2_dll)
{
diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.h b/Source/Core/AudioCommon/XAudio2_7Stream.h
index bbea6dd..ce0806a 100644
--- a/Source/Core/AudioCommon/XAudio2_7Stream.h
+++ b/Source/Core/AudioCommon/XAudio2_7Stream.h
@@ -13,8 +13,8 @@
#pragma once
#include <memory>
-#include "Thread.h"
-#include "SoundStream.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
#ifdef _WIN32
diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp
index 7499ae1..644e728 100644
--- a/Source/Core/AudioCommon/aldlist.cpp
+++ b/Source/Core/AudioCommon/aldlist.cpp
@@ -22,8 +22,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "Common.h"
-#include "aldlist.h"
+#include "AudioCommon/aldlist.h"
+#include "Common/Common.h"
#ifdef _WIN32
#include "../../../Externals/OpenAL/include/al.h"
#include "../../../Externals/OpenAL/include/alc.h"
@@ -41,7 +41,7 @@
*/
ALDeviceList::ALDeviceList()
{
- ALDEVICEINFO ALDeviceInfo;
+ ALDEVICEINFO ALDeviceInfo;
char *devices;
s32 index;
const char *defaultDeviceName = NULL;
diff --git a/Source/Core/AudioCommon/aldlist.h b/Source/Core/AudioCommon/aldlist.h
index 29d742a..fabe435 100644
--- a/Source/Core/AudioCommon/aldlist.h
+++ b/Source/Core/AudioCommon/aldlist.h
@@ -1,23 +1,25 @@
#pragma once
-#include "CommonTypes.h"
+#include <string>
+#include <vector>
+
+#include "Common/CommonTypes.h"
+
#ifdef _WIN32
#pragma warning(disable: 4786) //disable warning "identifier was truncated to
//'255' characters in the browser information"
#endif
-#include <vector>
-#include <string>
using namespace std;
typedef struct
{
- string strDeviceName;
- s32 iMajorVersion;
- s32 iMinorVersion;
- u32 uiSourceCount;
- vector<string> *pvstrExtensions;
- bool bSelected;
+ string strDeviceName;
+ s32 iMajorVersion;
+ s32 iMinorVersion;
+ u32 uiSourceCount;
+ vector<string>* pvstrExtensions;
+ bool bSelected;
} ALDEVICEINFO, *LPALDEVICEINFO;
class ALDeviceList
diff --git a/Source/Core/AudioCommon/stdafx.cpp b/Source/Core/AudioCommon/stdafx.cpp
index b602b39..0ec820a 100644
--- a/Source/Core/AudioCommon/stdafx.cpp
+++ b/Source/Core/AudioCommon/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "AudioCommon/stdafx.h"
diff --git a/Source/Core/AudioCommon/stdafx.h b/Source/Core/AudioCommon/stdafx.h
index 9cd4195..e28b312 100644
--- a/Source/Core/AudioCommon/stdafx.h
+++ b/Source/Core/AudioCommon/stdafx.h
@@ -11,7 +11,7 @@
#define _WIN32_WINNT 0x602
#endif
*/
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <algorithm>
#include <functional>
diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp
index 0c9a8c6..65353ba 100644
--- a/Source/Core/Common/ArmCPUDetect.cpp
+++ b/Source/Core/Common/ArmCPUDetect.cpp
@@ -1,23 +1,10 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-#include "CPUDetect.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/FileUtil.h"
// Only Linux platforms have /proc/cpuinfo
#if !defined(BLACKBERRY) && !defined(IOS) && !defined(__SYMBIAN32__)
diff --git a/Source/Core/Common/ArmEmitter.cpp b/Source/Core/Common/ArmEmitter.cpp
index 00b6460..d35f7f6 100644
--- a/Source/Core/Common/ArmEmitter.cpp
+++ b/Source/Core/Common/ArmEmitter.cpp
@@ -1,27 +1,14 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-#include "ArmEmitter.h"
-#include "CPUDetect.h"
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <assert.h>
#include <stdarg.h>
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+
// For cache flushing on Symbian/iOS/Blackberry
#ifdef __SYMBIAN32__
#include <e32std.h>
@@ -412,7 +399,7 @@ FixupBranch ARMXEmitter::BL_CC(CCFlags Cond)
void ARMXEmitter::SetJumpTarget(FixupBranch const &branch)
{
s32 distance = (s32(code) - 8) - (s32)branch.ptr;
- _dbg_assert_msg_(DYNA_REC, distance > -33554432
+ _dbg_assert_msg_(DYNA_REC, distance > -33554432
&& distance <= 33554432,
"SetJumpTarget out of range (%p calls %p)", code,
branch.ptr);
@@ -420,13 +407,13 @@ void ARMXEmitter::SetJumpTarget(FixupBranch const &branch)
*(u32*)branch.ptr = (u32)(branch.condition | (10 << 24) | ((distance >> 2) &
0x00FFFFFF));
else // BL
- *(u32*)branch.ptr = (u32)(branch.condition | 0x0B000000 | ((distance >> 2)
+ *(u32*)branch.ptr = (u32)(branch.condition | 0x0B000000 | ((distance >> 2)
& 0x00FFFFFF));
}
void ARMXEmitter::B (const void *fnptr)
{
s32 distance = (s32)fnptr - (s32(code) + 8);
- _dbg_assert_msg_(DYNA_REC, distance > -33554432
+ _dbg_assert_msg_(DYNA_REC, distance > -33554432
&& distance <= 33554432,
"B out of range (%p calls %p)", code, fnptr);
@@ -553,19 +540,19 @@ void ARMXEmitter::SBC (ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(6,
void ARMXEmitter::SBCS(ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(6, Rd, Rn, Rm, true); }
void ARMXEmitter::RSC (ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(7, Rd, Rn, Rm); }
void ARMXEmitter::RSCS(ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(7, Rd, Rn, Rm, true); }
-void ARMXEmitter::TST ( ARMReg Rn, Operand2 Rm) { WriteInstruction(8, R0, Rn, Rm, true); }
-void ARMXEmitter::TEQ ( ARMReg Rn, Operand2 Rm) { WriteInstruction(9, R0, Rn, Rm, true); }
-void ARMXEmitter::CMP ( ARMReg Rn, Operand2 Rm) { WriteInstruction(10, R0, Rn, Rm, true); }
-void ARMXEmitter::CMN ( ARMReg Rn, Operand2 Rm) { WriteInstruction(11, R0, Rn, Rm, true); }
+void ARMXEmitter::TST ( ARMReg Rn, Operand2 Rm) { WriteInstruction(8, R0, Rn, Rm, true); }
+void ARMXEmitter::TEQ ( ARMReg Rn, Operand2 Rm) { WriteInstruction(9, R0, Rn, Rm, true); }
+void ARMXEmitter::CMP ( ARMReg Rn, Operand2 Rm) { WriteInstruction(10, R0, Rn, Rm, true); }
+void ARMXEmitter::CMN ( ARMReg Rn, Operand2 Rm) { WriteInstruction(11, R0, Rn, Rm, true); }
void ARMXEmitter::ORR (ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(12, Rd, Rn, Rm); }
void ARMXEmitter::ORRS(ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(12, Rd, Rn, Rm, true); }
-void ARMXEmitter::MOV (ARMReg Rd, Operand2 Rm) { WriteInstruction(13, Rd, R0, Rm); }
-void ARMXEmitter::MOVS(ARMReg Rd, Operand2 Rm) { WriteInstruction(13, Rd, R0, Rm, true); }
+void ARMXEmitter::MOV (ARMReg Rd, Operand2 Rm) { WriteInstruction(13, Rd, R0, Rm); }
+void ARMXEmitter::MOVS(ARMReg Rd, Operand2 Rm) { WriteInstruction(13, Rd, R0, Rm, true); }
void ARMXEmitter::BIC (ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(14, Rd, Rn, Rm); }
void ARMXEmitter::BICS(ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(14, Rd, Rn, Rm, true); }
-void ARMXEmitter::MVN (ARMReg Rd, Operand2 Rm) { WriteInstruction(15, Rd, R0, Rm); }
-void ARMXEmitter::MVNS(ARMReg Rd, Operand2 Rm) { WriteInstruction(15, Rd, R0, Rm, true); }
-void ARMXEmitter::MOVW(ARMReg Rd, Operand2 Rm) { WriteInstruction(16, Rd, R0, Rm); }
+void ARMXEmitter::MVN (ARMReg Rd, Operand2 Rm) { WriteInstruction(15, Rd, R0, Rm); }
+void ARMXEmitter::MVNS(ARMReg Rd, Operand2 Rm) { WriteInstruction(15, Rd, R0, Rm, true); }
+void ARMXEmitter::MOVW(ARMReg Rd, Operand2 Rm) { WriteInstruction(16, Rd, R0, Rm); }
void ARMXEmitter::MOVT(ARMReg Rd, Operand2 Rm, bool TopBits) { WriteInstruction(17, Rd, R0, TopBits ? Rm.Value >> 16 : Rm); }
void ARMXEmitter::WriteInstruction (u32 Op, ARMReg Rd, ARMReg Rn, Operand2 Rm, bool SetFlags) // This can get renamed later
@@ -614,11 +601,11 @@ void ARMXEmitter::LSRS(ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedData
void ARMXEmitter::ASR (ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedDataOp(4, false, dest, src, op2);}
void ARMXEmitter::ASRS(ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedDataOp(4, true, dest, src, op2);}
-void ARMXEmitter::MUL (ARMReg dest, ARMReg src, ARMReg op2)
+void ARMXEmitter::MUL (ARMReg dest, ARMReg src, ARMReg op2)
{
Write32(condition | (dest << 16) | (src << 8) | (9 << 4) | op2);
}
-void ARMXEmitter::MULS(ARMReg dest, ARMReg src, ARMReg op2)
+void ARMXEmitter::MULS(ARMReg dest, ARMReg src, ARMReg op2)
{
Write32(condition | (1 << 20) | (dest << 16) | (src << 8) | (9 << 4) | op2);
}
@@ -697,11 +684,11 @@ void ARMXEmitter::REV16(ARMReg dest, ARMReg src)
Write32(condition | (0x6BF << 16) | (dest << 12) | (0xFB << 4) | src);
}
-void ARMXEmitter::_MSR (bool write_nzcvq, bool write_g, Operand2 op2)
+void ARMXEmitter::_MSR (bool write_nzcvq, bool write_g, Operand2 op2)
{
Write32(condition | (0x320F << 12) | (write_nzcvq << 19) | (write_g << 18) | op2.Imm12Mod());
}
-void ARMXEmitter::_MSR (bool write_nzcvq, bool write_g, ARMReg src)
+void ARMXEmitter::_MSR (bool write_nzcvq, bool write_g, ARMReg src)
{
Write32(condition | (0x120F << 12) | (write_nzcvq << 19) | (write_g << 18) | src);
}
diff --git a/Source/Core/Common/ArmEmitter.h b/Source/Core/Common/ArmEmitter.h
index 9c53cb6..837a931 100644
--- a/Source/Core/Common/ArmEmitter.h
+++ b/Source/Core/Common/ArmEmitter.h
@@ -1,4 +1,4 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
@@ -6,12 +6,14 @@
#pragma once
-#include "Common.h"
-#include "MemoryUtil.h"
+#include <vector>
+
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
+
#if defined(__SYMBIAN32__) || defined(PANDORA)
#include <signal.h>
#endif
-#include <vector>
#undef _IP
#undef R0
@@ -118,7 +120,7 @@ private:
OpType Type;
// IMM types
- u8 Rotation; // Only for u8 values
+ u8 Rotation; // Only for u8 values
// Register types
u8 IndexOrShift;
@@ -302,9 +304,9 @@ bool TryMakeOperand2_AllowNegation(s32 imm, Operand2 &op2, bool *negated);
// Use this only when you know imm can be made into an Operand2.
Operand2 AssumeMakeOperand2(u32 imm);
-inline Operand2 R(ARMReg Reg) { return Operand2(Reg, TYPE_REG); }
-inline Operand2 IMM(u32 Imm) { return Operand2(Imm, TYPE_IMM); }
-inline Operand2 Mem(void *ptr) { return Operand2((u32)ptr, TYPE_IMM); }
+inline Operand2 R(ARMReg Reg) { return Operand2(Reg, TYPE_REG); }
+inline Operand2 IMM(u32 Imm) { return Operand2(Imm, TYPE_IMM); }
+inline Operand2 Mem(void *ptr) { return Operand2((u32)ptr, TYPE_IMM); }
//usage: struct {int e;} s; STRUCT_OFFSET(s,e)
#define STRUCT_OFF(str,elem) ((u32)((u32)&(str).elem-(u32)&(str)))
@@ -474,8 +476,8 @@ public:
void UDIV(ARMReg dest, ARMReg dividend, ARMReg divisor);
void SDIV(ARMReg dest, ARMReg dividend, ARMReg divisor);
- void MUL (ARMReg dest, ARMReg src, ARMReg op2);
- void MULS(ARMReg dest, ARMReg src, ARMReg op2);
+ void MUL (ARMReg dest, ARMReg src, ARMReg op2);
+ void MULS(ARMReg dest, ARMReg src, ARMReg op2);
void UMULL(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
void UMULLS(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
@@ -599,7 +601,7 @@ private:
void VREVX(u32 size, u32 Size, ARMReg Vd, ARMReg Vm);
-public:
+public:
NEONXEmitter(ARMXEmitter *emit)
: _emit(emit)
{}
diff --git a/Source/Core/Common/Atomic.h b/Source/Core/Common/Atomic.h
index 7d2f920..88e38ed 100644
--- a/Source/Core/Common/Atomic.h
+++ b/Source/Core/Common/Atomic.h
@@ -6,11 +6,11 @@
#ifdef _WIN32
-#include "Atomic_Win32.h"
+#include "Common/Atomic_Win32.h"
#else
// GCC-compatible compiler assumed!
-#include "Atomic_GCC.h"
+#include "Common/Atomic_GCC.h"
#endif
diff --git a/Source/Core/Common/Atomic_GCC.h b/Source/Core/Common/Atomic_GCC.h
index e250efb..b6aef1a 100644
--- a/Source/Core/Common/Atomic_GCC.h
+++ b/Source/Core/Common/Atomic_GCC.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// Atomic operations are performed in a single step by the CPU. It is
// impossible for other threads to see the operation "half-done."
diff --git a/Source/Core/Common/Atomic_Win32.h b/Source/Core/Common/Atomic_Win32.h
index 5e52b0a..2615d94 100644
--- a/Source/Core/Common/Atomic_Win32.h
+++ b/Source/Core/Common/Atomic_Win32.h
@@ -4,10 +4,11 @@
#pragma once
-#include "Common.h"
#include <intrin.h>
#include <Windows.h>
+#include "Common/Common.h"
+
// Atomic operations are performed in a single step by the CPU. It is
// impossible for other threads to see the operation "half-done."
//
diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp
index bd96e2c..326f4df 100644
--- a/Source/Core/Common/BreakPoints.cpp
+++ b/Source/Core/Common/BreakPoints.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "DebugInterface.h"
-#include "BreakPoints.h"
-#include "../Core/PowerPC/JitCommon/JitBase.h"
-
#include <sstream>
+#include "Common/BreakPoints.h"
+#include "Common/Common.h"
+#include "Common/DebugInterface.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
{
for (const TBreakPoint& bp : m_BreakPoints)
@@ -132,11 +132,11 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
std::stringstream ss;
ss << std::hex << mcstr;
ss >> mc.StartAddress;
- mc.bRange = mcstr.find("n") != mcstr.npos;
- mc.OnRead = mcstr.find("r") != mcstr.npos;
- mc.OnWrite = mcstr.find("w") != mcstr.npos;
- mc.Log = mcstr.find("l") != mcstr.npos;
- mc.Break = mcstr.find("p") != mcstr.npos;
+ mc.bRange = mcstr.find("n") != mcstr.npos;
+ mc.OnRead = mcstr.find("r") != mcstr.npos;
+ mc.OnWrite = mcstr.find("w") != mcstr.npos;
+ mc.Log = mcstr.find("l") != mcstr.npos;
+ mc.Break = mcstr.find("p") != mcstr.npos;
if (mc.bRange)
ss >> mc.EndAddress;
else
diff --git a/Source/Core/Common/BreakPoints.h b/Source/Core/Common/BreakPoints.h
index 285e5cd..cecad0c 100644
--- a/Source/Core/Common/BreakPoints.h
+++ b/Source/Core/Common/BreakPoints.h
@@ -4,10 +4,10 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class DebugInterface;
diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp
index cd9d881..156b758 100644
--- a/Source/Core/Common/CDUtils.cpp
+++ b/Source/Core/Common/CDUtils.cpp
@@ -1,13 +1,13 @@
// Most of the code in this file was shamelessly ripped from libcdio With minor adjustments
-#include "CDUtils.h"
-#include "Common.h"
-#include "StringUtil.h"
-
#include <memory> // for std::unique_ptr
+
+#include "Common/CDUtils.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+
#ifdef _WIN32
#include <windows.h>
-#include "StringUtil.h"
#elif __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOBSD.h>
@@ -47,7 +47,7 @@ std::vector<std::string> cdio_get_devices()
if (is_cdrom(drive))
{
std::string str(TStrToUTF8(drive));
- str.pop_back(); // we don't want the final backslash
+ str.pop_back(); // we don't want the final backslash
drives.push_back(std::move(str));
}
diff --git a/Source/Core/Common/CDUtils.h b/Source/Core/Common/CDUtils.h
index 19ca22d..576922e 100644
--- a/Source/Core/Common/CDUtils.h
+++ b/Source/Core/Common/CDUtils.h
@@ -1,7 +1,7 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
// Returns a pointer to an array of strings with the device names
std::vector<std::string> cdio_get_devices();
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt
index 4614c7d..21f894c 100644
--- a/Source/Core/Common/CMakeLists.txt
+++ b/Source/Core/Common/CMakeLists.txt
@@ -1,7 +1,6 @@
set(SRCS BreakPoints.cpp
CDUtils.cpp
ColorUtil.cpp
- ConsoleListener.cpp
FileSearch.cpp
FileUtil.cpp
Hash.cpp
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h
index 10ec036..fe33d6c 100644
--- a/Source/Core/Common/ChunkFile.h
+++ b/Source/Core/Common/ChunkFile.h
@@ -13,16 +13,16 @@
// - Zero backwards/forwards compatibility
// - Serialization code for anything complex has to be manually written.
+#include <deque>
+#include <list>
#include <map>
#include <set>
-#include <vector>
-#include <list>
-#include <deque>
#include <string>
#include <type_traits>
+#include <vector>
-#include "Common.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
// ewww
#if _LIBCPP_VERSION
diff --git a/Source/Core/Common/ColorUtil.cpp b/Source/Core/Common/ColorUtil.cpp
index b23da3a..0930668 100644
--- a/Source/Core/Common/ColorUtil.cpp
+++ b/Source/Core/Common/ColorUtil.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ColorUtil.h"
+#include "Common/ColorUtil.h"
+#include "Common/Common.h"
namespace ColorUtil
{
diff --git a/Source/Core/Common/ColorUtil.h b/Source/Core/Common/ColorUtil.h
index bf4979e..042e55d 100644
--- a/Source/Core/Common/ColorUtil.h
+++ b/Source/Core/Common/ColorUtil.h
@@ -4,6 +4,8 @@
#pragma once
+#include "Common/CommonTypes.h"
+
namespace ColorUtil
{
diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h
index fc326e2..b5d78ba 100644
--- a/Source/Core/Common/Common.h
+++ b/Source/Core/Common/Common.h
@@ -7,9 +7,9 @@
// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
// since it slows down the build a lot.
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
// SVN version number
extern const char *scm_desc_str;
@@ -45,10 +45,6 @@ private:
};
#endif
-#include "Log.h"
-#include "CommonTypes.h"
-#include "MsgHandler.h"
-
#ifdef __APPLE__
// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries.
// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes.
@@ -172,4 +168,7 @@ enum EMUSTATE_CHANGE
EMUSTATE_CHANGE_STOP
};
-#include "CommonFuncs.h"
+#include "Common/CommonTypes.h"
+#include "Common/CommonFuncs.h" // NOLINT: needs to be included after CommonTypes
+#include "Common/Log.h"
+#include "Common/MsgHandler.h"
diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj
index 87865d5..1cd3454 100644
--- a/Source/Core/Common/Common.vcxproj
+++ b/Source/Core/Common/Common.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -54,7 +54,6 @@
<ClInclude Include="CommonFuncs.h" />
<ClInclude Include="CommonPaths.h" />
<ClInclude Include="CommonTypes.h" />
- <ClInclude Include="ConsoleListener.h" />
<ClInclude Include="CPUDetect.h" />
<ClInclude Include="Crypto\tools.h" />
<ClInclude Include="DebugInterface.h" />
@@ -93,7 +92,6 @@
<ClCompile Include="BreakPoints.cpp" />
<ClCompile Include="CDUtils.cpp" />
<ClCompile Include="ColorUtil.cpp" />
- <ClCompile Include="ConsoleListener.cpp" />
<ClCompile Include="Crypto\bn.cpp" />
<ClCompile Include="Crypto\ec.cpp" />
<ClCompile Include="ExtendedTrace.cpp" />
@@ -139,4 +137,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters
index 4af869c..cb9e284 100644
--- a/Source/Core/Common/Common.vcxproj.filters
+++ b/Source/Core/Common/Common.vcxproj.filters
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Crypto">
@@ -52,9 +52,6 @@
<ClInclude Include="Crypto\tools.h">
<Filter>Crypto</Filter>
</ClInclude>
- <ClInclude Include="ConsoleListener.h">
- <Filter>Logging</Filter>
- </ClInclude>
<ClInclude Include="Log.h">
<Filter>Logging</Filter>
</ClInclude>
@@ -97,9 +94,6 @@
<ClCompile Include="Crypto\ec.cpp">
<Filter>Crypto</Filter>
</ClCompile>
- <ClCompile Include="ConsoleListener.cpp">
- <Filter>Logging</Filter>
- </ClCompile>
<ClCompile Include="LogManager.cpp">
<Filter>Logging</Filter>
</ClCompile>
@@ -108,4 +102,4 @@
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index b6592e3..dba3a63 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -13,7 +13,7 @@
#include <cstddef>
#include <type_traits>
-#include "Common.h"
+#include "Common/Common.h"
// Will fail to compile on a non-array:
// TODO: make this a function when constexpr is available
@@ -105,13 +105,13 @@ inline u64 _rotr64(u64 x, unsigned int shift){
#define freelocale _free_locale
#define newlocale(mask, locale, base) _create_locale(mask, locale)
- #define LC_GLOBAL_LOCALE ((locale_t)-1)
- #define LC_ALL_MASK LC_ALL
- #define LC_COLLATE_MASK LC_COLLATE
- #define LC_CTYPE_MASK LC_CTYPE
- #define LC_MONETARY_MASK LC_MONETARY
- #define LC_NUMERIC_MASK LC_NUMERIC
- #define LC_TIME_MASK LC_TIME
+ #define LC_GLOBAL_LOCALE ((locale_t)-1)
+ #define LC_ALL_MASK LC_ALL
+ #define LC_COLLATE_MASK LC_COLLATE
+ #define LC_CTYPE_MASK LC_CTYPE
+ #define LC_MONETARY_MASK LC_MONETARY
+ #define LC_NUMERIC_MASK LC_NUMERIC
+ #define LC_TIME_MASK LC_TIME
inline locale_t uselocale(locale_t new_locale)
{
diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h
index 3481aca..dc05b92 100644
--- a/Source/Core/Common/CommonPaths.h
+++ b/Source/Core/Common/CommonPaths.h
@@ -5,7 +5,7 @@
#pragma once
// Make sure we pick up USER_DIR if set in config.h
-#include "Common.h"
+#include "Common/Common.h"
// Directory seperators, do we need this?
#define DIR_SEP "/"
@@ -55,63 +55,63 @@
#define JAP_DIR "JAP"
// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
-#define GC_USER_DIR "GC"
-#define WII_USER_DIR "Wii"
-#define CONFIG_DIR "Config"
-#define GAMESETTINGS_DIR "GameSettings"
-#define MAPS_DIR "Maps"
-#define CACHE_DIR "Cache"
-#define SHADERCACHE_DIR "ShaderCache"
-#define STATESAVES_DIR "StateSaves"
-#define SCREENSHOTS_DIR "ScreenShots"
-#define LOAD_DIR "Load"
-#define HIRES_TEXTURES_DIR LOAD_DIR DIR_SEP "Textures"
-#define DUMP_DIR "Dump"
-#define DUMP_TEXTURES_DIR "Textures"
-#define DUMP_FRAMES_DIR "Frames"
-#define DUMP_AUDIO_DIR "Audio"
-#define DUMP_DSP_DIR "DSP"
-#define LOGS_DIR "Logs"
-#define MAIL_LOGS_DIR "Mail"
-#define SHADERS_DIR "Shaders"
-#define WII_SYSCONF_DIR "shared2" DIR_SEP "sys"
-#define WII_WC24CONF_DIR "shared2" DIR_SEP "wc24"
-#define THEMES_DIR "Themes"
+#define GC_USER_DIR "GC"
+#define WII_USER_DIR "Wii"
+#define CONFIG_DIR "Config"
+#define GAMESETTINGS_DIR "GameSettings"
+#define MAPS_DIR "Maps"
+#define CACHE_DIR "Cache"
+#define SHADERCACHE_DIR "ShaderCache"
+#define STATESAVES_DIR "StateSaves"
+#define SCREENSHOTS_DIR "ScreenShots"
+#define LOAD_DIR "Load"
+#define HIRES_TEXTURES_DIR LOAD_DIR DIR_SEP "Textures"
+#define DUMP_DIR "Dump"
+#define DUMP_TEXTURES_DIR "Textures"
+#define DUMP_FRAMES_DIR "Frames"
+#define DUMP_AUDIO_DIR "Audio"
+#define DUMP_DSP_DIR "DSP"
+#define LOGS_DIR "Logs"
+#define MAIL_LOGS_DIR "Mail"
+#define SHADERS_DIR "Shaders"
+#define WII_SYSCONF_DIR "shared2" DIR_SEP "sys"
+#define WII_WC24CONF_DIR "shared2" DIR_SEP "wc24"
+#define THEMES_DIR "Themes"
// Filenames
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
-#define DOLPHIN_CONFIG "Dolphin.ini"
-#define DEBUGGER_CONFIG "Debugger.ini"
-#define LOGGER_CONFIG "Logger.ini"
+#define DOLPHIN_CONFIG "Dolphin.ini"
+#define DEBUGGER_CONFIG "Debugger.ini"
+#define LOGGER_CONFIG "Logger.ini"
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
-#define MAIN_LOG "dolphin.log"
+#define MAIN_LOG "dolphin.log"
// Files in the directory returned by GetUserPath(D_WIISYSCONF_IDX)
-#define WII_SYSCONF "SYSCONF"
+#define WII_SYSCONF "SYSCONF"
// Files in the directory returned by GetUserPath(D_DUMP_IDX)
-#define RAM_DUMP "ram.raw"
-#define ARAM_DUMP "aram.raw"
-#define FAKEVMEM_DUMP "fakevmem.raw"
+#define RAM_DUMP "ram.raw"
+#define ARAM_DUMP "aram.raw"
+#define FAKEVMEM_DUMP "fakevmem.raw"
// Sys files
-#define TOTALDB "totaldb.dsy"
+#define TOTALDB "totaldb.dsy"
-#define FONT_ANSI "font_ansi.bin"
-#define FONT_SJIS "font_sjis.bin"
+#define FONT_ANSI "font_ansi.bin"
+#define FONT_SJIS "font_sjis.bin"
-#define DSP_IROM "dsp_rom.bin"
-#define DSP_COEF "dsp_coef.bin"
+#define DSP_IROM "dsp_rom.bin"
+#define DSP_COEF "dsp_coef.bin"
-#define GC_IPL "IPL.bin"
-#define GC_SRAM "SRAM.raw"
-#define GC_MEMCARDA "MemoryCardA"
-#define GC_MEMCARDB "MemoryCardB"
+#define GC_IPL "IPL.bin"
+#define GC_SRAM "SRAM.raw"
+#define GC_MEMCARDA "MemoryCardA"
+#define GC_MEMCARDB "MemoryCardB"
-#define WII_STATE "state.dat"
+#define WII_STATE "state.dat"
-#define WII_SETTING "setting.txt"
+#define WII_SETTING "setting.txt"
#define GECKO_CODE_HANDLER "codehandler.bin"
diff --git a/Source/Core/Common/CommonTypes.h b/Source/Core/Common/CommonTypes.h
index 56210da..6ec7045 100644
--- a/Source/Core/Common/CommonTypes.h
+++ b/Source/Core/Common/CommonTypes.h
@@ -9,8 +9,8 @@
#pragma once
-#include <cstdint>
#include <cstddef>
+#include <cstdint>
#ifdef _WIN32
diff --git a/Source/Core/Common/ConsoleListener.cpp b/Source/Core/Common/ConsoleListener.cpp
deleted file mode 100644
index fa8780d..0000000
--- a/Source/Core/Common/ConsoleListener.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include <algorithm> // min
-#include <cstdlib>
-#include <string> // System: To be able to add strings with "+"
-#include <stdio.h>
-#include <math.h>
-#ifdef _WIN32
-#include <windows.h>
-#include <array>
-#endif
-
-#include "ConsoleListener.h" // Common
-
-ConsoleListener::ConsoleListener()
-{
-#ifdef _WIN32
- hConsole = NULL;
- bUseColor = true;
-#else
- bUseColor = isatty(fileno(stdout));
-#endif
-}
-
-ConsoleListener::~ConsoleListener()
-{
- Close();
-}
-
-// 100, 100, "Dolphin Log Console"
-// Open console window - width and height is the size of console window
-// Name is the window title
-void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title)
-{
-#ifdef _WIN32
- if (!GetConsoleWindow())
- {
- // Open the console window and create the window handle for GetStdHandle()
- AllocConsole();
- // Hide
- if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE);
- // Save the window handle that AllocConsole() created
- hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- // Set the console window title
- SetConsoleTitle(UTF8ToTStr(Title).c_str());
- // Set letter space
- LetterSpace(80, 4000);
- //MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
- }
- else
- {
- hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- }
-#endif
-}
-
-void ConsoleListener::UpdateHandle()
-{
-#ifdef _WIN32
- hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
-#endif
-}
-
-// Close the console window and close the eventual file handle
-void ConsoleListener::Close()
-{
-#ifdef _WIN32
- if (hConsole == NULL)
- return;
- FreeConsole();
- hConsole = NULL;
-#else
- fflush(NULL);
-#endif
-}
-
-bool ConsoleListener::IsOpen()
-{
-#ifdef _WIN32
- return (hConsole != NULL);
-#else
- return true;
-#endif
-}
-
-/*
- LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are
- dependent on each other, that's the reason for the additional checks.
-*/
-void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst)
-{
-#ifdef _WIN32
- BOOL SB, SW;
- if (BufferFirst)
- {
- // Change screen buffer size
- COORD Co = {BufferWidth, BufferHeight};
- SB = SetConsoleScreenBufferSize(hConsole, Co);
- // Change the screen buffer window size
- SMALL_RECT coo = {0,0,ScreenWidth, ScreenHeight}; // top, left, right, bottom
- SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
- }
- else
- {
- // Change the screen buffer window size
- SMALL_RECT coo = {0,0, ScreenWidth, ScreenHeight}; // top, left, right, bottom
- SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
- // Change screen buffer size
- COORD Co = {BufferWidth, BufferHeight};
- SB = SetConsoleScreenBufferSize(hConsole, Co);
- }
-#endif
-}
-void ConsoleListener::LetterSpace(int Width, int Height)
-{
-#ifdef _WIN32
- // Get console info
- CONSOLE_SCREEN_BUFFER_INFO ConInfo;
- GetConsoleScreenBufferInfo(hConsole, &ConInfo);
-
- //
- int OldBufferWidth = ConInfo.dwSize.X;
- int OldBufferHeight = ConInfo.dwSize.Y;
- int OldScreenWidth = (ConInfo.srWindow.Right - ConInfo.srWindow.Left);
- int OldScreenHeight = (ConInfo.srWindow.Bottom - ConInfo.srWindow.Top);
- //
- int NewBufferWidth = Width;
- int NewBufferHeight = Height;
- int NewScreenWidth = NewBufferWidth - 1;
- int NewScreenHeight = OldScreenHeight;
-
- // Width
- BufferWidthHeight(NewBufferWidth, OldBufferHeight, NewScreenWidth, OldScreenHeight, (NewBufferWidth > OldScreenWidth-1));
- // Height
- BufferWidthHeight(NewBufferWidth, NewBufferHeight, NewScreenWidth, NewScreenHeight, (NewBufferHeight > OldScreenHeight-1));
-
- // Resize the window too
- //MoveWindow(GetConsoleWindow(), 200,200, (Width*8 + 50),(NewScreenHeight*12 + 200), true);
-#endif
-}
-#ifdef _WIN32
-COORD ConsoleListener::GetCoordinates(int BytesRead, int BufferWidth)
-{
- COORD Ret = {0, 0};
- // Full rows
- int Step = (int)floor((float)BytesRead / (float)BufferWidth);
- Ret.Y += Step;
- // Partial row
- Ret.X = BytesRead - (BufferWidth * Step);
- return Ret;
-}
-#endif
-void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool Resize)
-{
-#ifdef _WIN32
- // Check size
- if (Width < 8 || Height < 12) return;
-
- bool DBef = true;
- bool DAft = true;
- std::string SLog = "";
-
- const HWND hWnd = GetConsoleWindow();
- const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
-
- // Get console info
- CONSOLE_SCREEN_BUFFER_INFO ConInfo;
- GetConsoleScreenBufferInfo(hConsole, &ConInfo);
- DWORD BufferSize = ConInfo.dwSize.X * ConInfo.dwSize.Y;
-
- // ---------------------------------------------------------------------
- // Save the current text
- // ------------------------
- DWORD cCharsRead = 0;
- COORD coordScreen = { 0, 0 };
-
- static const int MAX_BYTES = 1024 * 16;
-
- std::vector<std::array<TCHAR, MAX_BYTES>> Str;
- std::vector<std::array<WORD, MAX_BYTES>> Attr;
-
- // ReadConsoleOutputAttribute seems to have a limit at this level
- static const int ReadBufferSize = MAX_BYTES - 32;
-
- DWORD cAttrRead = ReadBufferSize;
- DWORD BytesRead = 0;
- while (BytesRead < BufferSize)
- {
- Str.resize(Str.size() + 1);
- if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead))
- SLog += StringFromFormat("WriteConsoleOutputCharacter error");
-
- Attr.resize(Attr.size() + 1);
- if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead))
- SLog += StringFromFormat("WriteConsoleOutputAttribute error");
-
- // Break on error
- if (cAttrRead == 0) break;
- BytesRead += cAttrRead;
- coordScreen = GetCoordinates(BytesRead, ConInfo.dwSize.X);
- }
- // Letter space
- int LWidth = (int)(floor((float)Width / 8.0f) - 1.0f);
- int LHeight = (int)(floor((float)Height / 12.0f) - 1.0f);
- int LBufWidth = LWidth + 1;
- int LBufHeight = (int)floor((float)BufferSize / (float)LBufWidth);
- // Change screen buffer size
- LetterSpace(LBufWidth, LBufHeight);
-
-
- ClearScreen(true);
- coordScreen.Y = 0;
- coordScreen.X = 0;
- DWORD cCharsWritten = 0;
-
- int BytesWritten = 0;
- DWORD cAttrWritten = 0;
- for (size_t i = 0; i < Attr.size(); i++)
- {
- if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten))
- SLog += StringFromFormat("WriteConsoleOutputCharacter error");
- if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten))
- SLog += StringFromFormat("WriteConsoleOutputAttribute error");
-
- BytesWritten += cAttrWritten;
- coordScreen = GetCoordinates(BytesWritten, LBufWidth);
- }
-
- const int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X;
- COORD Coo = GetCoordinates(OldCursor, LBufWidth);
- SetConsoleCursorPosition(hConsole, Coo);
-
- if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str());
-
- // Resize the window too
- if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true);
-#endif
-}
-
-void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
-{
-#if defined(_WIN32)
- /*
- const int MAX_BYTES = 1024*10;
- char Str[MAX_BYTES];
- va_list ArgPtr;
- int Cnt;
- va_start(ArgPtr, Text);
- Cnt = vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
- va_end(ArgPtr);
- */
- DWORD cCharsWritten;
- WORD Color;
-
- switch (Level)
- {
- case NOTICE_LEVEL: // light green
- Color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
- break;
- case ERROR_LEVEL: // light red
- Color = FOREGROUND_RED | FOREGROUND_INTENSITY;
- break;
- case WARNING_LEVEL: // light yellow
- Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
- break;
- case INFO_LEVEL: // cyan
- Color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
- break;
- case DEBUG_LEVEL: // gray
- Color = FOREGROUND_INTENSITY;
- break;
- default: // off-white
- Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
- break;
- }
- if (strlen(Text) > 10)
- {
- // First 10 chars white
- SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- WriteConsole(hConsole, Text, 10, &cCharsWritten, NULL);
- Text += 10;
- }
- SetConsoleTextAttribute(hConsole, Color);
- WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL);
-#else
- char ColorAttr[16] = "";
- char ResetAttr[16] = "";
-
- if (bUseColor)
- {
- strcpy(ResetAttr, "\033[0m");
- switch (Level)
- {
- case NOTICE_LEVEL: // light green
- strcpy(ColorAttr, "\033[92m");
- break;
- case ERROR_LEVEL: // light red
- strcpy(ColorAttr, "\033[91m");
- break;
- case WARNING_LEVEL: // light yellow
- strcpy(ColorAttr, "\033[93m");
- break;
- default:
- break;
- }
- }
- fprintf(stderr, "%s%s%s", ColorAttr, Text, ResetAttr);
-#endif
-}
-// Clear console screen
-void ConsoleListener::ClearScreen(bool Cursor)
-{
-#if defined(_WIN32)
- COORD coordScreen = { 0, 0 };
- DWORD cCharsWritten;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD dwConSize;
-
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
-
- GetConsoleScreenBufferInfo(hConsole, &csbi);
- dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
- // Write space to the entire console
- FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
- GetConsoleScreenBufferInfo(hConsole, &csbi);
- FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
- // Reset cursor
- if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
-#endif
-}
-
-
diff --git a/Source/Core/Common/ConsoleListener.h b/Source/Core/Common/ConsoleListener.h
deleted file mode 100644
index ea9566a..0000000
--- a/Source/Core/Common/ConsoleListener.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "LogManager.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-class ConsoleListener : public LogListener
-{
-public:
- ConsoleListener();
- ~ConsoleListener();
-
- void Open(bool Hidden = false, int Width = 100, int Height = 100, const char * Name = "Console");
- void UpdateHandle();
- void Close();
- bool IsOpen();
- void LetterSpace(int Width, int Height);
- void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst);
- void PixelSpace(int Left, int Top, int Width, int Height, bool);
-#ifdef _WIN32
- COORD GetCoordinates(int BytesRead, int BufferWidth);
-#endif
- void Log(LogTypes::LOG_LEVELS, const char *Text);
- void ClearScreen(bool Cursor = true);
-
-private:
-#ifdef _WIN32
- HWND GetHwnd(void);
- HANDLE hConsole;
-#endif
- bool bUseColor;
-};
diff --git a/Source/Core/Common/Crypto/bn.cpp b/Source/Core/Common/Crypto/bn.cpp
index a0676df..e2a9dd6 100644
--- a/Source/Core/Common/Crypto/bn.cpp
+++ b/Source/Core/Common/Crypto/bn.cpp
@@ -2,10 +2,11 @@
// Licensed under the terms of the GNU GPL, version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+#include <cstdio>
#include <string.h>
-#include <stdio.h>
-#include "../Common.h"
-#include "tools.h"
+
+#include "Common/Common.h"
+#include "Common/Crypto/tools.h"
/*static void bn_print(char *name, u8 *a, u32 n)
{
diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp
index d360a5b..727f5d8 100644
--- a/Source/Core/Common/Crypto/ec.cpp
+++ b/Source/Core/Common/Crypto/ec.cpp
@@ -6,13 +6,13 @@
// Licensed under the terms of the GNU GPL, version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
#include <string.h>
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include "../Common.h"
-#include "tools.h"
+#include "Common/Common.h"
+#include "Common/Crypto/tools.h"
// y**2 + x*y = x**3 + x + b
/*
static u8 ec_b[30] =
@@ -307,7 +307,7 @@ static void point_add(u8 *r, u8 *p, u8 *q)
elt_add(ry, s, rx);
}
-void point_mul(u8 *d, const u8 *a, u8 *b) // a is bignum
+void point_mul(u8 *d, const u8 *a, u8 *b) // a is bignum
{
u32 i;
u8 mask;
diff --git a/Source/Core/Common/Crypto/tools.h b/Source/Core/Common/Crypto/tools.h
index d97995c..0e4d49b 100644
--- a/Source/Core/Common/Crypto/tools.h
+++ b/Source/Core/Common/Crypto/tools.h
@@ -11,7 +11,7 @@ int bn_compare(u8 *a, u8 *b, u32 n);
void bn_sub_modulus(u8 *a, u8 *N, u32 n);
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
-void bn_inv(u8 *d, u8 *a, u8 *N, u32 n); // only for prime N
+void bn_inv(u8 *d, u8 *a, u8 *N, u32 n); // only for prime N
void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en);
void point_mul(u8 *d, const u8 *a, u8 *b);
diff --git a/Source/Core/Common/ExtendedTrace.cpp b/Source/Core/Common/ExtendedTrace.cpp
index 379b2c4..527b860 100644
--- a/Source/Core/Common/ExtendedTrace.cpp
+++ b/Source/Core/Common/ExtendedTrace.cpp
@@ -14,10 +14,11 @@
#if defined(WIN32)
+#include <cstdio>
#include <windows.h>
-#include <stdio.h>
-#include "ExtendedTrace.h"
-#include "StringUtil.h"
+
+#include "Common/ExtendedTrace.h"
+#include "Common/StringUtil.h"
using namespace std;
#include <tchar.h>
diff --git a/Source/Core/Common/FPURoundMode.h b/Source/Core/Common/FPURoundMode.h
index 759aaac..e7b4884 100644
--- a/Source/Core/Common/FPURoundMode.h
+++ b/Source/Core/Common/FPURoundMode.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
namespace FPURoundMode
{
diff --git a/Source/Core/Common/FifoQueue.h b/Source/Core/Common/FifoQueue.h
index 0e0ada1..b6e237a 100644
--- a/Source/Core/Common/FifoQueue.h
+++ b/Source/Core/Common/FifoQueue.h
@@ -3,7 +3,7 @@
// a simple lockless thread-safe,
// single reader, single writer queue
-#include "Atomic.h"
+#include "Common/Atomic.h"
namespace Common
{
@@ -63,7 +63,7 @@ public:
m_read_ptr = AtomicLoad(tmpptr->next);
// set the next element to NULL to stop the recursive deletion
tmpptr->next = NULL;
- delete tmpptr; // this also deletes the element
+ delete tmpptr; // this also deletes the element
}
bool Pop(T& t)
diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp
index 7597b91..4cecb2b 100644
--- a/Source/Core/Common/FileSearch.cpp
+++ b/Source/Core/Common/FileSearch.cpp
@@ -2,9 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <algorithm>
+
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileSearch.h"
+#include "Common/StringUtil.h"
-#include "Common.h"
-#include "CommonPaths.h"
#ifndef _WIN32
#include <sys/types.h>
#include <dirent.h>
@@ -12,11 +16,6 @@
#include <windows.h>
#endif
-#include <algorithm>
-
-#include "FileSearch.h"
-#include "StringUtil.h"
-
CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, const CFileSearch::XStringVector& _rDirectories)
{
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index ae2d874..561435f 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -2,36 +2,35 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <algorithm>
+#include <fcntl.h>
+#include <sys/stat.h>
-#include "CommonPaths.h"
-#include "FileUtil.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
#ifdef _WIN32
-#include <windows.h>
-#include <shlobj.h> // for SHGetFolderPath
-#include <shellapi.h>
#include <commdlg.h> // for GetSaveFileName
-#include <io.h>
#include <direct.h> // getcwd
+#include <io.h>
+#include <shellapi.h>
+#include <shlobj.h> // for SHGetFolderPath
+#include <windows.h>
#else
-#include <sys/param.h>
-#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
-#include <stdlib.h>
#include <libgen.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <sys/types.h>
#endif
-#include <fcntl.h>
#if defined(__APPLE__)
+#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFURL.h>
-#include <CoreFoundation/CFBundle.h>
#endif
-#include <algorithm>
-#include <sys/stat.h>
-
#ifndef S_ISDIR
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif
@@ -803,37 +802,37 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
getenv("PWD") : "") + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
#endif
- paths[D_GCUSER_IDX] = paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
- paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
- paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
- paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
- paths[D_GAMESETTINGS_IDX] = paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
- paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
- paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
- paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
- paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
- paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
- paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
- paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
- paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
- paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
- paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
- paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
- paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
- paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
- paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
- paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
- paths[D_WIIWC24_IDX] = paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
- paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
- paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
- paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
- paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
- paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
- paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
- paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
- paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
- paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
- paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
+ paths[D_GCUSER_IDX] = paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
+ paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
+ paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
+ paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
+ paths[D_GAMESETTINGS_IDX] = paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
+ paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
+ paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
+ paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
+ paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
+ paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
+ paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
+ paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
+ paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
+ paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
+ paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
+ paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
+ paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
+ paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
+ paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
+ paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
+ paths[D_WIIWC24_IDX] = paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
+ paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
+ paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
+ paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
+ paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
+ paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
+ paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
+ paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
+ paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
+ paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
+ paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
}
if (!newPath.empty())
@@ -851,72 +850,72 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
switch (DirIDX)
{
case D_WIIROOT_IDX:
- paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
- paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
- paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
+ paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
+ paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
+ paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
break;
case D_USER_IDX:
- paths[D_GCUSER_IDX] = paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
- paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
- paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
- paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
- paths[D_GAMESETTINGS_IDX] = paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
- paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
- paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
- paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
- paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
- paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
- paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
- paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
- paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
- paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
- paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
- paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
- paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
- paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
- paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
- paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
- paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
- paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
- paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
- paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
- paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
- paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
- paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
- paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
- paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
- paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
+ paths[D_GCUSER_IDX] = paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
+ paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
+ paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
+ paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
+ paths[D_GAMESETTINGS_IDX] = paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
+ paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
+ paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
+ paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
+ paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
+ paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
+ paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
+ paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
+ paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
+ paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
+ paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
+ paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
+ paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
+ paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
+ paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
+ paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
+ paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
+ paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
+ paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
+ paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
+ paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
+ paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
+ paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
+ paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
+ paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
+ paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
break;
case D_CONFIG_IDX:
- paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
- paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
- paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
+ paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
+ paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
+ paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
break;
case D_GCUSER_IDX:
- paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
+ paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
break;
case D_DUMP_IDX:
- paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
- paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
- paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
- paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
- paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
- paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
- paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
+ paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
+ paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
+ paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
+ paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
+ paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
+ paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
+ paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
break;
case D_LOGS_IDX:
- paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
- paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
+ paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
+ paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
}
- paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
- paths[D_WIIWC24_IDX] = paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
- paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
- paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
+ paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
+ paths[D_WIIWC24_IDX] = paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
+ paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
+ paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
}
return paths[DirIDX];
diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h
index e0efc42..1b49d4d 100644
--- a/Source/Core/Common/FileUtil.h
+++ b/Source/Core/Common/FileUtil.h
@@ -4,14 +4,14 @@
#pragma once
-#include <fstream>
#include <cstdio>
+#include <fstream>
#include <string>
-#include <vector>
#include <string.h>
+#include <vector>
-#include "Common.h"
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
// User directory indices for GetUserPath
enum {
@@ -198,7 +198,7 @@ public:
bool IsOpen() { return NULL != m_file; }
// m_good is set to false when a read, write or other function fails
- bool IsGood() { return m_good; }
+ bool IsGood() { return m_good; }
operator void*() { return m_good ? m_file : NULL; }
std::FILE* ReleaseHandle();
diff --git a/Source/Core/Common/FixedSizeQueue.h b/Source/Core/Common/FixedSizeQueue.h
index 2b54b63..b6b9b0a 100644
--- a/Source/Core/Common/FixedSizeQueue.h
+++ b/Source/Core/Common/FixedSizeQueue.h
@@ -20,7 +20,7 @@ class FixedSizeQueue
int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
// Make copy constructor private for now.
- FixedSizeQueue(FixedSizeQueue &other) { }
+ FixedSizeQueue(FixedSizeQueue &other) {}
public:
FixedSizeQueue()
diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp
index ab01734..df1010c 100644
--- a/Source/Core/Common/Hash.cpp
+++ b/Source/Core/Common/Hash.cpp
@@ -3,9 +3,9 @@
// Refer to the license.txt file included.
-#include "Hash.h"
+#include "Common/Hash.h"
#if _M_SSE >= 0x402
-#include "CPUDetect.h"
+#include "Common/CPUDetect.h"
#include <nmmintrin.h>
#endif
diff --git a/Source/Core/Common/Hash.h b/Source/Core/Common/Hash.h
index 23a54cd..a27a1c7 100644
--- a/Source/Core/Common/Hash.h
+++ b/Source/Core/Common/Hash.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp
index 6999c58..8430f01 100644
--- a/Source/Core/Common/IniFile.cpp
+++ b/Source/Core/Common/IniFile.cpp
@@ -5,18 +5,17 @@
// see IniFile.h
-#include <stdlib.h>
-#include <stdio.h>
-
+#include <algorithm>
+#include <cstdio>
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
#include <string>
#include <vector>
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "IniFile.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Common/StringUtil.h"
namespace {
diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h
index 9987dfc..c057b32 100644
--- a/Source/Core/Common/IniFile.h
+++ b/Source/Core/Common/IniFile.h
@@ -5,11 +5,11 @@
#pragma once
#include <map>
-#include <string>
#include <set>
+#include <string>
#include <vector>
-#include "StringUtil.h"
+#include "Common/StringUtil.h"
struct CaseInsensitiveStringCompare
{
@@ -36,7 +36,7 @@ public:
void Set(const std::string& key, const std::string& newValue);
void Set(const std::string& key, const std::string& newValue, const std::string& defaultValue);
- bool Get(const std::string& key, std::string* value, const std::string& defaultValue = NULL_STRING);
+ bool Get(const std::string& key, std::string* value, const std::string& defaultValue = NULL_STRING);
void Set(const std::string& key, u32 newValue) {
Set(key, StringFromFormat("0x%08x", newValue));
diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h
index 34bf381..ce9312b 100644
--- a/Source/Core/Common/LinearDiskCache.h
+++ b/Source/Core/Common/LinearDiskCache.h
@@ -4,9 +4,10 @@
#pragma once
-#include "Common.h"
#include <fstream>
+#include "Common/Common.h"
+
// On disk format:
//header{
// u32 'DCAC';
@@ -87,7 +88,7 @@ public:
Read(value, value_size) &&
Read(&entry_number) &&
entry_number == m_num_entries+1)
- {
+ {
reader.Read(key, value, value_size);
}
else
diff --git a/Source/Core/Common/Log.h b/Source/Core/Common/Log.h
index 3284daa..e7282e6 100644
--- a/Source/Core/Common/Log.h
+++ b/Source/Core/Common/Log.h
@@ -47,7 +47,6 @@ enum LOG_TYPE
STREAMINGINTERFACE,
VIDEO,
VIDEOINTERFACE,
- WII_IOB,
WII_IPC,
WII_IPC_DVD,
WII_IPC_ES,
@@ -141,12 +140,12 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
#ifndef GEKKO
#ifdef _WIN32
-#define _assert_msg_(_t_, _a_, _fmt_, ...) \
+#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
}
#else // not win32
-#define _assert_msg_(_t_, _a_, _fmt_, ...) \
+#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
}
diff --git a/Source/Core/Common/LogManager.cpp b/Source/Core/Common/LogManager.cpp
index c73624c..a880b66 100644
--- a/Source/Core/Common/LogManager.cpp
+++ b/Source/Core/Common/LogManager.cpp
@@ -5,13 +5,12 @@
#include <algorithm>
#ifdef ANDROID
-#include "Host.h"
+#include "Core/Host.h"
#endif
-#include "LogManager.h"
-#include "ConsoleListener.h"
-#include "Timer.h"
-#include "Thread.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char* fmt, ...)
@@ -29,67 +28,59 @@ LogManager *LogManager::m_logManager = NULL;
LogManager::LogManager()
{
// create log files
- m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
- m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
- m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
- m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
- m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
- m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
- m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
- m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
- m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
- m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
- m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
- m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
- m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1");
- m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
- m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
- m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
- m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
- m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
- m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub");
- m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
- m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
- m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
- m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
- m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
- m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
- m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
- m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
- m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
- m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
- m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
- m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
- m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
- m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
- m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID");
- m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
- m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
- m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
- m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO","WII IPC FILEIO");
- m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
- m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
- m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
- m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24");
- m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL");
- m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
- m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
- m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
- m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
+ m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
+ m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
+ m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
+ m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
+ m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
+ m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
+ m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
+ m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
+ m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
+ m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
+ m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
+ m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
+ m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1");
+ m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
+ m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
+ m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
+ m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
+ m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
+ m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub");
+ m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
+ m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
+ m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
+ m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
+ m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
+ m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
+ m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
+ m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
+ m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
+ m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
+ m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
+ m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
+ m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
+ m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID");
+ m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
+ m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
+ m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
+ m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");
+ m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
+ m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
+ m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
+ m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24");
+ m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL");
+ m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");
+ m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
+ m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
+ m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str());
- m_consoleLog = new ConsoleListener();
- m_debuggerLog = new DebuggerLogListener();
for (LogContainer* container : m_Log)
{
container->SetEnable(true);
container->AddListener(m_fileLog);
- container->AddListener(m_consoleLog);
-#ifdef _MSC_VER
- if (IsDebuggerPresent())
- container->AddListener(m_debuggerLog);
-#endif
}
}
@@ -98,16 +89,12 @@ LogManager::~LogManager()
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog);
- m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_consoleLog);
- m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog);
}
for (LogContainer* container : m_Log)
delete container;
delete m_fileLog;
- delete m_consoleLog;
- delete m_debuggerLog;
}
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
@@ -188,10 +175,3 @@ void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg)
std::lock_guard<std::mutex> lk(m_log_lock);
m_logfile << msg << std::flush;
}
-
-void DebuggerLogListener::Log(LogTypes::LOG_LEVELS, const char *msg)
-{
-#if _MSC_VER
- ::OutputDebugStringA(msg);
-#endif
-}
diff --git a/Source/Core/Common/LogManager.h b/Source/Core/Common/LogManager.h
index 1b055e6..ffd2e7e 100644
--- a/Source/Core/Common/LogManager.h
+++ b/Source/Core/Common/LogManager.h
@@ -4,14 +4,14 @@
#pragma once
-#include "Log.h"
-#include "StringUtil.h"
-#include "Thread.h"
-#include "FileUtil.h"
-
#include <set>
#include <string.h>
+#include "Common/FileUtil.h"
+#include "Common/Log.h"
+#include "Common/StringUtil.h"
+#include "Common/Thread.h"
+
#define MAX_MESSAGES 8000
#define MAX_MSGLEN 1024
@@ -44,12 +44,6 @@ private:
bool m_enable;
};
-class DebuggerLogListener : public LogListener
-{
-public:
- void Log(LogTypes::LOG_LEVELS, const char *msg);
-};
-
class LogContainer
{
public:
@@ -66,9 +60,9 @@ public:
bool IsEnabled() const { return m_enable; }
void SetEnable(bool enable) { m_enable = enable; }
- LogTypes::LOG_LEVELS GetLevel() const { return m_level; }
+ LogTypes::LOG_LEVELS GetLevel() const { return m_level; }
- void SetLevel(LogTypes::LOG_LEVELS level) { m_level = level; }
+ void SetLevel(LogTypes::LOG_LEVELS level) { m_level = level; }
bool HasListeners() const { return !m_listeners.empty(); }
@@ -81,22 +75,18 @@ private:
std::set<LogListener*> m_listeners;
};
-class ConsoleListener;
-
class LogManager : NonCopyable
{
private:
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
FileLogListener *m_fileLog;
- ConsoleListener *m_consoleLog;
- DebuggerLogListener *m_debuggerLog;
static LogManager *m_logManager; // Singleton. Ugh.
LogManager();
~LogManager();
public:
- static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
+ static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char *fmt, va_list args);
@@ -141,16 +131,6 @@ public:
return m_fileLog;
}
- ConsoleListener *GetConsoleListener() const
- {
- return m_consoleLog;
- }
-
- DebuggerLogListener *GetDebuggerListener() const
- {
- return m_debuggerLog;
- }
-
static LogManager* GetInstance()
{
return m_logManager;
diff --git a/Source/Core/Common/MathUtil.cpp b/Source/Core/Common/MathUtil.cpp
index c92e659..5b3f870 100644
--- a/Source/Core/Common/MathUtil.cpp
+++ b/Source/Core/Common/MathUtil.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MathUtil.h"
-
#include <cmath>
#include <numeric>
+#include "Common/MathUtil.h"
+
namespace MathUtil
{
diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h
index ecb264c..2cd1d8f 100644
--- a/Source/Core/Common/MathUtil.h
+++ b/Source/Core/Common/MathUtil.h
@@ -4,10 +4,10 @@
#pragma once
-#include "Common.h"
-
#include <vector>
-#include "FPURoundMode.h"
+
+#include "Common/Common.h"
+#include "Common/FPURoundMode.h"
namespace MathUtil
{
diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp
index 699005d..4a7c305 100644
--- a/Source/Core/Common/MemArena.cpp
+++ b/Source/Core/Common/MemArena.cpp
@@ -4,9 +4,9 @@
#include <set>
-#include "MemoryUtil.h"
-#include "MemArena.h"
-#include "StringUtil.h"
+#include "Common/MemArena.h"
+#include "Common/MemoryUtil.h"
+#include "Common/StringUtil.h"
#ifdef _WIN32
#include <windows.h>
diff --git a/Source/Core/Common/MemArena.h b/Source/Core/Common/MemArena.h
index 5cd952d..59e62c0 100644
--- a/Source/Core/Common/MemArena.h
+++ b/Source/Core/Common/MemArena.h
@@ -8,7 +8,7 @@
#include <windows.h>
#endif
-#include "Common.h"
+#include "Common/Common.h"
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
// Multiple views can mirror the same section of the block, which makes it very convenient for emulating
diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp
index ce1c5d8..e65f0a1 100644
--- a/Source/Core/Common/MemoryUtil.cpp
+++ b/Source/Core/Common/MemoryUtil.cpp
@@ -3,9 +3,9 @@
// Refer to the license.txt file included.
-#include "Common.h"
-#include "MemoryUtil.h"
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
+#include "Common/StringUtil.h"
#ifdef _WIN32
#include <windows.h>
@@ -58,7 +58,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#else
if (ptr == NULL)
{
-#endif
+#endif
PanicAlert("Failed to allocate executable memory");
}
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
diff --git a/Source/Core/Common/Misc.cpp b/Source/Core/Common/Misc.cpp
index ce42deb..71a140c 100644
--- a/Source/Core/Common/Misc.cpp
+++ b/Source/Core/Common/Misc.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
// Neither Android nor OS X support TLS
#if defined(__APPLE__) || (ANDROID && __clang__)
diff --git a/Source/Core/Common/MsgHandler.cpp b/Source/Core/Common/MsgHandler.cpp
index 0fa1cf3..bbfa10d 100644
--- a/Source/Core/Common/MsgHandler.cpp
+++ b/Source/Core/Common/MsgHandler.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h> // System
+#include <cstdio>
-#include "Common.h" // Local
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style);
static MsgAlertHandler msg_handler = DefaultMsgHandler;
diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp
index 52e3904..b4e89a5 100644
--- a/Source/Core/Common/NandPaths.cpp
+++ b/Source/Core/Common/NandPaths.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "NandPaths.h"
#include <fstream>
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+
namespace Common
{
diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h
index f1fd151..cdaf1a7 100644
--- a/Source/Core/Common/NandPaths.h
+++ b/Source/Core/Common/NandPaths.h
@@ -5,7 +5,7 @@
#pragma once
#include <string>
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
#define TITLEID_SYSMENU 0x0000000100000002ull
diff --git a/Source/Core/Common/SDCardUtil.cpp b/Source/Core/Common/SDCardUtil.cpp
index 5475cf1..e73aa26 100644
--- a/Source/Core/Common/SDCardUtil.cpp
+++ b/Source/Core/Common/SDCardUtil.cpp
@@ -28,15 +28,15 @@
// A simple and portable piece of code used to generate a blank FAT32 image file.
// Modified for Dolphin.
-#include "SDCardUtil.h"
-#include "FileUtil.h"
-
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
#include <cinttypes>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <errno.h>
+
+#include "Common/FileUtil.h"
+#include "Common/SDCardUtil.h"
#ifndef _WIN32
#include <unistd.h> // for unlink()
diff --git a/Source/Core/Common/SDCardUtil.h b/Source/Core/Common/SDCardUtil.h
index e684720..6f95b2c 100644
--- a/Source/Core/Common/SDCardUtil.h
+++ b/Source/Core/Common/SDCardUtil.h
@@ -4,6 +4,6 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename);
diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp
index b368a71..b7a7aee 100644
--- a/Source/Core/Common/SettingsHandler.cpp
+++ b/Source/Core/Common/SettingsHandler.cpp
@@ -4,20 +4,20 @@
// Thanks to Treeki for writing the original class - 29/01/2012
-#include "CommonPaths.h"
-#include "Timer.h"
-#include "SettingsHandler.h"
-
-#include <time.h>
+#include <ctime>
#ifdef _WIN32
-#include <Windows.h>
#include <mmsystem.h>
#include <sys/timeb.h>
+#include <windows.h>
#else
#include <sys/time.h>
#endif
+#include "Common/CommonPaths.h"
+#include "Common/SettingsHandler.h"
+#include "Common/Timer.h"
+
SettingsHandler::SettingsHandler()
{
Reset();
diff --git a/Source/Core/Common/SettingsHandler.h b/Source/Core/Common/SettingsHandler.h
index c6bbab9..238e2d8 100644
--- a/Source/Core/Common/SettingsHandler.h
+++ b/Source/Core/Common/SettingsHandler.h
@@ -8,7 +8,7 @@
#include <string>
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class SettingsHandler
{
diff --git a/Source/Core/Common/StdConditionVariable.h b/Source/Core/Common/StdConditionVariable.h
index d9f17ec..2f537d1 100644
--- a/Source/Core/Common/StdConditionVariable.h
+++ b/Source/Core/Common/StdConditionVariable.h
@@ -4,7 +4,7 @@
#pragma once
-#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
+#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
@@ -36,7 +36,7 @@
// partial std::condition_variable implementation for win32/pthread
-#include "StdMutex.h"
+#include "Common/StdMutex.h"
#if (_MSC_VER >= 1600) || (GCC_VERSION >= GCC_VER(4,3,0) && __GXX_EXPERIMENTAL_CXX0X__)
#define USE_RVALUE_REFERENCES
diff --git a/Source/Core/Common/StdMutex.h b/Source/Core/Common/StdMutex.h
index 509e1d2..365aa7f 100644
--- a/Source/Core/Common/StdMutex.h
+++ b/Source/Core/Common/StdMutex.h
@@ -4,7 +4,7 @@
#pragma once
-#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
+#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
@@ -194,7 +194,7 @@ private:
};
#else
-typedef recursive_mutex mutex; // just use CriticalSections
+typedef recursive_mutex mutex; // just use CriticalSections
#endif
@@ -346,11 +346,6 @@ public:
return owns;
}
- //explicit operator bool () const
- //{
- // return owns_lock();
- //}
-
mutex_type* mutex() const
{
return pm;
diff --git a/Source/Core/Common/StdThread.h b/Source/Core/Common/StdThread.h
index ca7d691..7f02eeb 100644
--- a/Source/Core/Common/StdThread.h
+++ b/Source/Core/Common/StdThread.h
@@ -4,7 +4,7 @@
#pragma once
-#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
+#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
@@ -311,9 +311,9 @@ inline thread::id get_id()
#endif
}
-} // namespace this_thread
+} // namespace this_thread
-} // namespace std
+} // namespace std
#undef USE_RVALUE_REFERENCES
#undef USE_BEGINTHREADEX
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 7ad4ac6..3031669 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdlib.h>
-#include <stdio.h>
#include <algorithm>
+#include <cstdio>
+#include <cstdlib>
-#include "CommonPaths.h"
-#include "StringUtil.h"
+#include "Common/CommonPaths.h"
+#include "Common/StringUtil.h"
#ifdef _WIN32
#include <Windows.h>
@@ -520,11 +520,7 @@ std::string SHIFTJISToUTF8(const std::string& input)
std::string UTF16ToUTF8(const std::wstring& input)
{
- std::string result =
- // CodeToUTF8("UCS-2", input);
- // CodeToUTF8("UCS-2LE", input);
- // CodeToUTF8("UTF-16", input);
- CodeToUTF8("UTF-16LE", input);
+ std::string result = CodeToUTF8("UTF-16LE", input);
// TODO: why is this needed?
result.erase(std::remove(result.begin(), result.end(), 0x00), result.end());
diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h
index d444328..31e20e3 100644
--- a/Source/Core/Common/StringUtil.h
+++ b/Source/Core/Common/StringUtil.h
@@ -4,14 +4,13 @@
#pragma once
-#include <stdarg.h>
-
-#include <vector>
-#include <string>
-#include <sstream>
+#include <cstdarg>
#include <iomanip>
+#include <sstream>
+#include <string>
+#include <vector>
-#include "Common.h"
+#include "Common/Common.h"
std::string StringFromFormat(const char* format, ...)
#if !defined _WIN32
diff --git a/Source/Core/Common/SymbolDB.cpp b/Source/Core/Common/SymbolDB.cpp
index e7a716d..b44922f 100644
--- a/Source/Core/Common/SymbolDB.cpp
+++ b/Source/Core/Common/SymbolDB.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SymbolDB.h"
+#include "Common/SymbolDB.h"
void SymbolDB::List()
diff --git a/Source/Core/Common/SymbolDB.h b/Source/Core/Common/SymbolDB.h
index 348bdb5..2166531 100644
--- a/Source/Core/Common/SymbolDB.h
+++ b/Source/Core/Common/SymbolDB.h
@@ -7,11 +7,11 @@
#pragma once
-#include <string>
#include <map>
+#include <string>
#include <vector>
-#include "Common.h"
+#include "Common/Common.h"
struct SCall
{
diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp
index 6948e7d..cb634b2 100644
--- a/Source/Core/Common/SysConf.cpp
+++ b/Source/Core/Common/SysConf.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileUtil.h"
-#include "SysConf.h"
-
#include <cinttypes>
+#include "Common/FileUtil.h"
+#include "Common/SysConf.h"
+
SysConf::SysConf()
: m_IsValid(false)
{
diff --git a/Source/Core/Common/SysConf.h b/Source/Core/Common/SysConf.h
index 1b4706e..0594a9d 100644
--- a/Source/Core/Common/SysConf.h
+++ b/Source/Core/Common/SysConf.h
@@ -7,6 +7,8 @@
#include <string>
#include <vector>
+#include "Common/Common.h"
+
// This class is meant to edit the values in a given Wii SYSCONF file
// It currently does not add/remove/rearrange sections,
// instead only modifies exiting sections' data
diff --git a/Source/Core/Common/Thread.cpp b/Source/Core/Common/Thread.cpp
index 740750a..ce52375 100644
--- a/Source/Core/Common/Thread.cpp
+++ b/Source/Core/Common/Thread.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Thread.h"
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
#ifdef __APPLE__
#include <mach/mach.h>
diff --git a/Source/Core/Common/Thread.h b/Source/Core/Common/Thread.h
index 5f3af35..999689c 100644
--- a/Source/Core/Common/Thread.h
+++ b/Source/Core/Common/Thread.h
@@ -4,14 +4,14 @@
#pragma once
-#include "StdConditionVariable.h"
-#include "StdMutex.h"
-#include "StdThread.h"
+#include <cstdio>
+#include <cstring>
// Don't include common.h here as it will break LogManager
-#include "CommonTypes.h"
-#include <stdio.h>
-#include <string.h>
+#include "Common/CommonTypes.h"
+#include "Common/StdConditionVariable.h"
+#include "Common/StdMutex.h"
+#include "Common/StdThread.h"
// This may not be defined outside _WIN32
#ifndef _WIN32
@@ -108,7 +108,7 @@ private:
};
void SleepCurrentThread(int ms);
-void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
+void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
// Use this function during a spin-wait to make the current thread
// relax while another thread is working. This may be more efficient
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp
index a2e08bb..1670e86 100644
--- a/Source/Core/Common/Timer.cpp
+++ b/Source/Core/Common/Timer.cpp
@@ -2,19 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <time.h>
#include <cinttypes>
+#include <ctime>
#ifdef _WIN32
-#include <Windows.h>
#include <mmsystem.h>
#include <sys/timeb.h>
+#include <windows.h>
#else
#include <sys/time.h>
#endif
-#include "Timer.h"
-#include "StringUtil.h"
+#include "Common/StringUtil.h"
+#include "Common/Timer.h"
namespace Common
{
@@ -157,7 +157,7 @@ u64 Timer::GetLocalTimeSinceJan1970()
tzDST = 0;
// Lazy way to get local time in sec
- gmTime = gmtime(&sysTime);
+ gmTime = gmtime(&sysTime);
tzDiff = sysTime - mktime(gmTime);
return (u64)(sysTime + tzDiff + tzDST);
diff --git a/Source/Core/Common/Timer.h b/Source/Core/Common/Timer.h
index 851f48b..6e0d666 100644
--- a/Source/Core/Common/Timer.h
+++ b/Source/Core/Common/Timer.h
@@ -4,8 +4,8 @@
#pragma once
-#include "CommonTypes.h"
#include <string>
+#include "Common/CommonTypes.h"
namespace Common
{
diff --git a/Source/Core/Common/Version.cpp b/Source/Core/Common/Version.cpp
index 09bfa9b..1223bf3 100644
--- a/Source/Core/Common/Version.cpp
+++ b/Source/Core/Common/Version.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
#include "scmrev.h"
+#include "Common/Common.h"
#ifdef _DEBUG
#define BUILD_TYPE_STR "Debug "
diff --git a/Source/Core/Common/stdafx.cpp b/Source/Core/Common/stdafx.cpp
index b602b39..f75affc 100644
--- a/Source/Core/Common/stdafx.cpp
+++ b/Source/Core/Common/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "Common/stdafx.h"
diff --git a/Source/Core/Common/stdafx.h b/Source/Core/Common/stdafx.h
index de740c3..832a942 100644
--- a/Source/Core/Common/stdafx.h
+++ b/Source/Core/Common/stdafx.h
@@ -13,12 +13,12 @@
#endif
*/
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
/*
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
*/
-#include <windows.h>
#include <tchar.h>
#include <vector>
+#include <windows.h>
diff --git a/Source/Core/Common/x64ABI.cpp b/Source/Core/Common/x64ABI.cpp
index 6cced10..ce7ce5d 100644
--- a/Source/Core/Common/x64ABI.cpp
+++ b/Source/Core/Common/x64ABI.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "x64ABI.h"
-#include "x64Emitter.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Emitter.h"
using namespace Gen;
diff --git a/Source/Core/Common/x64ABI.h b/Source/Core/Common/x64ABI.h
index c08480c..75ca8fe 100644
--- a/Source/Core/Common/x64ABI.h
+++ b/Source/Core/Common/x64ABI.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code.
// All convensions return values in EAX (+ possibly EDX).
diff --git a/Source/Core/Common/x64Analyzer.cpp b/Source/Core/Common/x64Analyzer.cpp
index eac178f..c8115dc 100644
--- a/Source/Core/Common/x64Analyzer.cpp
+++ b/Source/Core/Common/x64Analyzer.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "x64Analyzer.h"
+#include "Common/x64Analyzer.h"
bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
{
diff --git a/Source/Core/Common/x64Analyzer.h b/Source/Core/Common/x64Analyzer.h
index 110e50d..613aafa 100644
--- a/Source/Core/Common/x64Analyzer.h
+++ b/Source/Core/Common/x64Analyzer.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
struct InstructionInfo
{
diff --git a/Source/Core/Common/x64CPUDetect.cpp b/Source/Core/Common/x64CPUDetect.cpp
index b9ed2b5..f9a5160 100644
--- a/Source/Core/Common/x64CPUDetect.cpp
+++ b/Source/Core/Common/x64CPUDetect.cpp
@@ -2,8 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <memory.h>
-#include "Common.h"
+#include <memory>
+
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/StringUtil.h"
#ifdef _WIN32
#define _interlockedbittestandset workaround_ms_header_bug_platform_sdk6_set
@@ -85,10 +88,6 @@ static unsigned long long _xgetbv(unsigned int index)
#endif
-#include "Common.h"
-#include "CPUDetect.h"
-#include "StringUtil.h"
-
CPUInfo cpu_info;
CPUInfo::CPUInfo() {
diff --git a/Source/Core/Common/x64Emitter.cpp b/Source/Core/Common/x64Emitter.cpp
index 76e235e..fa6c42c 100644
--- a/Source/Core/Common/x64Emitter.cpp
+++ b/Source/Core/Common/x64Emitter.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "x64Emitter.h"
-#include "x64ABI.h"
-#include "CPUDetect.h"
-
#include <cinttypes>
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Emitter.h"
+
namespace Gen
{
diff --git a/Source/Core/Common/x64Emitter.h b/Source/Core/Common/x64Emitter.h
index bdf8244..52db3c2 100644
--- a/Source/Core/Common/x64Emitter.h
+++ b/Source/Core/Common/x64Emitter.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Common.h"
-#include "MemoryUtil.h"
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
namespace Gen
{
@@ -161,8 +161,8 @@ private:
u16 indexReg;
};
-inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);}
-inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);}
+inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);}
+inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);}
inline OpArg MatR(X64Reg value) {return OpArg(0, SCALE_ATREG, value);}
inline OpArg MDisp(X64Reg value, int offset) {
return OpArg((u32)offset, SCALE_ATREG, value);
diff --git a/Source/Core/Common/x64FPURoundMode.cpp b/Source/Core/Common/x64FPURoundMode.cpp
index 34438d1..ae061cb 100644
--- a/Source/Core/Common/x64FPURoundMode.cpp
+++ b/Source/Core/Common/x64FPURoundMode.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "FPURoundMode.h"
-#include "CPUDetect.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/FPURoundMode.h"
#ifndef _WIN32
static const unsigned short FPU_ROUND_NEAR = 0 << 10;
diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp
index db3134a..8a9c4c6 100644
--- a/Source/Core/Core/ARDecrypt.cpp
+++ b/Source/Core/Core/ARDecrypt.cpp
@@ -6,14 +6,14 @@
// GCNcrypt - Gamecube AR Crypto Program
// Copyright (C) 2003-2004 Parasyte
-
-#include "ARDecrypt.h"
#include <algorithm>
#ifdef _WIN32
#include <windows.h>
#endif
+#include "Core/ARDecrypt.h"
+
namespace ActionReplay
{
@@ -370,11 +370,11 @@ bool batchdecrypt(u32 *codes, u16 size)
tmparray[1] = 0;
tmparray[2] = 4; // Skip crc
tmparray[3] = size;
- getbitstring(tmparray,tmparray2+1,11); // Game id
- getbitstring(tmparray,tmparray2+2,17); // Code id
- getbitstring(tmparray,tmparray2+3,1); // Master code
- getbitstring(tmparray,tmparray2+4,1); // Unknown
- getbitstring(tmparray,tmparray2+5,2); // Region
+ getbitstring(tmparray,tmparray2+1,11); // Game id
+ getbitstring(tmparray,tmparray2+2,17); // Code id
+ getbitstring(tmparray,tmparray2+3,1); // Master code
+ getbitstring(tmparray,tmparray2+4,1); // Unknown
+ getbitstring(tmparray,tmparray2+5,2); // Region
// Grab gameid and region from the last decrypted code
// Maybe check this against dolphin's GameID? - "code is for wrong game" type msg
@@ -473,7 +473,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
{
// Commented out since we just send the code anyways and hope for the best XD
//PanicAlert("Action Replay Code Decryption Error:\nCRC Check Failed\n\n"
- // "First Code in Block(should be verification code):\n%s", vCodes[0].c_str());
+ // "First Code in Block(should be verification code):\n%s", vCodes[0].c_str());
for (i = 0; i < (vCodes.size()<<1); i+=2)
{
diff --git a/Source/Core/Core/ARDecrypt.h b/Source/Core/Core/ARDecrypt.h
index 792518c..7c2e898 100644
--- a/Source/Core/Core/ARDecrypt.h
+++ b/Source/Core/Core/ARDecrypt.h
@@ -5,8 +5,9 @@
#pragma once
#include <vector>
-#include "Common.h"
-#include "ActionReplay.h"
+
+#include "Common/Common.h"
+#include "Core/ActionReplay.h"
namespace ActionReplay
{
diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp
index 5223903..411dbe0 100644
--- a/Source/Core/Core/ActionReplay.cpp
+++ b/Source/Core/Core/ActionReplay.cpp
@@ -22,14 +22,15 @@
#include <string>
#include <vector>
-#include "Common.h"
-#include "StringUtil.h"
-#include "HW/Memmap.h"
-#include "ActionReplay.h"
-#include "Core.h"
-#include "ARDecrypt.h"
-#include "LogManager.h"
-#include "ConfigManager.h"
+#include "Common/Common.h"
+#include "Common/LogManager.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ActionReplay.h"
+#include "Core/ARDecrypt.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/HW/Memmap.h"
namespace ActionReplay
{
@@ -37,37 +38,37 @@ namespace ActionReplay
enum
{
// Zero Code Types
- ZCODE_END = 0x00,
- ZCODE_NORM = 0x02,
- ZCODE_ROW = 0x03,
- ZCODE_04 = 0x04,
+ ZCODE_END = 0x00,
+ ZCODE_NORM = 0x02,
+ ZCODE_ROW = 0x03,
+ ZCODE_04 = 0x04,
// Conditional Codes
- CONDTIONAL_EQUAL = 0x01,
- CONDTIONAL_NOT_EQUAL = 0x02,
- CONDTIONAL_LESS_THAN_SIGNED = 0x03,
- CONDTIONAL_GREATER_THAN_SIGNED = 0x04,
- CONDTIONAL_LESS_THAN_UNSIGNED = 0x05,
- CONDTIONAL_GREATER_THAN_UNSIGNED = 0x06,
- CONDTIONAL_AND = 0x07, // bitwise AND
+ CONDTIONAL_EQUAL = 0x01,
+ CONDTIONAL_NOT_EQUAL = 0x02,
+ CONDTIONAL_LESS_THAN_SIGNED = 0x03,
+ CONDTIONAL_GREATER_THAN_SIGNED = 0x04,
+ CONDTIONAL_LESS_THAN_UNSIGNED = 0x05,
+ CONDTIONAL_GREATER_THAN_UNSIGNED = 0x06,
+ CONDTIONAL_AND = 0x07, // bitwise AND
// Conditional Line Counts
- CONDTIONAL_ONE_LINE = 0x00,
- CONDTIONAL_TWO_LINES = 0x01,
- CONDTIONAL_ALL_LINES_UNTIL = 0x02,
- CONDTIONAL_ALL_LINES = 0x03,
+ CONDTIONAL_ONE_LINE = 0x00,
+ CONDTIONAL_TWO_LINES = 0x01,
+ CONDTIONAL_ALL_LINES_UNTIL = 0x02,
+ CONDTIONAL_ALL_LINES = 0x03,
// Data Types
- DATATYPE_8BIT = 0x00,
- DATATYPE_16BIT = 0x01,
- DATATYPE_32BIT = 0x02,
- DATATYPE_32BIT_FLOAT = 0x03,
+ DATATYPE_8BIT = 0x00,
+ DATATYPE_16BIT = 0x01,
+ DATATYPE_32BIT = 0x02,
+ DATATYPE_32BIT_FLOAT = 0x03,
// Normal Code 0 Subtypes
- SUB_RAM_WRITE = 0x00,
- SUB_WRITE_POINTER = 0x01,
- SUB_ADD_CODE = 0x02,
- SUB_MASTER_CODE = 0x03,
+ SUB_RAM_WRITE = 0x00,
+ SUB_WRITE_POINTER = 0x01,
+ SUB_ADD_CODE = 0x02,
+ SUB_MASTER_CODE = 0x03,
};
// pointer to the code currently being run, (used by log messages that include the code name)
@@ -111,7 +112,7 @@ bool CompareValues(const u32 val1, const u32 val2, const int type);
// ----------------------
// AR Remote Functions
-void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
+void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad)
{
// Parses the Action Replay section of a game ini file.
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats
@@ -132,22 +133,17 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
}
}
- IniFile* inis[] = {&globalIni, &localIni};
- for (size_t i = 0; i < ArraySize(inis); ++i)
+ const IniFile* inis[2] = {&globalIni, &localIni};
+ for (const IniFile* ini : inis)
{
std::vector<std::string> lines;
std::vector<std::string> encryptedLines;
ARCode currentCode;
- inis[i]->GetLines("ActionReplay", lines);
+ ini->GetLines("ActionReplay", lines);
- std::vector<std::string>::const_iterator
- it = lines.begin(),
- lines_end = lines.end();
- for (; it != lines_end; ++it)
+ for (std::string line : lines)
{
- const std::string line = *it;
-
if (line.empty())
continue;
@@ -171,7 +167,7 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
currentCode.name = line.substr(1, line.size() - 1);
currentCode.active = enabledNames.find(currentCode.name) != enabledNames.end();
- currentCode.user_defined = (i == 1);
+ currentCode.user_defined = (ini == &localIni);
}
else
{
@@ -200,7 +196,7 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
{
// Encrypted AR code
// Decryption is done in "blocks", so we must push blocks into a vector,
- // then send to decrypt when a new block is encountered, or if it's the last block.
+ // then send to decrypt when a new block is encountered, or if it's the last block.
encryptedLines.push_back(pieces[0]+pieces[1]+pieces[2]);
}
}
@@ -298,7 +294,7 @@ bool RunCode(const ARCode &arcode)
// after a conditional code, skip lines if needed
if (skip_count)
{
- if (skip_count > 0) // skip x lines
+ if (skip_count > 0) // skip x lines
{
LogInfo("Line skipped");
--skip_count;
@@ -307,13 +303,13 @@ bool RunCode(const ARCode &arcode)
{
// skip all lines
LogInfo("All Lines skipped");
- return true; // don't need to iterate through the rest of the ops
+ return true; // don't need to iterate through the rest of the ops
}
else if (-CONDTIONAL_ALL_LINES_UNTIL == skip_count)
{
// skip until a "00000000 40000000" line is reached
LogInfo("Line skipped");
- if (0 == addr && 0x40000000 == data) // check for an endif line
+ if (addr == 0 && 0x40000000 == data) // check for an endif line
skip_count = 0;
}
@@ -647,7 +643,7 @@ bool Subtype_AddCode(const ARAddr addr, const u32 data)
LogInfo("--------");
const u32 read = Memory::Read_U32(new_addr);
- const float fread = *((float*)&read) + (float)data; // data contains an integer value
+ const float fread = *((float*)&read) + (float)data; // data contains an integer value
const u32 newval = *((u32*)&fread);
Memory::Write_U32(newval, new_addr);
LogInfo("Old Value %08x", read);
@@ -933,7 +929,7 @@ bool CompareValues(const u32 val1, const u32 val2, const int type)
case CONDTIONAL_AND:
LogInfo("Type 7: If And");
- return !!(val1 & val2); // bitwise AND
+ return !!(val1 & val2); // bitwise AND
break;
default: LogInfo("Unknown Compare type");
diff --git a/Source/Core/Core/ActionReplay.h b/Source/Core/Core/ActionReplay.h
index 484ad6e..8479785 100644
--- a/Source/Core/Core/ActionReplay.h
+++ b/Source/Core/Core/ActionReplay.h
@@ -4,7 +4,7 @@
#pragma once
-#include "IniFile.h"
+#include "Common/IniFile.h"
namespace ActionReplay
{
@@ -27,7 +27,7 @@ struct ARCode
void RunAllActive();
bool RunCode(const ARCode &arcode);
-void LoadCodes(IniFile &globalini, IniFile &localIni, bool forceLoad);
+void LoadCodes(const IniFile &globalini, const IniFile &localIni, bool forceLoad);
void LoadCodes(std::vector<ARCode> &_arCodes, IniFile &globalini, IniFile &localIni);
size_t GetCodeListSize();
ARCode GetARCode(size_t index);
diff --git a/Source/Core/Core/ArmMemTools.cpp b/Source/Core/Core/ArmMemTools.cpp
index 262c59f..0509db8 100644
--- a/Source/Core/Core/ArmMemTools.cpp
+++ b/Source/Core/Core/ArmMemTools.cpp
@@ -1,19 +1,6 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2013 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <stdio.h>
@@ -25,12 +12,12 @@
#include <execinfo.h>
#endif
-#include "Common.h"
-#include "MemTools.h"
-#include "HW/Memmap.h"
-#include "PowerPC/PowerPC.h"
-#include "PowerPC/JitInterface.h"
-#include "PowerPC/JitCommon/JitBase.h"
+#include "Common/Common.h"
+#include "Core/MemTools.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
namespace EMM
{
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp
index 7691421..1cef73a 100644
--- a/Source/Core/Core/Boot/Boot.cpp
+++ b/Source/Core/Core/Boot/Boot.cpp
@@ -3,37 +3,35 @@
// Refer to the license.txt file included.
-#include "Common.h" // Common
-#include "StringUtil.h"
-#include "FileUtil.h"
-#include "MathUtil.h"
-
-#include "../HLE/HLE.h" // Core
-#include "../PowerPC/PowerPC.h"
-#include "../PowerPC/PPCAnalyst.h"
-#include "../Core.h"
-#include "../HW/EXI_DeviceIPL.h"
-#include "../HW/Memmap.h"
-#include "../HW/ProcessorInterface.h"
-#include "../HW/DVDInterface.h"
-#include "../HW/VideoInterface.h"
-#include "../IPC_HLE/WII_IPC_HLE.h"
-
-#include "../Debugger/Debugger_SymbolMap.h" // Debugger
-
-#include "Boot_DOL.h"
-#include "Boot.h"
-#include "../Host.h"
-#include "../VolumeHandler.h"
-#include "../PatchEngine.h"
-#include "../PowerPC/SignatureDB.h"
-#include "../PowerPC/PPCSymbolDB.h"
-
-#include "../ConfigManager.h"
-#include "VolumeCreator.h" // DiscIO
-#include "NANDContentLoader.h"
-#include "Hash.h"
-#include "CommonPaths.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/Hash.h"
+#include "Common/MathUtil.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/PatchEngine.h"
+#include "Core/VolumeHandler.h"
+#include "Core/Boot/Boot.h"
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/SignatureDB.h"
+
+#include "DiscIO/VolumeCreator.h"
+#include "DiscIO/NANDContentLoader.h"
void CBoot::Load_FST(bool _bIsWii)
{
diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h
index d7df339..f580e8a 100644
--- a/Source/Core/Core/Boot/Boot.h
+++ b/Source/Core/Core/Boot/Boot.h
@@ -7,9 +7,9 @@
#include <cstdlib>
#include <string>
-#include "../CoreParameter.h"
+#include "Core/CoreParameter.h"
-#include "Volume.h"
+#include "DiscIO/Volume.h"
using DiscIO::IVolume;
typedef struct CountrySetting
diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
index f484b54..678ac06 100644
--- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp
+++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
@@ -2,27 +2,26 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "NandPaths.h"
-
-#include "../PowerPC/PowerPC.h"
-#include "../Core.h"
-#include "../HW/EXI_DeviceIPL.h"
-#include "../HW/Memmap.h"
-#include "../HW/DVDInterface.h"
-#include "../HW/CPU.h"
-
-#include "../VolumeHandler.h"
-#include "../PatchEngine.h"
-#include "../MemTools.h"
-
-#include "../ConfigManager.h"
-#include "VolumeCreator.h"
-#include "Boot.h"
-#include "HLE/HLE.h"
-#include "SettingsHandler.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+#include "Common/SettingsHandler.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/MemTools.h"
+#include "Core/PatchEngine.h"
+#include "Core/VolumeHandler.h"
+#include "Core/Boot/Boot.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "DiscIO/VolumeCreator.h"
void CBoot::RunFunction(u32 _iAddr)
{
@@ -49,37 +48,37 @@ bool CBoot::EmulatedBS2_GC()
// Write necessary values
// Here we write values to memory that the apploader does not take care of. Game info goes
- // to 0x80000000 according to yagcd 4.2.
+ // to 0x80000000 according to YAGCD 4.2.
DVDInterface::DVDRead(0x00000000, 0x80000000, 0x20); // write disc info
- Memory::Write_U32(0x0D15EA5E, 0x80000020); // booted from bootrom. 0xE5207C22 = booted from jtag
- Memory::Write_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
- // TODO determine why some games fail when using a retail id. (Seem to take different EXI paths, see ikaruga for example)
- Memory::Write_U32(0x10000006, 0x8000002C); // Console type - DevKit (retail ID == 0x00000003) see yagcd 4.2.1.1.2
+ Memory::Write_U32(0x0D15EA5E, 0x80000020); // Booted from bootrom. 0xE5207C22 = booted from jtag
+ Memory::Write_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
+ // TODO determine why some games fail when using a retail ID. (Seem to take different EXI paths, see Ikaruga for example)
+ Memory::Write_U32(0x10000006, 0x8000002C); // Console type - DevKit (retail ID == 0x00000003) see YAGCD 4.2.1.1.2
Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC
- ? 0 : 1, 0x800000CC); // fake the VI Init of the IPL (yagcd 4.2.1.4)
+ ? 0 : 1, 0x800000CC); // Fake the VI Init of the IPL (YAGCD 4.2.1.4)
- Memory::Write_U32(0x01000000, 0x800000d0); // ARAM Size. 16MB main + 4/16/32MB external (retail consoles have no external ARAM)
+ Memory::Write_U32(0x01000000, 0x800000d0); // ARAM Size. 16MB main + 4/16/32MB external (retail consoles have no external ARAM)
- Memory::Write_U32(0x09a7ec80, 0x800000F8); // Bus Clock Speed
- Memory::Write_U32(0x1cf7c580, 0x800000FC); // CPU Clock Speed
+ Memory::Write_U32(0x09a7ec80, 0x800000F8); // Bus Clock Speed
+ Memory::Write_U32(0x1cf7c580, 0x800000FC); // CPU Clock Speed
- Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi
- Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi
- Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000300); // Write default DFI Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000800); // Write default FPU Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000C00); // Write default Syscall Handler: rfi
- Memory::Write_U64((u64)CEXIIPL::GetGCTime() * (u64)40500000, 0x800030D8); // preset time base ticks
+ Memory::Write_U64((u64)CEXIIPL::GetGCTime() * (u64)40500000, 0x800030D8); // Preset time base ticks
// HIO checks this
- //Memory::Write_U16(0x8200, 0x000030e6); // Console type
+ //Memory::Write_U16(0x8200, 0x000030e6); // Console type
HLE::Patch(0x81300000, "OSReport"); // HLE OSReport for Apploader
// Load Apploader to Memory - The apploader is hardcoded to begin at 0x2440 on the disc,
- // but the size can differ between discs. Compare with yagcd chap 13.
+ // but the size can differ between discs. Compare with YAGCD chap 13.
u32 iAppLoaderOffset = 0x2440;
- u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
- u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14) + VolumeHandler::Read32(iAppLoaderOffset + 0x18);
+ u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10);
+ u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14) + VolumeHandler::Read32(iAppLoaderOffset + 0x18);
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
{
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
@@ -90,9 +89,9 @@ bool CBoot::EmulatedBS2_GC()
// Setup pointers like real BS2 does
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC)
{
- PowerPC::ppcState.gpr[1] = 0x81566550; // StackPointer, used to be set to 0x816ffff0
- PowerPC::ppcState.gpr[2] = 0x81465cc0; // global pointer to Small Data Area 2 Base (haven't seen anything use it...meh)
- PowerPC::ppcState.gpr[13] = 0x81465320; // global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
+ PowerPC::ppcState.gpr[1] = 0x81566550; // StackPointer, used to be set to 0x816ffff0
+ PowerPC::ppcState.gpr[2] = 0x81465cc0; // Global pointer to Small Data Area 2 Base (haven't seen anything use it...meh)
+ PowerPC::ppcState.gpr[13] = 0x81465320; // Global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
}
else
{
@@ -131,9 +130,9 @@ bool CBoot::EmulatedBS2_GC()
RunFunction(iAppLoaderMain);
- u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
- u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
- u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
+ u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
+ u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
+ u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
@@ -232,55 +231,55 @@ bool CBoot::SetupWiiMemory(IVolume::ECountry country)
Wiibrew. These values are needed for the games to function correctly. A few
values in this region will also be placed here by the game as it boots.
They are:
- 0x80000038 Start of FST
- 0x8000003c Size of FST Size
- 0x80000060 Copyright code
+ 0x80000038 Start of FST
+ 0x8000003c Size of FST Size
+ 0x80000060 Copyright code
*/
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code
- Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
- Memory::Write_U32(0x00000001, 0x00000024); // Unknown
- Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
- Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
- Memory::Write_U32(0x00000000, 0x00000030); // Init
- Memory::Write_U32(0x817FEC60, 0x00000034); // Init
+ Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
+ Memory::Write_U32(0x00000001, 0x00000024); // Unknown
+ Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
+ Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
+ Memory::Write_U32(0x00000000, 0x00000030); // Init
+ Memory::Write_U32(0x817FEC60, 0x00000034); // Init
// 38, 3C should get start, size of FST through apploader
- Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
- Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
- Memory::Write_U32(Memory::REALRAM_SIZE, 0x000000f0); // "Simulated memory size" (debug mode?)
- Memory::Write_U32(0x8179b500, 0x000000f4); // __start
- Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
- Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
- Memory::Write_U16(0x0000, 0x000030e6); // Console type
- Memory::Write_U32(0x00000000, 0x000030c0); // EXI
- Memory::Write_U32(0x00000000, 0x000030c4); // EXI
- Memory::Write_U32(0x00000000, 0x000030dc); // Time
- Memory::Write_U32(0x00000000, 0x000030d8); // Time
- Memory::Write_U16(0x8201, 0x000030e6); // Dev console / debug capable
- Memory::Write_U32(0x00000000, 0x000030f0); // Apploader
- Memory::Write_U32(0x01800000, 0x00003100); // BAT
- Memory::Write_U32(0x01800000, 0x00003104); // BAT
- Memory::Write_U32(0x00000000, 0x0000310c); // Init
- Memory::Write_U32(0x8179d500, 0x00003110); // Init
- Memory::Write_U32(0x04000000, 0x00003118); // Unknown
- Memory::Write_U32(0x04000000, 0x0000311c); // BAT
- Memory::Write_U32(0x93400000, 0x00003120); // BAT
- Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
- Memory::Write_U32(0x93ae0000, 0x00003128); // Init - MEM2 high
- Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low
- Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high
- Memory::Write_U32(0x00000012, 0x00003138); // Console type
+ Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
+ Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
+ Memory::Write_U32(Memory::REALRAM_SIZE, 0x000000f0); // "Simulated memory size" (debug mode?)
+ Memory::Write_U32(0x8179b500, 0x000000f4); // __start
+ Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
+ Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
+ Memory::Write_U16(0x0000, 0x000030e6); // Console type
+ Memory::Write_U32(0x00000000, 0x000030c0); // EXI
+ Memory::Write_U32(0x00000000, 0x000030c4); // EXI
+ Memory::Write_U32(0x00000000, 0x000030dc); // Time
+ Memory::Write_U32(0x00000000, 0x000030d8); // Time
+ Memory::Write_U16(0x8201, 0x000030e6); // Dev console / debug capable
+ Memory::Write_U32(0x00000000, 0x000030f0); // Apploader
+ Memory::Write_U32(0x01800000, 0x00003100); // BAT
+ Memory::Write_U32(0x01800000, 0x00003104); // BAT
+ Memory::Write_U32(0x00000000, 0x0000310c); // Init
+ Memory::Write_U32(0x8179d500, 0x00003110); // Init
+ Memory::Write_U32(0x04000000, 0x00003118); // Unknown
+ Memory::Write_U32(0x04000000, 0x0000311c); // BAT
+ Memory::Write_U32(0x93400000, 0x00003120); // BAT
+ Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
+ Memory::Write_U32(0x93ae0000, 0x00003128); // Init - MEM2 high
+ Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low
+ Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high
+ Memory::Write_U32(0x00000012, 0x00003138); // Console type
// 40 is copied from 88 after running apploader
- Memory::Write_U32(0x00090204, 0x00003140); // IOS revision (IOS9, v2.4)
- Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format (June 25, 2007)
- Memory::Write_U16(0x0113, 0x0000315e); // Apploader
- Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
- Memory::Write_U32(0x00000000, 0x00003160); // Init semaphore (sysmenu waits for this to clear)
- Memory::Write_U32(0x00090204, 0x00003188); // Expected IOS revision
+ Memory::Write_U32(0x00090204, 0x00003140); // IOS revision (IOS9, v2.4)
+ Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format (June 25, 2007)
+ Memory::Write_U16(0x0113, 0x0000315e); // Apploader
+ Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
+ Memory::Write_U32(0x00000000, 0x00003160); // Init semaphore (sysmenu waits for this to clear)
+ Memory::Write_U32(0x00090204, 0x00003188); // Expected IOS revision
- Memory::Write_U8(0x80, 0x0000315c); // OSInit
- Memory::Write_U16(0x0000, 0x000030e0); // PADInit
- Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
+ Memory::Write_U8(0x80, 0x0000315c); // OSInit
+ Memory::Write_U16(0x0000, 0x000030e0); // PADInit
+ Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
// Fake the VI Init of the IPL
Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC);
@@ -321,13 +320,13 @@ bool CBoot::EmulatedBS2_Wii()
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
m_MSR.FP = 1;
- Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi
- Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi
- Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000300); // Write default DFI Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000800); // Write default FPU Handler: rfi
+ Memory::Write_U32(0x4c000064, 0x80000C00); // Write default Syscall Handler: rfi
- HLE::Patch(0x81300000, "OSReport"); // HLE OSReport for Apploader
+ HLE::Patch(0x81300000, "OSReport"); // HLE OSReport for Apploader
- PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
+ PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
u32 iAppLoaderOffset = 0x2440; // 0x1c40;
@@ -372,9 +371,9 @@ bool CBoot::EmulatedBS2_Wii()
RunFunction(iAppLoaderMain);
- u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
- u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
- u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
+ u32 iRamAddress = Memory::ReadUnchecked_U32(0x81300004);
+ u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
+ u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
diff --git a/Source/Core/Core/Boot/Boot_DOL.cpp b/Source/Core/Core/Boot/Boot_DOL.cpp
index 5831657..a641a9b 100644
--- a/Source/Core/Core/Boot/Boot_DOL.cpp
+++ b/Source/Core/Core/Boot/Boot_DOL.cpp
@@ -2,10 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Boot_DOL.h"
-#include "FileUtil.h"
-#include "../HW/Memmap.h"
-#include "CommonFuncs.h"
+#include "Common/CommonFuncs.h"
+#include "Common/FileUtil.h"
+
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/HW/Memmap.h"
CDolLoader::CDolLoader(u8* _pBuffer, u32 _Size)
: m_isWii(false)
diff --git a/Source/Core/Core/Boot/Boot_DOL.h b/Source/Core/Core/Boot/Boot_DOL.h
index 23214ff..e406875 100644
--- a/Source/Core/Core/Boot/Boot_DOL.h
+++ b/Source/Core/Core/Boot/Boot_DOL.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class CDolLoader
{
diff --git a/Source/Core/Core/Boot/Boot_ELF.cpp b/Source/Core/Core/Boot/Boot_ELF.cpp
index 7253326..5f4b41b 100644
--- a/Source/Core/Core/Boot/Boot_ELF.cpp
+++ b/Source/Core/Core/Boot/Boot_ELF.cpp
@@ -2,12 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../PowerPC/PowerPC.h"
-#include "Boot.h"
-#include "../HLE/HLE.h"
-#include "Boot_ELF.h"
-#include "ElfReader.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+
+#include "Core/Boot/Boot.h"
+#include "Core/Boot/Boot_ELF.h"
+#include "Core/Boot/ElfReader.h"
+#include "Core/HLE/HLE.h"
+#include "Core/PowerPC/PowerPC.h"
bool CBoot::IsElfWii(const char *filename)
{
diff --git a/Source/Core/Core/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Boot/Boot_WiiWAD.cpp
index ac950d5..99235c8 100644
--- a/Source/Core/Core/Boot/Boot_WiiWAD.cpp
+++ b/Source/Core/Core/Boot/Boot_WiiWAD.cpp
@@ -2,25 +2,26 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Boot.h"
-#include "../PowerPC/PowerPC.h"
-#include "../HLE/HLE.h"
-#include "../HW/Memmap.h"
-#include "../ConfigManager.h"
-#include "../PatchEngine.h"
-#include "../IPC_HLE/WII_IPC_HLE.h"
-#include "../IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
-
-#include "WiiWad.h"
-#include "NANDContentLoader.h"
-#include "FileUtil.h"
-#include "Boot_DOL.h"
-#include "Volume.h"
-#include "VolumeCreator.h"
-#include "CommonPaths.h"
-
#include <memory>
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/PatchEngine.h"
+#include "Core/Boot/Boot.h"
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/Memmap.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "DiscIO/NANDContentLoader.h"
+#include "DiscIO/Volume.h"
+#include "DiscIO/VolumeCreator.h"
+#include "DiscIO/WiiWad.h"
+
static u32 state_checksum(u32 *buf, int len)
{
u32 checksum = 0;
diff --git a/Source/Core/Core/Boot/ElfReader.cpp b/Source/Core/Core/Boot/ElfReader.cpp
index bfbeb91..21fc418 100644
--- a/Source/Core/Core/Boot/ElfReader.cpp
+++ b/Source/Core/Core/Boot/ElfReader.cpp
@@ -4,11 +4,12 @@
#include <string>
-#include "Common.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-#include "../HW/Memmap.h"
-#include "../PowerPC/PPCSymbolDB.h"
-#include "ElfReader.h"
+#include "Common/Common.h"
+
+#include "Core/Boot/ElfReader.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
void bswap(Elf32_Word &w) {w = Common::swap32(w);}
void bswap(Elf32_Half &w) {w = Common::swap16(w);}
diff --git a/Source/Core/Core/Boot/ElfReader.h b/Source/Core/Core/Boot/ElfReader.h
index 0d2890e..a789515 100644
--- a/Source/Core/Core/Boot/ElfReader.h
+++ b/Source/Core/Core/Boot/ElfReader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "ElfTypes.h"
+#include "Core/Boot/ElfTypes.h"
enum KnownElfTypes
{
@@ -66,7 +66,7 @@ public:
return GetPtr(segments[segment].p_offset);
}
u32 GetSectionAddr(SectionID section) const { return sectionAddrs[section]; }
- int GetSectionSize(SectionID section) const { return sections[section].sh_size; }
+ int GetSectionSize(SectionID section) const { return sections[section].sh_size; }
SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found
bool DidRelocate() {
diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp
index b3aeeae..56e9898 100644
--- a/Source/Core/Core/BootManager.cpp
+++ b/Source/Core/Core/BootManager.cpp
@@ -23,22 +23,22 @@
#include <string>
#include <vector>
-#include "CommonTypes.h"
-#include "CommonPaths.h"
-#include "IniFile.h"
-#include "BootManager.h"
-#include "Volume.h"
-#include "VolumeCreator.h"
-#include "ConfigManager.h"
-#include "SysConf.h"
-#include "Core.h"
-#include "Host.h"
-#include "VideoBackendBase.h"
-#include "Movie.h"
-#include "NetPlayProto.h"
-#include "HW/WiimoteReal/WiimoteReal.h"
-#include "HW/SI.h"
-#include "HW/EXI.h"
+#include "DiscIO/Volume.h"
+#include "DiscIO/VolumeCreator.h"
+#include "Common/CommonTypes.h"
+#include "Common/CommonPaths.h"
+#include "Common/IniFile.h"
+#include "Common/SysConf.h"
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "VideoCommon/VideoBackendBase.h"
namespace BootManager
{
@@ -132,27 +132,27 @@ bool BootCore(const std::string& _rFilename)
config_cache.bSetFramelimit = false;
// General settings
- game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
- game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
- game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
- game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU);
- game_ini.Get("Core", "TLBHack", &StartUp.bTLBHack, StartUp.bTLBHack);
- game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
- game_ini.Get("Core", "VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack);
- game_ini.Get("Core", "SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
- game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
- game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks);
- game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
- game_ini.Get("Core", "DSPThread", &StartUp.bDSPThread, StartUp.bDSPThread);
- game_ini.Get("Core", "GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend);
- game_ini.Get("Core", "CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore);
- game_ini.Get("Core", "HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
- if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit))
+ game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
+ game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
+ game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
+ game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU);
+ game_ini.Get("Core", "TLBHack", &StartUp.bTLBHack, StartUp.bTLBHack);
+ game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
+ game_ini.Get("Core", "VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack);
+ game_ini.Get("Core", "SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
+ game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
+ game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks);
+ game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
+ game_ini.Get("Core", "DSPThread", &StartUp.bDSPThread, StartUp.bDSPThread);
+ game_ini.Get("Core", "GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend);
+ game_ini.Get("Core", "CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore);
+ game_ini.Get("Core", "HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
+ if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit))
config_cache.bSetFramelimit = true;
- if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume))
+ if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume))
config_cache.bSetVolume = true;
- game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT);
- game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend);
+ game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT);
+ game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend);
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)
diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt
index 504b8ad..0b9c774 100644
--- a/Source/Core/Core/CMakeLists.txt
+++ b/Source/Core/Core/CMakeLists.txt
@@ -2,7 +2,6 @@ set(SRCS ActionReplay.cpp
ARDecrypt.cpp
BootManager.cpp
ConfigManager.cpp
- Console.cpp
Core.cpp
CoreParameter.cpp
CoreTiming.cpp
@@ -107,6 +106,7 @@ set(SRCS ActionReplay.cpp
HW/Memmap.cpp
HW/MemmapFunctions.cpp
HW/MemoryInterface.cpp
+ HW/MMIO.cpp
HW/ProcessorInterface.cpp
HW/SI.cpp
HW/SI_DeviceAMBaseboard.cpp
@@ -119,7 +119,6 @@ set(SRCS ActionReplay.cpp
HW/StreamADPCM.cpp
HW/SystemTimers.cpp
HW/VideoInterface.cpp
- HW/WII_IOB.cpp
HW/WII_IPC.cpp
HW/Wiimote.cpp
HW/WiimoteEmu/WiimoteEmu.cpp
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index 68c0099..2c00178 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
-#include "ConfigManager.h"
-#include "IniFile.h"
-#include "FileUtil.h"
-#include "NANDContentLoader.h"
-#include "HW/SI.h"
+#include "DiscIO/NANDContentLoader.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/SI.h"
SConfig* SConfig::m_Instance;
@@ -142,7 +142,7 @@ void SConfig::SaveSettings()
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
// General
- ini.Set("General", "LastFilename", m_LastFilename);
+ ini.Set("General", "LastFilename", m_LastFilename);
ini.Set("General", "ShowLag", m_ShowLag);
// ISO folders
@@ -163,29 +163,28 @@ void SConfig::SaveSettings()
}
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
- ini.Set("General", "NANDRootPath", m_NANDPath);
- ini.Set("General", "WirelessMac", m_WirelessMac);
+ ini.Set("General", "NANDRootPath", m_NANDPath);
+ ini.Set("General", "WirelessMac", m_WirelessMac);
#ifdef USE_GDBSTUB
ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort);
#endif
// Interface
- ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
- ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
- ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
- ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
- ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
- ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX
- ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX
- ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
- ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
- ini.Set("Interface", "Language", m_InterfaceLanguage);
- ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
- ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
- ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
- ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow);
- ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
- ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name);
+ ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
+ ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
+ ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
+ ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
+ ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
+ ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX
+ ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX
+ ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
+ ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
+ ini.Set("Interface", "Language", m_InterfaceLanguage);
+ ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
+ ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
+ ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
+ ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow);
+ ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name);
// Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++)
@@ -196,56 +195,56 @@ void SConfig::SaveSettings()
}
// Display
- ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
- ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
- ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
- ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
- ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos);
- ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth);
- ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
- ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
- ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop);
- ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
- ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
- ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);
+ ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
+ ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
+ ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
+ ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
+ ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos);
+ ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth);
+ ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
+ ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
+ ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop);
+ ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
+ ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
+ ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);
// Game List Control
- ini.Set("GameList", "ListDrives", m_ListDrives);
- ini.Set("GameList", "ListWad", m_ListWad);
- ini.Set("GameList", "ListWii", m_ListWii);
- ini.Set("GameList", "ListGC", m_ListGC);
- ini.Set("GameList", "ListJap", m_ListJap);
- ini.Set("GameList", "ListPal", m_ListPal);
- ini.Set("GameList", "ListUsa", m_ListUsa);
- ini.Set("GameList", "ListFrance", m_ListFrance);
- ini.Set("GameList", "ListItaly", m_ListItaly);
- ini.Set("GameList", "ListKorea", m_ListKorea);
- ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
- ini.Set("GameList", "ListUnknown", m_ListUnknown);
- ini.Set("GameList", "ListSort", m_ListSort);
+ ini.Set("GameList", "ListDrives", m_ListDrives);
+ ini.Set("GameList", "ListWad", m_ListWad);
+ ini.Set("GameList", "ListWii", m_ListWii);
+ ini.Set("GameList", "ListGC", m_ListGC);
+ ini.Set("GameList", "ListJap", m_ListJap);
+ ini.Set("GameList", "ListPal", m_ListPal);
+ ini.Set("GameList", "ListUsa", m_ListUsa);
+ ini.Set("GameList", "ListFrance", m_ListFrance);
+ ini.Set("GameList", "ListItaly", m_ListItaly);
+ ini.Set("GameList", "ListKorea", m_ListKorea);
+ ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
+ ini.Set("GameList", "ListUnknown", m_ListUnknown);
+ ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core
- ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
- ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
- ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem);
- ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
- ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
- ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE);
- ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
- ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
- ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
- ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
- ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
- ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
- ini.Set("Core", "DPL2Decoder", m_LocalCoreStartupParameter.bDPL2Decoder);
- ini.Set("Core", "Latency", m_LocalCoreStartupParameter.iLatency);
- ini.Set("Core", "MemcardAPath", m_strMemoryCardA);
- ini.Set("Core", "MemcardBPath", m_strMemoryCardB);
- ini.Set("Core", "SlotA", m_EXIDevice[0]);
- ini.Set("Core", "SlotB", m_EXIDevice[1]);
- ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
- ini.Set("Core", "BBA_MAC", m_bba_mac);
+ ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
+ ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
+ ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem);
+ ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
+ ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
+ ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE);
+ ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
+ ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
+ ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
+ ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
+ ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
+ ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
+ ini.Set("Core", "DPL2Decoder", m_LocalCoreStartupParameter.bDPL2Decoder);
+ ini.Set("Core", "Latency", m_LocalCoreStartupParameter.iLatency);
+ ini.Set("Core", "MemcardAPath", m_strMemoryCardA);
+ ini.Set("Core", "MemcardBPath", m_strMemoryCardB);
+ ini.Set("Core", "SlotA", m_EXIDevice[0]);
+ ini.Set("Core", "SlotB", m_EXIDevice[1]);
+ ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
+ ini.Set("Core", "BBA_MAC", m_bba_mac);
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
{
ini.Set("Core", StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
@@ -254,12 +253,12 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
- ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
- ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
- ini.Set("Core", "FrameLimit", m_Framelimit);
+ ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
+ ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
+ ini.Set("Core", "FrameLimit", m_Framelimit);
// GFX Backend
- ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend);
+ ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend);
// Movie
ini.Set("Movie", "PauseMovie", m_PauseMovie);
@@ -287,7 +286,7 @@ void SConfig::LoadSettings()
// General
{
- ini.Get("General", "LastFilename", &m_LastFilename);
+ ini.Get("General", "LastFilename", &m_LastFilename);
ini.Get("General", "ShowLag", &m_ShowLag, false);
#ifdef USE_GDBSTUB
ini.Get("General", "GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1);
@@ -306,119 +305,118 @@ void SConfig::LoadSettings()
}
}
- ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false);
+ ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false);
- ini.Get("General", "NANDRootPath", &m_NANDPath);
+ ini.Get("General", "NANDRootPath", &m_NANDPath);
m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
- ini.Get("General", "WirelessMac", &m_WirelessMac);
+ ini.Get("General", "WirelessMac", &m_WirelessMac);
}
{
// Interface
- ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, true);
- ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
- ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true);
- ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
- ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
- ini.Get("Interface", "MainWindowPosX", &m_LocalCoreStartupParameter.iPosX, 100);
- ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100);
- ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800);
- ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600);
- ini.Get("Interface", "Language", &m_InterfaceLanguage, 0);
- ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
- ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);
- ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false);
- ini.Get("Interface", "ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
- ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false);
- ini.Get("Interface", "ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
+ ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, true);
+ ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
+ ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true);
+ ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
+ ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
+ ini.Get("Interface", "MainWindowPosX", &m_LocalCoreStartupParameter.iPosX, 100);
+ ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100);
+ ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800);
+ ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600);
+ ini.Get("Interface", "Language", &m_InterfaceLanguage, 0);
+ ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
+ ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);
+ ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false);
+ ini.Get("Interface", "ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
+ ini.Get("Interface", "ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
// Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++)
{
ini.Get("Hotkeys", g_HKData[i].IniText,
- &m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey);
+ &m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey);
ini.Get("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier",
- &m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier);
+ &m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier);
}
// Display
- ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
- ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "Auto");
- ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
- ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, -1);
- ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, -1);
- ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);
- ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
- ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
- ini.Get("Display", "KeepWindowOnTop", &m_LocalCoreStartupParameter.bKeepWindowOnTop, false);
- ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false);
- ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true);
- ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);
+ ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
+ ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "Auto");
+ ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
+ ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, -1);
+ ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, -1);
+ ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);
+ ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
+ ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
+ ini.Get("Display", "KeepWindowOnTop", &m_LocalCoreStartupParameter.bKeepWindowOnTop, false);
+ ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false);
+ ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true);
+ ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);
// Game List Control
- ini.Get("GameList", "ListDrives", &m_ListDrives, false);
- ini.Get("GameList", "ListWad", &m_ListWad, true);
- ini.Get("GameList", "ListWii", &m_ListWii, true);
- ini.Get("GameList", "ListGC", &m_ListGC, true);
- ini.Get("GameList", "ListJap", &m_ListJap, true);
- ini.Get("GameList", "ListPal", &m_ListPal, true);
- ini.Get("GameList", "ListUsa", &m_ListUsa, true);
-
- ini.Get("GameList", "ListFrance", &m_ListFrance, true);
- ini.Get("GameList", "ListItaly", &m_ListItaly, true);
- ini.Get("GameList", "ListKorea", &m_ListKorea, true);
- ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
- ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
- ini.Get("GameList", "ListSort", &m_ListSort, 3);
- ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
+ ini.Get("GameList", "ListDrives", &m_ListDrives, false);
+ ini.Get("GameList", "ListWad", &m_ListWad, true);
+ ini.Get("GameList", "ListWii", &m_ListWii, true);
+ ini.Get("GameList", "ListGC", &m_ListGC, true);
+ ini.Get("GameList", "ListJap", &m_ListJap, true);
+ ini.Get("GameList", "ListPal", &m_ListPal, true);
+ ini.Get("GameList", "ListUsa", &m_ListUsa, true);
+
+ ini.Get("GameList", "ListFrance", &m_ListFrance, true);
+ ini.Get("GameList", "ListItaly", &m_ListItaly, true);
+ ini.Get("GameList", "ListKorea", &m_ListKorea, true);
+ ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
+ ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
+ ini.Get("GameList", "ListSort", &m_ListSort, 3);
+ ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core
- ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
+ ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_ARM
- ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3);
+ ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3);
#else
- ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
+ ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
#endif
- ini.Get("Core", "Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
- ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);
- ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true);
- ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true);
- ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
- ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
- ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
- ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader);
- ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
- ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
- ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, false);
- ini.Get("Core", "Latency", &m_LocalCoreStartupParameter.iLatency, 2);
- ini.Get("Core", "MemcardAPath", &m_strMemoryCardA);
- ini.Get("Core", "MemcardBPath", &m_strMemoryCardB);
- ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD);
- ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_NONE);
- ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE);
- ini.Get("Core", "BBA_MAC", &m_bba_mac);
- ini.Get("Core", "TimeProfiling",&m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
- ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false);
+ ini.Get("Core", "Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
+ ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);
+ ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true);
+ ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true);
+ ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
+ ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
+ ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
+ ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader);
+ ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
+ ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
+ ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, false);
+ ini.Get("Core", "Latency", &m_LocalCoreStartupParameter.iLatency, 2);
+ ini.Get("Core", "MemcardAPath", &m_strMemoryCardA);
+ ini.Get("Core", "MemcardBPath", &m_strMemoryCardB);
+ ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD);
+ ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_NONE);
+ ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE);
+ ini.Get("Core", "BBA_MAC", &m_bba_mac);
+ ini.Get("Core", "TimeProfiling", &m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
+ ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false);
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
{
ini.Get("Core", StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);
}
- ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
- ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
- ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
- ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true);
- ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
- ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
- ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
- ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.bTLBHack, false);
- ini.Get("Core", "BBDumpPort", &m_LocalCoreStartupParameter.iBBDumpPort, -1);
- ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeamSpeedHack, false);
- ini.Get("Core", "SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false);
- ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
- ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
- ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
+ ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
+ ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
+ ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
+ ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true);
+ ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
+ ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
+ ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
+ ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.bTLBHack, false);
+ ini.Get("Core", "BBDumpPort", &m_LocalCoreStartupParameter.iBBDumpPort, -1);
+ ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeamSpeedHack, false);
+ ini.Get("Core", "SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false);
+ ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
+ ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
+ ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
// GFX Backend
ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, "");
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 01cf23d..e349763 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -7,10 +7,10 @@
#include <string>
#include <vector>
-#include "Boot/Boot.h"
-#include "HW/EXI_Device.h"
-#include "HW/SI_Device.h"
-#include "SysConf.h"
+#include "Common/SysConf.h"
+#include "Core/Boot/Boot.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/SI_Device.h"
// DSP Backend Types
#define BACKEND_NULLSOUND _trans("No audio output")
@@ -55,7 +55,6 @@ struct SConfig : NonCopyable
bool m_InterfaceStatusbar;
bool m_InterfaceLogWindow;
bool m_InterfaceLogConfigWindow;
- bool m_InterfaceConsole;
bool m_ListDrives;
bool m_ListWad;
diff --git a/Source/Core/Core/Console.cpp b/Source/Core/Core/Console.cpp
deleted file mode 100644
index 2d48d0b..0000000
--- a/Source/Core/Core/Console.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include <iostream>
-#include <cstring>
-
-#include "Common.h"
-#include "Thread.h"
-#include "HW/Memmap.h"
-#include "PowerPC/PPCAnalyst.h"
-#include "PowerPC/PPCTables.h"
-#include "CoreTiming.h"
-#include "Core.h"
-#include "PowerPC/JitCommon/JitBase.h"
-#include "PowerPC/PPCSymbolDB.h"
-#include "PowerPCDisasm.h"
-#include "Console.h"
-
-#define CASE1(x) if (!strcmp(cmd, (x)))
-#define CASE(x) else if (!strcmp(cmd, (x)))
-
-void Console_Submit(const char *cmd)
-{
- CASE1("r")
- {
- Core::StartTrace(false);
- INFO_LOG(CONSOLE, "Read tracing started.");
- }
- CASE("w")
- {
- Core::StartTrace(true);
- INFO_LOG(CONSOLE, "Write tracing started.");
- }
- CASE("trans")
- {
- TCHAR temp[256];
- u32 addr;
- sscanf(cmd, "%s %08x", temp, &addr);
-
- if (addr)
- {
-#if MAX_LOGLEVEL >= INFO_LEVEL
- u32 EA =
- Memory::TranslateAddress(addr, Memory::FLAG_NO_EXCEPTION);
- INFO_LOG(CONSOLE, "EA 0x%08x to 0x%08x", addr, EA);
-#endif
- }
- else
- {
- DEBUG_LOG(CONSOLE, "Syntax: trans ADDR");
- }
- }
- CASE("call")
- {
- TCHAR temp[256];
- u32 addr;
- sscanf(cmd, "%s %08x", temp, &addr);
- if (addr)
- {
- g_symbolDB.PrintCalls(addr);
- }
- else
- {
- DEBUG_LOG(CONSOLE, "Syntax: call ADDR");
- }
- }
- CASE("llac")
- {
- TCHAR temp[256];
- u32 addr;
- sscanf(cmd, "%s %08x", temp, &addr);
- if (addr)
- {
- g_symbolDB.PrintCallers(addr);
- }
- else
- {
- DEBUG_LOG(CONSOLE, "Syntax: llac ADDR");
- }
- }
- CASE("pend")
- {
- CoreTiming::LogPendingEvents();
- }
- CASE("dump")
- {
- char temp[256];
- char filename[256];
- u32 start;
- u32 end;
- sscanf(cmd, "%s %08x %08x %s", temp, &start, &end, filename);
-
- File::IOFile f(filename, "wb");
- for (u32 i = start; i < end; i++)
- {
- u8 b = Memory::ReadUnchecked_U8(i);
- fputc(b, f.GetHandle());
- }
- INFO_LOG(CONSOLE, "Dumped from %08x to %08x to %s",start,end,filename);
- }
- CASE("disa")
- {
- u32 start;
- u32 end;
- TCHAR temp[256];
- sscanf(cmd, "%s %08x %08x", temp, &start, &end);
- char disasm[256];
- for (u32 addr = start; addr <= end; addr += 4)
- {
- u32 data = Memory::ReadUnchecked_U32(addr);
- DisassembleGekko(data, addr, disasm, 256);
- DEBUG_LOG(CONSOLE, "%08x: %08x: %s\n", addr, data, disasm);
- }
- }
- CASE("help")
- {
- ERROR_LOG(CONSOLE, "Dolphin Console Command List");
- ERROR_LOG(CONSOLE, "scan ADDR - will find functions that are called by this function");
- ERROR_LOG(CONSOLE, "call ADDR - will find functions that call this function");
- ERROR_LOG(CONSOLE, "dump START_A END_A FILENAME - will dump memory between START_A and END_A");
- ERROR_LOG(CONSOLE, "help - guess what this does :P");
- ERROR_LOG(CONSOLE, "lisd - list signature database");
- ERROR_LOG(CONSOLE, "lisf - list functions");
- ERROR_LOG(CONSOLE, "trans ADDR - translate address");
- }
- CASE("lisd")
- {
- // PPCAnalyst::ListDB();
- }
- CASE("ipro")
- {
- PPCTables::PrintInstructionRunCounts();
- }
- CASE("lisf")
- {
- g_symbolDB.List();
- }
- else
- {
- ERROR_LOG(CONSOLE, "Invalid command");
- }
-}
-
-#undef CASE1
-#undef CASE
diff --git a/Source/Core/Core/Console.h b/Source/Core/Core/Console.h
deleted file mode 100644
index 64779aa..0000000
--- a/Source/Core/Core/Console.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-
-// Simple debugging console currently residing in the Logging window. Not used much.
-
-#pragma once
-
-void Console_Submit(const char *cmd);
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index 716c9f4..4c2eb66 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -4,62 +4,60 @@
#ifdef _WIN32
#include <windows.h>
-#include "EmuWindow.h"
+#include "VideoCommon/EmuWindow.h"
#endif
-#include "Atomic.h"
-#include "Thread.h"
-#include "Timer.h"
-#include "Common.h"
-#include "CommonPaths.h"
-#include "StringUtil.h"
-#include "MathUtil.h"
-#include "MemoryUtil.h"
-
-#include "Core.h"
-#include "CPUDetect.h"
-#include "CoreTiming.h"
-#include "Boot/Boot.h"
-#include "FifoPlayer/FifoPlayer.h"
-
-#include "HW/Memmap.h"
-#include "HW/ProcessorInterface.h"
-#include "HW/GPFifo.h"
-#include "HW/CPU.h"
-#include "HW/GCPad.h"
-#include "HW/Wiimote.h"
-#include "HW/HW.h"
-#include "HW/DSP.h"
-#include "HW/GPFifo.h"
-#include "HW/AudioInterface.h"
-#include "HW/VideoInterface.h"
-#include "HW/EXI.h"
-#include "HW/SystemTimers.h"
-
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-
-#include "PowerPC/PowerPC.h"
+#include "AudioCommon/AudioCommon.h"
+
+#include "DiscIO/FileMonitor.h"
+
+#include "Common/Atomic.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/CPUDetect.h"
+#include "Common/LogManager.h"
+#include "Common/MathUtil.h"
+#include "Common/MemoryUtil.h"
+#include "Common/StringUtil.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/DSPEmulator.h"
+#include "Core/Host.h"
+#include "Core/MemTools.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/PatchEngine.h"
+#include "Core/State.h"
+#include "Core/VolumeHandler.h"
+#include "Core/Boot/Boot.h"
+#include "Core/FifoPlayer/FifoPlayer.h"
+
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/HW.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/HW/Wiimote.h"
+
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+
+#include "Core/PowerPC/PowerPC.h"
#ifdef USE_GDBSTUB
-#include "PowerPC/GDBStub.h"
+#include "Core/PowerPC/GDBStub.h"
#endif
-#include "DSPEmulator.h"
-#include "ConfigManager.h"
-#include "VideoBackendBase.h"
-#include "AudioCommon.h"
-#include "OnScreenDisplay.h"
-
-#include "VolumeHandler.h"
-#include "FileMonitor.h"
-
-#include "MemTools.h"
-#include "Host.h"
-#include "LogManager.h"
-
-#include "State.h"
-#include "Movie.h"
-#include "NetPlayProto.h"
-#include "PatchEngine.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/VideoBackendBase.h"
// TODO: ugly, remove
bool g_aspect_wide;
@@ -259,7 +257,7 @@ void Stop() // - Hammertime!
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping Emu thread ...").c_str());
- g_EmuThread.join(); // Wait for emuthread to close.
+ g_EmuThread.join(); // Wait for emuthread to close.
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main Emu thread stopped").c_str());
@@ -678,7 +676,7 @@ void UpdateTitle()
float Speed = (float) (DrawnVideo * (100 * 1000.0) / (VideoInterface::TargetRefreshRate * ElapseTime));
// Settings are shown the same for both extended and summary info
- std::string SSettings = StringFromFormat("%s %s | %s | %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC",
+ std::string SSettings = StringFromFormat("%s %s | %s | %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC",
g_video_backend->GetDisplayName().c_str(), _CoreParameter.bDSPHLE ? "HLE" : "LLE");
// Use extended or summary information. The summary information does not print the ticks data,
@@ -708,7 +706,7 @@ void UpdateTitle()
_CoreParameter.bSkipIdle ? "~" : "",
TicksPercentage);
- #else // Summary information
+ #else // Summary information
std::string SFPS;
if (Movie::IsPlayingInput())
SFPS = StringFromFormat("VI: %u/%u - Frame: %u/%u - FPS: %.0f - VPS: %.0f - %.0f%%", (u32)Movie::g_currentFrame, (u32)Movie::g_totalFrames, (u32)Movie::g_currentInputCount, (u32)Movie::g_totalInputCount, FPS, VPS, Speed);
diff --git a/Source/Core/Core/Core.h b/Source/Core/Core/Core.h
index e24a7e7..9c60c1b 100644
--- a/Source/Core/Core/Core.h
+++ b/Source/Core/Core/Core.h
@@ -14,8 +14,8 @@
#include <vector>
#include <string>
-#include "CommonTypes.h"
-#include "CoreParameter.h"
+#include "Common/CommonTypes.h"
+#include "Core/CoreParameter.h"
namespace Core
{
diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj
index 69b9bda..c1286f7 100644
--- a/Source/Core/Core/Core.vcxproj
+++ b/Source/Core/Core/Core.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -53,7 +53,6 @@
<ClCompile Include="Boot\Boot_WiiWAD.cpp" />
<ClCompile Include="Boot\ElfReader.cpp" />
<ClCompile Include="ConfigManager.cpp" />
- <ClCompile Include="Console.cpp" />
<ClCompile Include="Core.cpp" />
<ClCompile Include="CoreParameter.cpp" />
<ClCompile Include="CoreTiming.cpp" />
@@ -145,6 +144,7 @@
<ClCompile Include="HW\Memmap.cpp" />
<ClCompile Include="HW\MemmapFunctions.cpp" />
<ClCompile Include="HW\MemoryInterface.cpp" />
+ <ClCompile Include="HW\MMIO.cpp" />
<ClCompile Include="HW\ProcessorInterface.cpp" />
<ClCompile Include="HW\SI.cpp" />
<ClCompile Include="HW\SI_Device.cpp" />
@@ -170,7 +170,6 @@
<ClCompile Include="HW\WiimoteEmu\WiimoteEmu.cpp" />
<ClCompile Include="HW\WiimoteReal\IOWin.cpp" />
<ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp" />
- <ClCompile Include="HW\WII_IOB.cpp" />
<ClCompile Include="HW\WII_IPC.cpp" />
<ClCompile Include="IPC_HLE\ICMPWin.cpp" />
<ClCompile Include="IPC_HLE\WiiMote_HID_Attr.cpp" />
@@ -258,7 +257,6 @@
<ClInclude Include="Boot\ElfReader.h" />
<ClInclude Include="Boot\ElfTypes.h" />
<ClInclude Include="ConfigManager.h" />
- <ClInclude Include="Console.h" />
<ClInclude Include="Core.h" />
<ClInclude Include="CoreParameter.h" />
<ClInclude Include="CoreTiming.h" />
@@ -342,6 +340,8 @@
<ClInclude Include="HW\HW.h" />
<ClInclude Include="HW\Memmap.h" />
<ClInclude Include="HW\MemoryInterface.h" />
+ <ClInclude Include="HW\MMIO.h" />
+ <ClInclude Include="HW\MMIOHandlers.h" />
<ClInclude Include="HW\ProcessorInterface.h" />
<ClInclude Include="HW\SI.h" />
<ClInclude Include="HW\SI_Device.h" />
@@ -368,7 +368,6 @@
<ClInclude Include="HW\WiimoteEmu\WiimoteHid.h" />
<ClInclude Include="HW\WiimoteReal\WiimoteReal.h" />
<ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h" />
- <ClInclude Include="HW\WII_IOB.h" />
<ClInclude Include="HW\WII_IPC.h" />
<ClInclude Include="IPC_HLE\fakepoll.h" />
<ClInclude Include="IPC_HLE\hci.h" />
diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters
index 40c8903..a943f2a 100644
--- a/Source/Core/Core/Core.vcxproj.filters
+++ b/Source/Core/Core/Core.vcxproj.filters
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="ActionReplay">
@@ -103,9 +103,6 @@
<Filter Include="HW %28Flipper/Hollywood%29\VI - Video Interface">
<UniqueIdentifier>{fa27e799-34c8-440a-9de3-6720df6022e7}</UniqueIdentifier>
</Filter>
- <Filter Include="HW %28Flipper/Hollywood%29\Wii IO Bridge">
- <UniqueIdentifier>{a6444fcf-11b7-42d3-859f-cfe23fe83e9d}</UniqueIdentifier>
- </Filter>
<Filter Include="HW %28Flipper/Hollywood%29\Wii IPC">
<UniqueIdentifier>{2b41ab45-ba8c-45dc-92cc-9107c1fa3e36}</UniqueIdentifier>
</Filter>
@@ -140,7 +137,6 @@
<ItemGroup>
<ClCompile Include="BootManager.cpp" />
<ClCompile Include="ConfigManager.cpp" />
- <ClCompile Include="Console.cpp" />
<ClCompile Include="Core.cpp" />
<ClCompile Include="CoreParameter.cpp" />
<ClCompile Include="CoreTiming.cpp" />
@@ -492,9 +488,6 @@
<ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp">
<Filter>HW %28Flipper/Hollywood%29\Wiimote\Real</Filter>
</ClCompile>
- <ClCompile Include="HW\WII_IOB.cpp">
- <Filter>HW %28Flipper/Hollywood%29\Wii IO Bridge</Filter>
- </ClCompile>
<ClCompile Include="HW\WII_IPC.cpp">
<Filter>HW %28Flipper/Hollywood%29\Wii IPC</Filter>
</ClCompile>
@@ -510,6 +503,9 @@
<ClCompile Include="HW\MemmapFunctions.cpp">
<Filter>HW %28Flipper/Hollywood%29</Filter>
</ClCompile>
+ <ClCompile Include="HW\MMIO.cpp">
+ <Filter>HW %28Flipper/Hollywood%29</Filter>
+ </ClCompile>
<ClCompile Include="HW\SystemTimers.cpp">
<Filter>HW %28Flipper/Hollywood%29</Filter>
</ClCompile>
@@ -713,7 +709,6 @@
<ItemGroup>
<ClInclude Include="BootManager.h" />
<ClInclude Include="ConfigManager.h" />
- <ClInclude Include="Console.h" />
<ClInclude Include="Core.h" />
<ClInclude Include="CoreParameter.h" />
<ClInclude Include="CoreTiming.h" />
@@ -1022,9 +1017,6 @@
<ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h">
<Filter>HW %28Flipper/Hollywood%29\Wiimote\Real</Filter>
</ClInclude>
- <ClInclude Include="HW\WII_IOB.h">
- <Filter>HW %28Flipper/Hollywood%29\Wii IO Bridge</Filter>
- </ClInclude>
<ClInclude Include="HW\WII_IPC.h">
<Filter>HW %28Flipper/Hollywood%29\Wii IPC</Filter>
</ClInclude>
@@ -1037,6 +1029,12 @@
<ClInclude Include="HW\Memmap.h">
<Filter>HW %28Flipper/Hollywood%29</Filter>
</ClInclude>
+ <ClInclude Include="HW\MMIO.h">
+ <Filter>HW %28Flipper/Hollywood%29</Filter>
+ </ClInclude>
+ <ClInclude Include="HW\MMIOHandlers.h">
+ <Filter>HW %28Flipper/Hollywood%29</Filter>
+ </ClInclude>
<ClInclude Include="HW\SystemTimers.h">
<Filter>HW %28Flipper/Hollywood%29</Filter>
</ClInclude>
diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp
index 6bfaedb..f5dd1f9 100644
--- a/Source/Core/Core/CoreParameter.cpp
+++ b/Source/Core/Core/CoreParameter.cpp
@@ -2,24 +2,24 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "CDUtils.h"
-#include "NANDContentLoader.h"
-
-#include "VolumeCreator.h" // DiscIO
-
-#include "Boot/Boot.h" // Core
-#include "Boot/Boot_DOL.h"
-#include "CoreParameter.h"
-#include "ConfigManager.h"
-#include "Core.h" // for bWii
-#include "FifoPlayer/FifoDataFile.h"
-
#include <cinttypes>
+#include "Common/CDUtils.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "DiscIO/NANDContentLoader.h"
+#include "DiscIO/VolumeCreator.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h" // for bWii
+#include "Core/CoreParameter.h"
+#include "Core/Boot/Boot.h"
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+
SCoreStartupParameter::SCoreStartupParameter()
: hInstance(0),
bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
@@ -97,7 +97,7 @@ void SCoreStartupParameter::LoadDefaults()
bJITOff = false; // debugger only settings
bJITLoadStoreOff = false;
bJITLoadStoreFloatingOff = false;
- bJITLoadStorePairedOff = false; // XXX not 64-bit clean
+ bJITLoadStorePairedOff = false; // XXX not 64-bit clean
bJITFloatingPointOff = false;
bJITIntegerOff = false;
bJITPairedOff = false;
@@ -271,7 +271,8 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
delete pVolume;
}
else
- { // null pVolume means that we are loading from nand folder (Most Likely Wii Menu)
+ {
+ // null pVolume means that we are loading from nand folder (Most Likely Wii Menu)
// if this is the second boot we would be using the Name and id of the last title
m_strName.clear();
m_strUniqueID.clear();
diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h
index ee3b11b..fc8386b 100644
--- a/Source/Core/Core/CoreParameter.h
+++ b/Source/Core/Core/CoreParameter.h
@@ -4,9 +4,10 @@
#pragma once
-#include "IniFile.h"
#include <string>
+#include "Common/IniFile.h"
+
enum Hotkey
{
HK_OPEN,
diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp
index ceda4a6..248ca85 100644
--- a/Source/Core/Core/CoreTiming.cpp
+++ b/Source/Core/Core/CoreTiming.cpp
@@ -2,16 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <vector>
#include <cinttypes>
+#include <vector>
+
+#include "Common/FifoQueue.h"
+#include "Common/StringUtil.h"
+#include "Common/Thread.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
-#include "Thread.h"
-#include "PowerPC/PowerPC.h"
-#include "CoreTiming.h"
-#include "Core.h"
-#include "StringUtil.h"
-#include "VideoBackendBase.h"
-#include "FifoQueue.h"
+#include "VideoCommon/VideoBackendBase.h"
#define MAX_SLICE_LENGTH 20000
@@ -395,8 +397,8 @@ void Advance()
{
if (first->time <= globalTimer)
{
-// LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
-// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
+ //LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
+ // event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
Event* evt = first;
first = first->next;
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
diff --git a/Source/Core/Core/CoreTiming.h b/Source/Core/Core/CoreTiming.h
index 21d0e1c..29c425a 100644
--- a/Source/Core/Core/CoreTiming.h
+++ b/Source/Core/Core/CoreTiming.h
@@ -17,11 +17,10 @@
// inside callback:
// ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever")
-#include "Common.h"
-
#include <string>
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
namespace CoreTiming
{
diff --git a/Source/Core/Core/DSP/DSPAccelerator.cpp b/Source/Core/Core/DSP/DSPAccelerator.cpp
index bd21086..dfad0e1 100644
--- a/Source/Core/Core/DSP/DSPAccelerator.cpp
+++ b/Source/Core/Core/DSP/DSPAccelerator.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "MathUtil.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
-#include "DSPCore.h"
-#include "DSPHost.h"
-#include "DSPHWInterface.h"
-#include "DSPInterpreter.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPInterpreter.h"
// The hardware adpcm decoder :)
static s16 ADPCM_Step(u32& _rSamplePos)
diff --git a/Source/Core/Core/DSP/DSPAnalyzer.cpp b/Source/Core/Core/DSP/DSPAnalyzer.cpp
index c682cdf..919d815 100644
--- a/Source/Core/Core/DSP/DSPAnalyzer.cpp
+++ b/Source/Core/Core/DSP/DSPAnalyzer.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPAnalyzer.h"
-#include "DSPInterpreter.h"
-#include "DSPTables.h"
-#include "DSPMemoryMap.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/DSPTables.h"
namespace DSPAnalyzer {
@@ -24,39 +24,39 @@ u8 code_flags[ISPACE];
const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
{
// From AX:
- { 0x26fc, // LRS $30, @DMBH
- 0x02c0, 0x8000, // ANDCF $30, #0x8000
- 0x029d, 0xFFFF, // JLZ 0x027a
+ { 0x26fc, // LRS $30, @DMBH
+ 0x02c0, 0x8000, // ANDCF $30, #0x8000
+ 0x029d, 0xFFFF, // JLZ 0x027a
0, 0 }, // RET
- { 0x27fc, // LRS $31, @DMBH
- 0x03c0, 0x8000, // ANDCF $31, #0x8000
- 0x029d, 0xFFFF, // JLZ 0x027a
+ { 0x27fc, // LRS $31, @DMBH
+ 0x03c0, 0x8000, // ANDCF $31, #0x8000
+ 0x029d, 0xFFFF, // JLZ 0x027a
0, 0 }, // RET
- { 0x26fe, // LRS $30, @CMBH
- 0x02c0, 0x8000, // ANDCF $30, #0x8000
- 0x029c, 0xFFFF, // JLNZ 0x0280
+ { 0x26fe, // LRS $30, @CMBH
+ 0x02c0, 0x8000, // ANDCF $30, #0x8000
+ 0x029c, 0xFFFF, // JLNZ 0x0280
0, 0 }, // RET
- { 0x27fe, // LRS $31, @CMBH
- 0x03c0, 0x8000, // ANDCF $31, #0x8000
- 0x029c, 0xFFFF, // JLNZ 0x0280
+ { 0x27fe, // LRS $31, @CMBH
+ 0x03c0, 0x8000, // ANDCF $31, #0x8000
+ 0x029c, 0xFFFF, // JLNZ 0x0280
0, 0 }, // RET
- { 0x26fc, // lrs $AC0.M, @DMBH
- 0x02a0, 0x8000, // andf $AC0.M, #0x8000
- 0x029c, 0xFFFF, // jlnz 0x????
+ { 0x26fc, // LRS $AC0.M, @DMBH
+ 0x02a0, 0x8000, // ANDF $AC0.M, #0x8000
+ 0x029c, 0xFFFF, // JLNZ 0x????
0, 0 },
- { 0x27fc, // lrs $AC1.M, @DMBH
- 0x03a0, 0x8000, // andf $AC1.M, #0x8000
- 0x029c, 0xFFFF, // jlnz 0x????
+ { 0x27fc, // LRS $AC1.M, @DMBH
+ 0x03a0, 0x8000, // ANDF $AC1.M, #0x8000
+ 0x029c, 0xFFFF, // JLNZ 0x????
0, 0 },
// From Zelda:
- { 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
- 0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
- 0x029c, 0xFFFF, // JLNZ 0x05cf
+ { 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
+ 0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
+ 0x029c, 0xFFFF, // JLNZ 0x05cf
0 },
// From Zelda - experimental
- { 0x00da, 0x0352, // lr $AX0.H, @0x0352
- 0x8600, // tstaxh $AX0.H
- 0x0295, 0xFFFF, // jz 0x????
+ { 0x00da, 0x0352, // LR $AX0.H, @0x0352
+ 0x8600, // TSTAXH $AX0.H
+ 0x0295, 0xFFFF, // JZ 0x????
0, 0 }
};
diff --git a/Source/Core/Core/DSP/DSPAnalyzer.h b/Source/Core/Core/DSP/DSPAnalyzer.h
index 5af1db3..17121b5 100644
--- a/Source/Core/Core/DSP/DSPAnalyzer.h
+++ b/Source/Core/Core/DSP/DSPAnalyzer.h
@@ -4,7 +4,7 @@
#pragma once
-#include "DSPInterpreter.h"
+#include "Core/DSP/DSPInterpreter.h"
// Basic code analysis.
namespace DSPAnalyzer
diff --git a/Source/Core/Core/DSP/DSPBreakpoints.h b/Source/Core/Core/DSP/DSPBreakpoints.h
index e83540f..6f07679 100644
--- a/Source/Core/Core/DSP/DSPBreakpoints.h
+++ b/Source/Core/Core/DSP/DSPBreakpoints.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// super fast breakpoints for a limited range.
// To be used interchangeably with the BreakPoints class.
diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp
index 53e47b7..6cafd66 100644
--- a/Source/Core/Core/DSP/DSPCodeUtil.cpp
+++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp
@@ -5,23 +5,23 @@
#include <iostream>
#include <vector>
-#include "Common.h"
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "DSPCodeUtil.h"
-#include "assemble.h"
-#include "disassemble.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+#include "Core/DSP/assemble.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPCodeUtil.h"
bool Assemble(const char *text, std::vector<u16> &code, bool force)
{
AssemblerSettings settings;
- // settings.pc = 0;
+ // settings.pc = 0;
// settings.decode_registers = false;
// settings.decode_names = false;
settings.force = force;
- // settings.print_tabs = false;
- // settings.ext_separator = '\'';
+ // settings.print_tabs = false;
+ // settings.ext_separator = '\'';
// TODO: fix the terrible api of the assembler.
DSPAssembler assembler(settings);
diff --git a/Source/Core/Core/DSP/DSPCodeUtil.h b/Source/Core/Core/DSP/DSPCodeUtil.h
index 004cc88..ccfa9c9 100644
--- a/Source/Core/Core/DSP/DSPCodeUtil.h
+++ b/Source/Core/Core/DSP/DSPCodeUtil.h
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include "Common.h"
+#include "Common/Common.h"
bool Assemble(const char *text, std::vector<u16> &code, bool force = false);
bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &text);
diff --git a/Source/Core/Core/DSP/DSPCommon.h b/Source/Core/Core/DSP/DSPCommon.h
index db171f3..d3bf7fc 100644
--- a/Source/Core/Core/DSP/DSPCommon.h
+++ b/Source/Core/Core/DSP/DSPCommon.h
@@ -4,5 +4,6 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
+
typedef u16 UDSPInstruction;
diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp
index caaff46..caaedf7 100644
--- a/Source/Core/Core/DSP/DSPCore.cpp
+++ b/Source/Core/Core/DSP/DSPCore.cpp
@@ -3,7 +3,7 @@
filename: gdsp_interpreter.cpp
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -23,18 +23,18 @@
====================================================================*/
-#include "Common.h"
-#include "Hash.h"
-#include "Thread.h"
-#include "DSPCore.h"
-#include "DSPEmitter.h"
-#include "DSPHost.h"
-#include "DSPAnalyzer.h"
-#include "MemoryUtil.h"
-#include "FileUtil.h"
-
-#include "DSPHWInterface.h"
-#include "DSPIntUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/Hash.h"
+#include "Common/MemoryUtil.h"
+#include "Common/Thread.h"
+
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPIntUtil.h"
SDSP g_dsp;
DSPBreakpoints dsp_breakpoints;
diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h
index 6bd1e95..88c8308 100644
--- a/Source/Core/Core/DSP/DSPCore.h
+++ b/Source/Core/Core/DSP/DSPCore.h
@@ -3,7 +3,7 @@
filename: DSPCore.h
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -25,159 +25,159 @@
#pragma once
-#include "Thread.h"
+#include "Common/Thread.h"
-#include "DSPBreakpoints.h"
-#include "DSPEmitter.h"
+#include "Core/DSP/DSPBreakpoints.h"
+#include "Core/DSP/DSPEmitter.h"
-#define DSP_IRAM_BYTE_SIZE 0x2000
-#define DSP_IRAM_SIZE 0x1000
-#define DSP_IRAM_MASK 0x0fff
+#define DSP_IRAM_BYTE_SIZE 0x2000
+#define DSP_IRAM_SIZE 0x1000
+#define DSP_IRAM_MASK 0x0fff
-#define DSP_IROM_BYTE_SIZE 0x2000
-#define DSP_IROM_SIZE 0x1000
-#define DSP_IROM_MASK 0x0fff
+#define DSP_IROM_BYTE_SIZE 0x2000
+#define DSP_IROM_SIZE 0x1000
+#define DSP_IROM_MASK 0x0fff
-#define DSP_DRAM_BYTE_SIZE 0x2000
-#define DSP_DRAM_SIZE 0x1000
-#define DSP_DRAM_MASK 0x0fff
+#define DSP_DRAM_BYTE_SIZE 0x2000
+#define DSP_DRAM_SIZE 0x1000
+#define DSP_DRAM_MASK 0x0fff
-#define DSP_COEF_BYTE_SIZE 0x1000
-#define DSP_COEF_SIZE 0x800
-#define DSP_COEF_MASK 0x7ff
+#define DSP_COEF_BYTE_SIZE 0x1000
+#define DSP_COEF_SIZE 0x800
+#define DSP_COEF_MASK 0x7ff
-#define DSP_RESET_VECTOR 0x8000
+#define DSP_RESET_VECTOR 0x8000
-#define DSP_STACK_DEPTH 0x20
-#define DSP_STACK_MASK 0x1f
+#define DSP_STACK_DEPTH 0x20
+#define DSP_STACK_MASK 0x1f
-#define DSP_CR_IMEM 2
-#define DSP_CR_DMEM 0
-#define DSP_CR_TO_CPU 1
-#define DSP_CR_FROM_CPU 0
+#define DSP_CR_IMEM 2
+#define DSP_CR_DMEM 0
+#define DSP_CR_TO_CPU 1
+#define DSP_CR_FROM_CPU 0
// Register table taken from libasnd
-#define DSP_REG_AR0 0x00 // address registers
-#define DSP_REG_AR1 0x01
-#define DSP_REG_AR2 0x02
-#define DSP_REG_AR3 0x03
-
-#define DSP_REG_IX0 0x04 // indexing registers (actually, mostly used as increments)
-#define DSP_REG_IX1 0x05
-#define DSP_REG_IX2 0x06
-#define DSP_REG_IX3 0x07
-
-#define DSP_REG_WR0 0x08 // address wrapping registers. should be initialized to 0xFFFF if not used.
-#define DSP_REG_WR1 0x09
-#define DSP_REG_WR2 0x0a
-#define DSP_REG_WR3 0x0b
-
-#define DSP_REG_ST0 0x0c // stacks.
-#define DSP_REG_ST1 0x0d
-#define DSP_REG_ST2 0x0e
-#define DSP_REG_ST3 0x0f
-
-#define DSP_REG_CR 0x12 // Seems to be the top 8 bits of LRS/SRS.
-#define DSP_REG_SR 0x13
-
-#define DSP_REG_PRODL 0x14 // product.
-#define DSP_REG_PRODM 0x15
-#define DSP_REG_PRODH 0x16
-#define DSP_REG_PRODM2 0x17
-
-#define DSP_REG_AXL0 0x18
-#define DSP_REG_AXL1 0x19
-#define DSP_REG_AXH0 0x1a
-#define DSP_REG_AXH1 0x1b
-
-#define DSP_REG_ACC0 0x1c // accumulator (global)
-#define DSP_REG_ACC1 0x1d
-
-#define DSP_REG_ACL0 0x1c // Low accumulator
-#define DSP_REG_ACL1 0x1d
-#define DSP_REG_ACM0 0x1e // Mid accumulator
-#define DSP_REG_ACM1 0x1f
-#define DSP_REG_ACH0 0x10 // Sign extended 8 bit register 0
-#define DSP_REG_ACH1 0x11 // Sign extended 8 bit register 1
+#define DSP_REG_AR0 0x00 // address registers
+#define DSP_REG_AR1 0x01
+#define DSP_REG_AR2 0x02
+#define DSP_REG_AR3 0x03
+
+#define DSP_REG_IX0 0x04 // indexing registers (actually, mostly used as increments)
+#define DSP_REG_IX1 0x05
+#define DSP_REG_IX2 0x06
+#define DSP_REG_IX3 0x07
+
+#define DSP_REG_WR0 0x08 // address wrapping registers. should be initialized to 0xFFFF if not used.
+#define DSP_REG_WR1 0x09
+#define DSP_REG_WR2 0x0a
+#define DSP_REG_WR3 0x0b
+
+#define DSP_REG_ST0 0x0c // stacks.
+#define DSP_REG_ST1 0x0d
+#define DSP_REG_ST2 0x0e
+#define DSP_REG_ST3 0x0f
+
+#define DSP_REG_CR 0x12 // Seems to be the top 8 bits of LRS/SRS.
+#define DSP_REG_SR 0x13
+
+#define DSP_REG_PRODL 0x14 // product.
+#define DSP_REG_PRODM 0x15
+#define DSP_REG_PRODH 0x16
+#define DSP_REG_PRODM2 0x17
+
+#define DSP_REG_AXL0 0x18
+#define DSP_REG_AXL1 0x19
+#define DSP_REG_AXH0 0x1a
+#define DSP_REG_AXH1 0x1b
+
+#define DSP_REG_ACC0 0x1c // accumulator (global)
+#define DSP_REG_ACC1 0x1d
+
+#define DSP_REG_ACL0 0x1c // Low accumulator
+#define DSP_REG_ACL1 0x1d
+#define DSP_REG_ACM0 0x1e // Mid accumulator
+#define DSP_REG_ACM1 0x1f
+#define DSP_REG_ACH0 0x10 // Sign extended 8 bit register 0
+#define DSP_REG_ACH1 0x11 // Sign extended 8 bit register 1
// Hardware registers address
-#define DSP_COEF_A1_0 0xa0
-
-#define DSP_DSCR 0xc9 // DSP DMA Control Reg
-#define DSP_DSPA 0xcd // DSP DMA Address (DSP)
-#define DSP_DSBL 0xcb // DSP DMA Block Length
-#define DSP_DSMAH 0xce // DSP DMA Address High (External)
-#define DSP_DSMAL 0xcf // DSP DMA Address Low (External)
-
-#define DSP_FORMAT 0xd1 // Sample format
-#define DSP_ACUNK 0xd2 // Set to 3 on my dumps
-#define DSP_ACDATA1 0xd3 // used only by Zelda ucodes
-#define DSP_ACSAH 0xd4 // Start of loop
-#define DSP_ACSAL 0xd5
-#define DSP_ACEAH 0xd6 // End of sample (and loop)
-#define DSP_ACEAL 0xd7
-#define DSP_ACCAH 0xd8 // Current playback position
-#define DSP_ACCAL 0xd9
-#define DSP_PRED_SCALE 0xda // ADPCM predictor and scale
-#define DSP_YN1 0xdb
-#define DSP_YN2 0xdc
-#define DSP_ACCELERATOR 0xdd // ADPCM accelerator read. Used by AX.
-#define DSP_GAIN 0xde
-#define DSP_ACUNK2 0xdf // Set to 0xc on my dumps
-
-#define DSP_AMDM 0xef // ARAM DMA Request Mask 0: DMA with ARAM unmasked 1: masked
-
-#define DSP_DIRQ 0xfb // DSP Irq Rest
-#define DSP_DMBH 0xfc // DSP Mailbox H
-#define DSP_DMBL 0xfd // DSP Mailbox L
-#define DSP_CMBH 0xfe // CPU Mailbox H
-#define DSP_CMBL 0xff // CPU Mailbox L
-
-#define DMA_TO_DSP 0
-#define DMA_TO_CPU 1
+#define DSP_COEF_A1_0 0xa0
+
+#define DSP_DSCR 0xc9 // DSP DMA Control Reg
+#define DSP_DSPA 0xcd // DSP DMA Address (DSP)
+#define DSP_DSBL 0xcb // DSP DMA Block Length
+#define DSP_DSMAH 0xce // DSP DMA Address High (External)
+#define DSP_DSMAL 0xcf // DSP DMA Address Low (External)
+
+#define DSP_FORMAT 0xd1 // Sample format
+#define DSP_ACUNK 0xd2 // Set to 3 on my dumps
+#define DSP_ACDATA1 0xd3 // used only by Zelda ucodes
+#define DSP_ACSAH 0xd4 // Start of loop
+#define DSP_ACSAL 0xd5
+#define DSP_ACEAH 0xd6 // End of sample (and loop)
+#define DSP_ACEAL 0xd7
+#define DSP_ACCAH 0xd8 // Current playback position
+#define DSP_ACCAL 0xd9
+#define DSP_PRED_SCALE 0xda // ADPCM predictor and scale
+#define DSP_YN1 0xdb
+#define DSP_YN2 0xdc
+#define DSP_ACCELERATOR 0xdd // ADPCM accelerator read. Used by AX.
+#define DSP_GAIN 0xde
+#define DSP_ACUNK2 0xdf // Set to 0xc on my dumps
+
+#define DSP_AMDM 0xef // ARAM DMA Request Mask 0: DMA with ARAM unmasked 1: masked
+
+#define DSP_DIRQ 0xfb // DSP Irq Rest
+#define DSP_DMBH 0xfc // DSP Mailbox H
+#define DSP_DMBL 0xfd // DSP Mailbox L
+#define DSP_CMBH 0xfe // CPU Mailbox H
+#define DSP_CMBL 0xff // CPU Mailbox L
+
+#define DMA_TO_DSP 0
+#define DMA_TO_CPU 1
// Stacks
-#define DSP_STACK_C 0
-#define DSP_STACK_D 1
+#define DSP_STACK_C 0
+#define DSP_STACK_D 1
// cr (Not g_dsp.r[CR]) bits
// See HW/DSP.cpp.
-#define CR_EXTERNAL_INT 0x0002
-#define CR_HALT 0x0004
-#define CR_INIT 0x0400
+#define CR_EXTERNAL_INT 0x0002
+#define CR_HALT 0x0004
+#define CR_INIT 0x0400
// SR bits
-#define SR_CARRY 0x0001
-#define SR_OVERFLOW 0x0002
-#define SR_ARITH_ZERO 0x0004
-#define SR_SIGN 0x0008
-#define SR_OVER_S32 0x0010 // set when there was mod/tst/cmp on accu and result is over s32
-#define SR_TOP2BITS 0x0020 // if the upper (ac?.m/ax?.h) 2 bits are equal
-#define SR_LOGIC_ZERO 0x0040
-#define SR_OVERFLOW_STICKY 0x0080 // set at the same time as 0x2 (under same conditions) - but not cleared the same
-#define SR_100 0x0100 // unknown
-#define SR_INT_ENABLE 0x0200 // Not 100% sure but duddie says so. This should replace the hack, if so.
-#define SR_400 0x0400 // unknown
-#define SR_EXT_INT_ENABLE 0x0800 // Appears in zelda - seems to disable external interrupts
-#define SR_1000 0x1000 // unknown
-#define SR_MUL_MODIFY 0x2000 // 1 = normal. 0 = x2 (M0, M2) (Free mul by 2)
-#define SR_40_MODE_BIT 0x4000 // 0 = "16", 1 = "40" (SET16, SET40) Controls sign extension when loading mid accums and data saturation for stores from mid accums.
-#define SR_MUL_UNSIGNED 0x8000 // 0 = normal. 1 = unsigned (CLR15, SET15) If set, treats ax?.l as unsigned (MULX family only).
+#define SR_CARRY 0x0001
+#define SR_OVERFLOW 0x0002
+#define SR_ARITH_ZERO 0x0004
+#define SR_SIGN 0x0008
+#define SR_OVER_S32 0x0010 // set when there was mod/tst/cmp on accu and result is over s32
+#define SR_TOP2BITS 0x0020 // if the upper (ac?.m/ax?.h) 2 bits are equal
+#define SR_LOGIC_ZERO 0x0040
+#define SR_OVERFLOW_STICKY 0x0080 // set at the same time as 0x2 (under same conditions) - but not cleared the same
+#define SR_100 0x0100 // unknown
+#define SR_INT_ENABLE 0x0200 // Not 100% sure but duddie says so. This should replace the hack, if so.
+#define SR_400 0x0400 // unknown
+#define SR_EXT_INT_ENABLE 0x0800 // Appears in zelda - seems to disable external interrupts
+#define SR_1000 0x1000 // unknown
+#define SR_MUL_MODIFY 0x2000 // 1 = normal. 0 = x2 (M0, M2) (Free mul by 2)
+#define SR_40_MODE_BIT 0x4000 // 0 = "16", 1 = "40" (SET16, SET40) Controls sign extension when loading mid accums and data saturation for stores from mid accums.
+#define SR_MUL_UNSIGNED 0x8000 // 0 = normal. 1 = unsigned (CLR15, SET15) If set, treats ax?.l as unsigned (MULX family only).
// This should be the bits affected by CMP. Does not include logic zero.
-#define SR_CMP_MASK 0x3f
+#define SR_CMP_MASK 0x3f
// exceptions vector
-#define EXP_STOVF 1 // 0x0002 stack under/over flow
-#define EXP_2 2 // 0x0004
-#define EXP_3 3 // 0x0006
-#define EXP_4 4 // 0x0008
-#define EXP_ACCOV 5 // 0x000a accelerator address overflow
-#define EXP_6 6 // 0x000c
-#define EXP_INT 7 // 0x000e external int (message from cpu)
+#define EXP_STOVF 1 // 0x0002 stack under/over flow
+#define EXP_2 2 // 0x0004
+#define EXP_3 3 // 0x0006
+#define EXP_4 4 // 0x0008
+#define EXP_ACCOV 5 // 0x000a accelerator address overflow
+#define EXP_6 6 // 0x000c
+#define EXP_INT 7 // 0x000e external int (message from cpu)
typedef struct {
u16 ar[4];
diff --git a/Source/Core/Core/DSP/DSPEmitter.cpp b/Source/Core/Core/DSP/DSPEmitter.cpp
index d0d842b..7ef3169 100644
--- a/Source/Core/Core/DSP/DSPEmitter.cpp
+++ b/Source/Core/Core/DSP/DSPEmitter.cpp
@@ -4,12 +4,12 @@
#include <cstring>
-#include "DSPEmitter.h"
-#include "DSPMemoryMap.h"
-#include "DSPCore.h"
-#include "DSPHost.h"
-#include "DSPInterpreter.h"
-#include "DSPAnalyzer.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
#define MAX_BLOCK_SIZE 250
#define DSP_IDLE_SKIP_CYCLES 0x1000
diff --git a/Source/Core/Core/DSP/DSPEmitter.h b/Source/Core/Core/DSP/DSPEmitter.h
index 7885555..1d6e60a 100644
--- a/Source/Core/Core/DSP/DSPEmitter.h
+++ b/Source/Core/Core/DSP/DSPEmitter.h
@@ -6,14 +6,14 @@
#include <list>
-#include "DSPCommon.h"
-#include "x64ABI.h"
-#include "x64Emitter.h"
-#include "Jit/DSPJitRegCache.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Emitter.h"
-#define COMPILED_CODE_SIZE 2097152
+#include "Core/DSP/DSPCommon.h"
+#include "Core/DSP/Jit/DSPJitRegCache.h"
-#define MAX_BLOCKS 0x10000
+#define COMPILED_CODE_SIZE 2097152
+#define MAX_BLOCKS 0x10000
typedef u32 (*DSPCompiledCode)();
typedef const u8 *Block;
@@ -41,10 +41,8 @@ public:
// CC Util
void Update_SR_Register64(Gen::X64Reg val = Gen::EAX);
- void Update_SR_Register64_Carry(Gen::X64Reg val,
- Gen::X64Reg carry_ovfl);
- void Update_SR_Register64_Carry2(Gen::X64Reg val,
- Gen::X64Reg carry_ovfl);
+ void Update_SR_Register64_Carry(Gen::X64Reg val, Gen::X64Reg carry_ovfl);
+ void Update_SR_Register64_Carry2(Gen::X64Reg val, Gen::X64Reg carry_ovfl);
void Update_SR_Register16(Gen::X64Reg val = Gen::EAX);
void Update_SR_Register16_OverS32(Gen::X64Reg val = Gen::EAX);
diff --git a/Source/Core/Core/DSP/DSPHWInterface.cpp b/Source/Core/Core/DSP/DSPHWInterface.cpp
index 92d9c5d..a201027 100644
--- a/Source/Core/Core/DSP/DSPHWInterface.cpp
+++ b/Source/Core/Core/DSP/DSPHWInterface.cpp
@@ -3,7 +3,7 @@
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -23,18 +23,18 @@
====================================================================*/
-#include "Atomic.h"
-#include "Thread.h"
-#include "MemoryUtil.h"
+#include "Common/Atomic.h"
+#include "Common/CPUDetect.h"
+#include "Common/Thread.h"
+#include "Common/MemoryUtil.h"
-#include "DSPCore.h"
-#include "DSPHost.h"
-#include "DSPTables.h"
-#include "DSPAnalyzer.h"
-#include "DSPAccelerator.h"
-#include "DSPInterpreter.h"
-#include "DSPHWInterface.h"
-#include "CPUDetect.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPAccelerator.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPTables.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
@@ -310,15 +310,10 @@ static void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_do_dma()
{
- u16 ctl;
- u32 addr;
- u16 dsp_addr;
- u16 len;
-
- addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
- ctl = g_dsp.ifx_regs[DSP_DSCR];
- dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
- len = g_dsp.ifx_regs[DSP_DSBL];
+ u32 addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
+ u16 ctl = g_dsp.ifx_regs[DSP_DSCR];
+ u16 dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
+ u16 len = g_dsp.ifx_regs[DSP_DSBL];
if (len > 0x4000)
{
diff --git a/Source/Core/Core/DSP/DSPHWInterface.h b/Source/Core/Core/DSP/DSPHWInterface.h
index b1d226d..331762e 100644
--- a/Source/Core/Core/DSP/DSPHWInterface.h
+++ b/Source/Core/Core/DSP/DSPHWInterface.h
@@ -3,7 +3,7 @@
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -25,7 +25,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
diff --git a/Source/Core/Core/DSP/DSPIntCCUtil.cpp b/Source/Core/Core/DSP/DSPIntCCUtil.cpp
index d2631d2..ad7f5ab 100644
--- a/Source/Core/Core/DSP/DSPIntCCUtil.cpp
+++ b/Source/Core/Core/DSP/DSPIntCCUtil.cpp
@@ -7,9 +7,9 @@
// HELPER FUNCTIONS
-#include "DSPIntCCUtil.h"
-#include "DSPCore.h"
-#include "DSPInterpreter.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPIntCCUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DSPIntCCUtil.h b/Source/Core/Core/DSP/DSPIntCCUtil.h
index 31e3bbf..f25b05a 100644
--- a/Source/Core/Core/DSP/DSPIntCCUtil.h
+++ b/Source/Core/Core/DSP/DSPIntCCUtil.h
@@ -8,7 +8,7 @@
// Anything to do with SR and conditions goes here.
-#include "Common.h"
+#include "Common/Common.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DSPIntExtOps.cpp b/Source/Core/Core/DSP/DSPIntExtOps.cpp
index a628b9b..fd50e67 100644
--- a/Source/Core/Core/DSP/DSPIntExtOps.cpp
+++ b/Source/Core/Core/DSP/DSPIntExtOps.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPIntUtil.h"
-#include "DSPMemoryMap.h"
#include "DSPIntExtOps.h"
+#include "Core/DSP/DSPIntUtil.h"
+#include "Core/DSP/DSPMemoryMap.h"
//not needed for game ucodes (it slows down interpreter/dspjit32 + easier to compare int VS dspjit64 without it)
//#define PRECISE_BACKLOG
@@ -34,7 +34,7 @@ namespace Ext
inline bool IsSameMemArea(u16 a, u16 b)
{
-//LM: tested on WII
+ //LM: tested on WII
if ((a>>10)==(b>>10))
return true;
else
diff --git a/Source/Core/Core/DSP/DSPIntExtOps.h b/Source/Core/Core/DSP/DSPIntExtOps.h
index bcd554e..dbe1d07 100644
--- a/Source/Core/Core/DSP/DSPIntExtOps.h
+++ b/Source/Core/Core/DSP/DSPIntExtOps.h
@@ -3,7 +3,7 @@
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -25,7 +25,7 @@
#pragma once
-#include "DSPTables.h"
+#include "Core/DSP/DSPTables.h"
// Extended opcode support.
// Many opcode have the lower 0xFF (some only 0x7f) free - there, an opcode extension
diff --git a/Source/Core/Core/DSP/DSPIntUtil.h b/Source/Core/Core/DSP/DSPIntUtil.h
index f1e228d..19ab6f7 100644
--- a/Source/Core/Core/DSP/DSPIntUtil.h
+++ b/Source/Core/Core/DSP/DSPIntUtil.h
@@ -3,7 +3,7 @@
filename: gdsp_opcodes_helper.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -25,12 +25,12 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
-#include "DSPInterpreter.h"
-#include "DSPCore.h"
-#include "DSPMemoryMap.h"
-#include "DSPStacks.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/DSPStacks.h"
// ---------------------------------------------------------------------------------------
diff --git a/Source/Core/Core/DSP/DSPInterpreter.cpp b/Source/Core/Core/DSP/DSPInterpreter.cpp
index 19edffd..aaae6cd 100644
--- a/Source/Core/Core/DSP/DSPInterpreter.cpp
+++ b/Source/Core/Core/DSP/DSPInterpreter.cpp
@@ -3,7 +3,7 @@
filename: gdsp_interpreter.cpp
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -23,12 +23,12 @@
====================================================================*/
-#include "DSPTables.h"
-#include "DSPCore.h"
-#include "DSPAnalyzer.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPTables.h"
-#include "DSPHWInterface.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DSPInterpreter.h b/Source/Core/Core/DSP/DSPInterpreter.h
index 6ceb077..641ef05 100644
--- a/Source/Core/Core/DSP/DSPInterpreter.h
+++ b/Source/Core/Core/DSP/DSPInterpreter.h
@@ -4,7 +4,7 @@
#pragma once
-#include "DSPTables.h"
+#include "Core/DSP/DSPTables.h"
#define DSP_REG_MASK 0x1f
diff --git a/Source/Core/Core/DSP/DSPMemoryMap.cpp b/Source/Core/Core/DSP/DSPMemoryMap.cpp
index 5428232..4120acb 100644
--- a/Source/Core/Core/DSP/DSPMemoryMap.cpp
+++ b/Source/Core/Core/DSP/DSPMemoryMap.cpp
@@ -3,7 +3,7 @@
filename: gdsp_memory.cpp
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -23,10 +23,10 @@
====================================================================*/
-#include "DSPInterpreter.h"
-#include "DSPMemoryMap.h"
-#include "DSPHWInterface.h"
-#include "DSPCore.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
u16 dsp_imem_read(u16 addr)
{
diff --git a/Source/Core/Core/DSP/DSPMemoryMap.h b/Source/Core/Core/DSP/DSPMemoryMap.h
index 55de7f1..f37f299 100644
--- a/Source/Core/Core/DSP/DSPMemoryMap.h
+++ b/Source/Core/Core/DSP/DSPMemoryMap.h
@@ -3,7 +3,7 @@
filename: gdsp_memory.h
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -25,9 +25,10 @@
#pragma once
-#include "Common.h"
-#include "DSPInterpreter.h"
-#include "DSPCore.h"
+#include "Common/Common.h"
+
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
u16 dsp_imem_read(u16 addr);
void dsp_dmem_write(u16 addr, u16 val);
diff --git a/Source/Core/Core/DSP/DSPStacks.cpp b/Source/Core/Core/DSP/DSPStacks.cpp
index d1e70a6..40b50f8 100644
--- a/Source/Core/Core/DSP/DSPStacks.cpp
+++ b/Source/Core/Core/DSP/DSPStacks.cpp
@@ -3,7 +3,7 @@
filename: gdsp_registers.cpp
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -23,10 +23,10 @@
====================================================================*/
-#include "Common.h"
+#include "Common/Common.h"
-#include "DSPCore.h"
-#include "DSPStacks.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPStacks.h"
// Stacks. The stacks are outside the DSP RAM, in dedicated hardware.
diff --git a/Source/Core/Core/DSP/DSPStacks.h b/Source/Core/Core/DSP/DSPStacks.h
index 6bb621d..db228e5 100644
--- a/Source/Core/Core/DSP/DSPStacks.h
+++ b/Source/Core/Core/DSP/DSPStacks.h
@@ -3,7 +3,7 @@
filename: gdsp_registers.h
project: GCemu
created: 2004-6-18
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
@@ -25,7 +25,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
void dsp_reg_store_stack(int stack_reg, u16 val);
u16 dsp_reg_load_stack(int stack_reg);
diff --git a/Source/Core/Core/DSP/DSPTables.cpp b/Source/Core/Core/DSP/DSPTables.cpp
index 20d27d4..bef2df1 100644
--- a/Source/Core/Core/DSP/DSPTables.cpp
+++ b/Source/Core/Core/DSP/DSPTables.cpp
@@ -4,12 +4,12 @@
// Additional copyrights go to Duddie (c) 2005 (duddie@walla.com)
-#include "Common.h"
-#include "DSPTables.h"
+#include "Common/Common.h"
-#include "DSPInterpreter.h"
-#include "DSPIntExtOps.h"
-#include "DSPEmitter.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPIntExtOps.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPTables.h"
void nop(const UDSPInstruction opc)
{
diff --git a/Source/Core/Core/DSP/DSPTables.h b/Source/Core/Core/DSP/DSPTables.h
index 66f29f9..49e3ac9 100644
--- a/Source/Core/Core/DSP/DSPTables.h
+++ b/Source/Core/Core/DSP/DSPTables.h
@@ -6,9 +6,8 @@
#pragma once
-//nclude "Common.h"
-#include "DSPEmitter.h"
-#include "DSPCommon.h"
+#include "Core/DSP/DSPCommon.h"
+#include "Core/DSP/DSPEmitter.h"
// The non-ADDR ones that end with _D are the opposite one - if the bit specify
// ACC0, then ACC_D will be ACC1.
@@ -35,7 +34,7 @@ enum partype_t
P_REGM19 = P_REG | 0x1910, // used in multiply instructions
P_REG1A = P_REG | 0x1a80,
P_REG1C = P_REG | 0x1c00,
-// P_ACC = P_REG | 0x1c10, // used for global accum (gcdsptool's value)
+ // P_ACC = P_REG | 0x1c10, // used for global accum (gcdsptool's value)
P_ACCL = P_REG | 0x1c00, // used for low part of accum
P_ACCM = P_REG | 0x1e00, // used for mid part of accum
// The following are not in gcdsptool
diff --git a/Source/Core/Core/DSP/DspIntArithmetic.cpp b/Source/Core/Core/DSP/DspIntArithmetic.cpp
index 7de0327..f7a82f6 100644
--- a/Source/Core/Core/DSP/DspIntArithmetic.cpp
+++ b/Source/Core/Core/DSP/DspIntArithmetic.cpp
@@ -4,9 +4,9 @@
//
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "DSPInterpreter.h"
-#include "DSPIntCCUtil.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPIntCCUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
// Arithmetic and accumulator control.
@@ -832,7 +832,7 @@ void lsr16(const UDSPInstruction opc)
u8 areg = (opc >> 8) & 0x1;
u64 acc = dsp_get_long_acc(areg);
- acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
+ acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
acc >>= 16;
zeroWriteBackLog();
@@ -887,7 +887,7 @@ void lsr(const UDSPInstruction opc)
u8 rreg = (opc >> 8) & 0x01;
u16 shift;
u64 acc = dsp_get_long_acc(rreg);
- acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
+ acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
if ((opc & 0x3f) == 0)
shift = 0;
diff --git a/Source/Core/Core/DSP/DspIntBranch.cpp b/Source/Core/Core/DSP/DspIntBranch.cpp
index ecd1314..78cf972 100644
--- a/Source/Core/Core/DSP/DspIntBranch.cpp
+++ b/Source/Core/Core/DSP/DspIntBranch.cpp
@@ -4,13 +4,13 @@
//
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "DSPInterpreter.h"
-#include "DSPCore.h"
-#include "DSPMemoryMap.h"
-#include "DSPStacks.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/DSPStacks.h"
-#include "DSPIntCCUtil.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPIntCCUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DspIntLoadStore.cpp b/Source/Core/Core/DSP/DspIntLoadStore.cpp
index 0b72b21..b676479 100644
--- a/Source/Core/Core/DSP/DspIntLoadStore.cpp
+++ b/Source/Core/Core/DSP/DspIntLoadStore.cpp
@@ -4,10 +4,10 @@
//
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "DSPInterpreter.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
-#include "DSPMemoryMap.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DspIntMisc.cpp b/Source/Core/Core/DSP/DspIntMisc.cpp
index aec554d..f03e4b9 100644
--- a/Source/Core/Core/DSP/DspIntMisc.cpp
+++ b/Source/Core/Core/DSP/DspIntMisc.cpp
@@ -4,11 +4,10 @@
//
// Additional copyrights go to Duddie and Tratax (c) 2004
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
-#include "DSPInterpreter.h"
-
-#include "DSPCore.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/DspIntMultiplier.cpp b/Source/Core/Core/DSP/DspIntMultiplier.cpp
index a138087..514b87f 100644
--- a/Source/Core/Core/DSP/DspIntMultiplier.cpp
+++ b/Source/Core/Core/DSP/DspIntMultiplier.cpp
@@ -7,10 +7,10 @@
// Multiplier and product register control
-#include "DSPInterpreter.h"
+#include "Core/DSP/DSPInterpreter.h"
-#include "DSPIntCCUtil.h"
-#include "DSPIntUtil.h"
+#include "Core/DSP/DSPIntCCUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
namespace DSPInterpreter {
diff --git a/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp b/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp
index 5e2dfe7..f39057c 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitArithmetic.cpp
@@ -4,10 +4,10 @@
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "../DSPAnalyzer.h"
-#include "../DSPEmitter.h"
-#include "../DSPIntCCUtil.h"
-#include "../DSPIntUtil.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPIntCCUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp
index 49c9411..d8eb87f 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../DSPAnalyzer.h"
-#include "../DSPEmitter.h"
-#include "../DSPMemoryMap.h"
-#include "../DSPStacks.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/DSPStacks.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitCCUtil.cpp b/Source/Core/Core/DSP/Jit/DSPJitCCUtil.cpp
index 62540ff..fdaa67b 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitCCUtil.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitCCUtil.cpp
@@ -4,8 +4,8 @@
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "../DSPEmitter.h"
-#include "../DSPIntUtil.h" // Helper functions
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPIntUtil.h" // Helper functions
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitExtOps.cpp b/Source/Core/Core/DSP/Jit/DSPJitExtOps.cpp
index f18bc3d..5ffa408 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitExtOps.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitExtOps.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../DSPEmitter.h"
-#include "../DSPMemoryMap.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPMemoryMap.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitLoadStore.cpp b/Source/Core/Core/DSP/Jit/DSPJitLoadStore.cpp
index 765ecb3..b842111 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitLoadStore.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitLoadStore.cpp
@@ -4,9 +4,9 @@
// Additional copyrights go to Duddie and Tratax (c) 2004
-#include "../DSPEmitter.h"
-#include "../DSPIntCCUtil.h"
-#include "../DSPIntUtil.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPIntCCUtil.h"
+#include "Core/DSP/DSPIntUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitMisc.cpp b/Source/Core/Core/DSP/Jit/DSPJitMisc.cpp
index 6da5b64..646339f 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitMisc.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitMisc.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../DSPEmitter.h"
-#include "../DSPIntUtil.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPIntUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitMultiplier.cpp b/Source/Core/Core/DSP/Jit/DSPJitMultiplier.cpp
index 00cec82..234226a 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitMultiplier.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitMultiplier.cpp
@@ -7,9 +7,9 @@
// Multiplier and product register control
-#include "../DSPAnalyzer.h"
-#include "../DSPEmitter.h"
-#include "../DSPIntUtil.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPIntUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp
index 6950daa..9f351f9 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPJitRegCache.h"
-#include "../DSPEmitter.h"
-#include "../DSPMemoryMap.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/Jit/DSPJitRegCache.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitRegCache.h b/Source/Core/Core/DSP/Jit/DSPJitRegCache.h
index c2e27a3..9603964 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitRegCache.h
+++ b/Source/Core/Core/DSP/Jit/DSPJitRegCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "x64Emitter.h"
+#include "Common/x64Emitter.h"
class DSPEmitter;
diff --git a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp
index dd7e042..f32d0e5 100644
--- a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp
+++ b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPJitUtil.h"
-#include "../DSPEmitter.h"
-#include "../DSPHWInterface.h"
-#include "../DSPMemoryMap.h"
+#include "Core/DSP/DSPEmitter.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/DSP/Jit/DSPJitUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/DSP/LabelMap.cpp b/Source/Core/Core/DSP/LabelMap.cpp
index 1c836e7..57931a7 100644
--- a/Source/Core/Core/DSP/LabelMap.cpp
+++ b/Source/Core/Core/DSP/LabelMap.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "LabelMap.h"
-#include "DSPTables.h"
+#include "Core/DSP/DSPTables.h"
+#include "Core/DSP/LabelMap.h"
LabelMap::LabelMap()
{
diff --git a/Source/Core/Core/DSP/LabelMap.h b/Source/Core/Core/DSP/LabelMap.h
index c0a822d..6875b55 100644
--- a/Source/Core/Core/DSP/LabelMap.h
+++ b/Source/Core/Core/DSP/LabelMap.h
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include "Common.h"
+#include "Common/Common.h"
enum LabelType
{
diff --git a/Source/Core/Core/DSP/assemble.cpp b/Source/Core/Core/DSP/assemble.cpp
index 7ae9346..eecfc06 100644
--- a/Source/Core/Core/DSP/assemble.cpp
+++ b/Source/Core/Core/DSP/assemble.cpp
@@ -3,7 +3,7 @@
$Id: assemble.cpp,v 1.3 2008-11-11 01:04:26 wntrmute Exp $
project: GameCube DSP Tool (gcdsp)
-mail: duddie@walla.com
+mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -39,17 +39,17 @@ Initial import
#include <cstdio>
#include <cstdlib>
-
-#include <map>
-#include <iostream>
#include <fstream>
+#include <iostream>
+#include <map>
+
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
-#include "Common.h"
-#include "FileUtil.h"
-#include "DSPInterpreter.h"
-#include "DSPTables.h"
-#include "disassemble.h"
-#include "assemble.h"
+#include "Core/DSP/assemble.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPTables.h"
static const char *err_string[] =
{
@@ -817,11 +817,11 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
if (c == 0x0a || c == 0x0d || c == ';')
c = 0x00;
- if (c == 0x09) // tabs to spaces
+ if (c == 0x09) // tabs to spaces
c = ' ';
if (c == '"')
upper = !upper;
- if (upper && c >= 'a' && c <= 'z') // convert to uppercase
+ if (upper && c >= 'a' && c <= 'z') // convert to uppercase
c = c - 'a' + 'A';
line[i] = c;
if (c == 0)
@@ -847,7 +847,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
if (valid)
{
label = std::string(line).substr(0, col_pos);
- ptr += col_pos + 1;
+ ptr += col_pos + 1;
}
}
diff --git a/Source/Core/Core/DSP/assemble.h b/Source/Core/Core/DSP/assemble.h
index 8f77622..2011fa7 100644
--- a/Source/Core/Core/DSP/assemble.h
+++ b/Source/Core/Core/DSP/assemble.h
@@ -2,7 +2,7 @@
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -27,10 +27,11 @@
#include <string>
#include <map>
-#include "Common.h"
-#include "disassemble.h"
-#include "DSPTables.h"
-#include "LabelMap.h"
+#include "Common/Common.h"
+
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPTables.h"
+#include "Core/DSP/LabelMap.h"
enum err_t
{
@@ -121,7 +122,7 @@ private:
LabelMap labels;
- u32 code_line;
+ u32 code_line;
bool failed;
std::string last_error_str;
err_t last_error;
diff --git a/Source/Core/Core/DSP/disassemble.cpp b/Source/Core/Core/DSP/disassemble.cpp
index 33fc28e..462b480 100644
--- a/Source/Core/Core/DSP/disassemble.cpp
+++ b/Source/Core/Core/DSP/disassemble.cpp
@@ -3,7 +3,7 @@
filename: disassemble.cpp
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -23,13 +23,14 @@
====================================================================*/
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
-#include "Common.h"
-#include "FileUtil.h"
-#include "disassemble.h"
-#include "DSPTables.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPTables.h"
#ifdef _MSC_VER
#pragma warning(disable:4996)
@@ -221,7 +222,7 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
break;
}
}
- const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
+ const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
if (!opc)
opc = &fake_op;
diff --git a/Source/Core/Core/DSP/disassemble.h b/Source/Core/Core/DSP/disassemble.h
index 3c31695..855ee9a 100644
--- a/Source/Core/Core/DSP/disassemble.h
+++ b/Source/Core/Core/DSP/disassemble.h
@@ -2,7 +2,7 @@
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
- mail: duddie@walla.com
+ mail: duddie@walla.com
Copyright (c) 2005 Duddie
@@ -27,9 +27,10 @@
#include <map>
#include <vector>
-#include "Common.h"
-#include "DSPTables.h"
-#include "LabelMap.h"
+#include "Common/Common.h"
+
+#include "Core/DSP/DSPTables.h"
+#include "Core/DSP/LabelMap.h"
struct AssemblerSettings
{
diff --git a/Source/Core/Core/DSPEmulator.cpp b/Source/Core/Core/DSPEmulator.cpp
index 52cae0d..65e63ea 100644
--- a/Source/Core/Core/DSPEmulator.cpp
+++ b/Source/Core/Core/DSPEmulator.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPEmulator.h"
+#include "Core/DSPEmulator.h"
-#include "HW/DSPLLE/DSPLLE.h"
-#include "HW/DSPHLE/DSPHLE.h"
+#include "Core/HW/DSPLLE/DSPLLE.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
DSPEmulator *CreateDSPEmulator(bool HLE)
{
diff --git a/Source/Core/Core/DSPEmulator.h b/Source/Core/Core/DSPEmulator.h
index caf90b0..71a1263 100644
--- a/Source/Core/Core/DSPEmulator.h
+++ b/Source/Core/Core/DSPEmulator.h
@@ -4,8 +4,8 @@
#pragma once
-#include "ChunkFile.h"
-#include "SoundStream.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/ChunkFile.h"
class DSPEmulator
{
diff --git a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
index 3aa9294..882284c 100644
--- a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
+++ b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "StringUtil.h"
-#include "Debugger_SymbolMap.h"
-#include "../Core.h"
-#include "../HW/Memmap.h"
-#include "../PowerPC/PowerPC.h"
-#include "../PowerPC/PPCAnalyst.h"
-#include "../PowerPC/PPCSymbolDB.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+
+#include "Core/Core.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
namespace Dolphin_Debugger
{
diff --git a/Source/Core/Core/Debugger/Debugger_SymbolMap.h b/Source/Core/Core/Debugger/Debugger_SymbolMap.h
index acf92f4..d01db6d 100644
--- a/Source/Core/Core/Debugger/Debugger_SymbolMap.h
+++ b/Source/Core/Core/Debugger/Debugger_SymbolMap.h
@@ -7,7 +7,7 @@
#include <vector>
#include <string>
-#include "Common.h"
+#include "Common/Common.h"
namespace Dolphin_Debugger
{
diff --git a/Source/Core/Core/Debugger/Dump.cpp b/Source/Core/Core/Debugger/Dump.cpp
index 8c4a23c..a4c23ab 100644
--- a/Source/Core/Core/Debugger/Dump.cpp
+++ b/Source/Core/Core/Debugger/Dump.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
+#include <cstdio>
-#include "Common.h"
-#include "Dump.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+
+#include "Core/Debugger/Dump.h"
CDump::CDump(const char* _szFilename) :
m_pData(NULL)
@@ -31,14 +32,12 @@ CDump::~CDump(void)
}
}
-int
-CDump::GetNumberOfSteps(void)
+int CDump::GetNumberOfSteps(void)
{
return (int)(m_size / STRUCTUR_SIZE);
}
-u32
-CDump::GetGPR(int _step, int _gpr)
+u32 CDump::GetGPR(int _step, int _gpr)
{
u32 offset = _step * STRUCTUR_SIZE;
@@ -48,8 +47,7 @@ CDump::GetGPR(int _step, int _gpr)
return Read32(offset + OFFSET_GPR + (_gpr * 4));
}
-u32
-CDump::GetPC(int _step)
+u32 CDump::GetPC(int _step)
{
u32 offset = _step * STRUCTUR_SIZE;
@@ -59,13 +57,12 @@ CDump::GetPC(int _step)
return Read32(offset + OFFSET_PC);
}
-u32
-CDump::Read32(u32 _pos)
+u32 CDump::Read32(u32 _pos)
{
u32 result = (m_pData[_pos+0] << 24) |
- (m_pData[_pos+1] << 16) |
- (m_pData[_pos+2] << 8) |
- (m_pData[_pos+3] << 0);
+ (m_pData[_pos+1] << 16) |
+ (m_pData[_pos+2] << 8) |
+ (m_pData[_pos+3] << 0);
return result;
}
diff --git a/Source/Core/Core/Debugger/Dump.h b/Source/Core/Core/Debugger/Dump.h
index 70b6286..71c987f 100644
--- a/Source/Core/Core/Debugger/Dump.h
+++ b/Source/Core/Core/Debugger/Dump.h
@@ -8,7 +8,7 @@
//
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
class CDump
{
diff --git a/Source/Core/Core/Debugger/GCELF.h b/Source/Core/Core/Debugger/GCELF.h
index cc49c74..5354f53 100644
--- a/Source/Core/Core/Debugger/GCELF.h
+++ b/Source/Core/Core/Debugger/GCELF.h
@@ -5,43 +5,43 @@
#pragma once
// ELF File Types
-#define ET_NONE 0 // No file type
-#define ET_REL 1 // Relocatable file
-#define ET_EXEC 2 // Executable file
-#define ET_DYN 3 // Shared object file
-#define ET_CORE 4 // Core file
-#define ET_LOPROC 0xFF00 // Processor specific
-#define ET_HIPROC 0xFFFF // Processor specific
+#define ET_NONE 0 // No file type
+#define ET_REL 1 // Relocatable file
+#define ET_EXEC 2 // Executable file
+#define ET_DYN 3 // Shared object file
+#define ET_CORE 4 // Core file
+#define ET_LOPROC 0xFF00 // Processor specific
+#define ET_HIPROC 0xFFFF // Processor specific
// ELF Machine Types
-#define EM_NONE 0 // No machine
-#define EM_M32 1 // AT&T WE 32100
-#define EM_SPARC 2 // SPARC
-#define EM_386 3 // Intel Architecture
-#define EM_68K 4 // Motorola 68000
-#define EM_88K 5 // Motorola 88000
-#define EM_860 6 // Intel 80860
-#define EM_MIPS 7 // MIPS RS3000 Big-Endian
-#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian
-#define EM_ARM 40 // ARM/Thumb Architecture
+#define EM_NONE 0 // No machine
+#define EM_M32 1 // AT&T WE 32100
+#define EM_SPARC 2 // SPARC
+#define EM_386 3 // Intel Architecture
+#define EM_68K 4 // Motorola 68000
+#define EM_88K 5 // Motorola 88000
+#define EM_860 6 // Intel 80860
+#define EM_MIPS 7 // MIPS RS3000 Big-Endian
+#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian
+#define EM_ARM 40 // ARM/Thumb Architecture
// ELF Version Types
-#define EV_NONE 0 // Invalid version
-#define EV_CURRENT 1 // Current version
+#define EV_NONE 0 // Invalid version
+#define EV_CURRENT 1 // Current version
// ELF Section Header Types
-#define SHT_NULL 0
-#define SHT_PROGBITS 1
-#define SHT_SYMTAB 2
-#define SHT_STRTAB 3
-#define SHT_RELA 4
-#define SHT_HASH 5
-#define SHT_DYNAMIC 6
-#define SHT_NOTE 7
-#define SHT_NOBITS 8
-#define SHT_REL 9
-#define SHT_SHLIB 10
-#define SHT_DYNSYM 11
+#define SHT_NULL 0
+#define SHT_PROGBITS 1
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_RELA 4
+#define SHT_HASH 5
+#define SHT_DYNAMIC 6
+#define SHT_NOTE 7
+#define SHT_NOBITS 8
+#define SHT_REL 9
+#define SHT_SHLIB 10
+#define SHT_DYNSYM 11
typedef struct
diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp
index 4b224d5..ce2ba27 100644
--- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp
+++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Debugger_SymbolMap.h"
-#include "DebugInterface.h"
-#include "PPCDebugInterface.h"
#include "PowerPCDisasm.h"
-#include "../Host.h"
-#include "../Core.h"
-#include "../HW/CPU.h"
-#include "../HW/DSP.h"
-#include "../HW/Memmap.h"
-#include "../PowerPC/PowerPC.h"
-#include "../PowerPC/JitCommon/JitBase.h"
-#include "../PowerPC/PPCSymbolDB.h"
+
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
@@ -75,9 +75,9 @@ unsigned int PPCDebugInterface::readExtraMemory(int memory, unsigned int address
return Memory::ReadUnchecked_U32(address);
case 1:
return (DSP::ReadARAM(address) << 24) |
- (DSP::ReadARAM(address + 1) << 16) |
- (DSP::ReadARAM(address + 2) << 8) |
- (DSP::ReadARAM(address + 3));
+ (DSP::ReadARAM(address + 1) << 16) |
+ (DSP::ReadARAM(address + 2) << 8) |
+ (DSP::ReadARAM(address + 3));
default:
return 0;
}
@@ -140,7 +140,6 @@ void PPCDebugInterface::toggleMemCheck(unsigned int address)
MemCheck.Break = true;
PowerPC::memchecks.Add(MemCheck);
-
}
else
PowerPC::memchecks.Remove(address);
diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.h b/Source/Core/Core/Debugger/PPCDebugInterface.h
index 7b16f6b..a55de88 100644
--- a/Source/Core/Core/Debugger/PPCDebugInterface.h
+++ b/Source/Core/Core/Debugger/PPCDebugInterface.h
@@ -6,7 +6,7 @@
#include <string>
-#include "DebugInterface.h"
+#include "Common/DebugInterface.h"
//wrapper between disasm control and Dolphin debugger
diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
index 2bdbd88..3fd73f2 100644
--- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp
@@ -2,14 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FifoAnalyzer.h"
+#include "Core/Core.h"
+#include "Core/FifoPlayer/FifoAnalyzer.h"
-#include "Core.h"
-
-#include "VertexLoader.h"
-#include "VertexLoader_Position.h"
-#include "VertexLoader_Normal.h"
-#include "VertexLoader_TextCoord.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_Position.h"
+#include "VideoCommon/VertexLoader_Normal.h"
+#include "VideoCommon/VertexLoader_TextCoord.h"
namespace FifoAnalyzer
{
@@ -190,12 +189,12 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
case DIRECT:
switch (colComp[i])
{
- case FORMAT_16B_565: size = 2; break;
- case FORMAT_24B_888: size = 3; break;
- case FORMAT_32B_888x: size = 4; break;
- case FORMAT_16B_4444: size = 2; break;
- case FORMAT_24B_6666: size = 3; break;
- case FORMAT_32B_8888: size = 4; break;
+ case FORMAT_16B_565: size = 2; break;
+ case FORMAT_24B_888: size = 3; break;
+ case FORMAT_32B_888x: size = 4; break;
+ case FORMAT_16B_4444: size = 2; break;
+ case FORMAT_24B_6666: size = 3; break;
+ case FORMAT_32B_8888: size = 4; break;
default: _assert_(0); break;
}
break;
diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
index a4c696f..7953cf6 100644
--- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
+++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
@@ -4,10 +4,10 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
-#include "BPMemory.h"
-#include "CPMemory.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CPMemory.h"
namespace FifoAnalyzer
{
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
index 5e7e864..d4b6634 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FifoDataFile.h"
-#include "FifoFileStruct.h"
+#include "Common/FileUtil.h"
-#include "FileUtil.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+#include "Core/FifoPlayer/FifoFileStruct.h"
using namespace FifoFileStruct;
using namespace std;
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.h b/Source/Core/Core/FifoPlayer/FifoDataFile.h
index bddd546..f1d4ace 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.h
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.h
@@ -4,9 +4,10 @@
#pragma once
-#include "Common.h"
#include <vector>
+#include "Common/Common.h"
+
namespace File
{
class IOFile;
@@ -64,8 +65,8 @@ public:
u32 *GetXFRegs() { return m_XFRegs; }
void AddFrame(const FifoFrameInfo &frameInfo);
- const FifoFrameInfo &GetFrame(int frame) const { return m_Frames[frame]; }
- int GetFrameCount() { return (int)m_Frames.size(); }
+ const FifoFrameInfo &GetFrame(size_t frame) const { return m_Frames[frame]; }
+ size_t GetFrameCount() { return m_Frames.size(); }
bool Save(const char *filename);
diff --git a/Source/Core/Core/FifoPlayer/FifoFileStruct.h b/Source/Core/Core/FifoPlayer/FifoFileStruct.h
index daa4f41..928a2d5 100644
--- a/Source/Core/Core/FifoPlayer/FifoFileStruct.h
+++ b/Source/Core/Core/FifoPlayer/FifoFileStruct.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace FifoFileStruct
{
diff --git a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
index e6adc14..e389f77 100644
--- a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp
@@ -2,15 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FifoAnalyzer.h"
-#include "FifoDataFile.h"
-#include "FifoPlaybackAnalyzer.h"
+#include "Common/Common.h"
-#include "Common.h"
+#include "Core/FifoPlayer/FifoAnalyzer.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+#include "Core/FifoPlayer/FifoPlaybackAnalyzer.h"
-#include "OpcodeDecoding.h"
-#include "TextureDecoder.h"
-#include "VertexLoader.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VertexLoader.h"
using namespace std;
using namespace FifoAnalyzer;
@@ -49,7 +49,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
frameInfo.clear();
frameInfo.resize(file->GetFrameCount());
- for (int frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
+ for (size_t frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
{
const FifoFrameInfo& frame = file->GetFrame(frameIdx);
AnalyzedFrameInfo& analyzed = frameInfo[frameIdx];
diff --git a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.h
index 0db01ce..fd85274 100644
--- a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.h
+++ b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.h
@@ -4,12 +4,12 @@
#pragma once
-#include "FifoAnalyzer.h"
-#include "FifoDataFile.h"
-
#include <string>
#include <vector>
+#include "Core/FifoPlayer/FifoAnalyzer.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+
struct AnalyzedFrameInfo
{
std::vector<u32> objectStarts;
diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp
index 8aaf962..55731f3 100644
--- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp
@@ -2,21 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FifoDataFile.h"
-#include "FifoPlayer.h"
+#include "Common/Common.h"
-#include "Common.h"
-#include "ConfigManager.h"
-#include "Core.h"
-#include "CoreTiming.h"
-#include "Host.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Host.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+#include "Core/FifoPlayer/FifoPlayer.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/PowerPC/PowerPC.h"
-#include "HW/GPFifo.h"
-#include "HW/Memmap.h"
-#include "HW/SystemTimers.h"
-#include "PowerPC/PowerPC.h"
-
-#include "BPMemory.h"
+#include "VideoCommon/BPMemory.h"
FifoPlayer::~FifoPlayer()
{
@@ -260,7 +259,7 @@ void FifoPlayer::WriteAllMemoryUpdates()
{
_assert_(m_File);
- for (int frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
+ for (size_t frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
{
const FifoFrameInfo &frame = m_File->GetFrame(frameNum);
for (auto& update : frame.memoryUpdates)
@@ -309,8 +308,8 @@ void FifoPlayer::WriteFifo(u8 *data, u32 start, u32 end)
void FifoPlayer::SetupFifo()
{
- WriteCP(0x02, 0); // disable read, BP, interrupts
- WriteCP(0x04, 7); // clear overflow, underflow, metrics
+ WriteCP(0x02, 0); // disable read, BP, interrupts
+ WriteCP(0x04, 7); // clear overflow, underflow, metrics
const FifoFrameInfo& frame = m_File->GetFrame(m_CurrentFrame);
@@ -344,7 +343,7 @@ void FifoPlayer::SetupFifo()
FlushWGP();
WritePI(20, frame.fifoStart);
- WriteCP(0x02, 17); // enable read & GP link
+ WriteCP(0x02, 17); // enable read & GP link
}
void FifoPlayer::LoadMemory()
diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.h b/Source/Core/Core/FifoPlayer/FifoPlayer.h
index c6e3318..3ed2547 100644
--- a/Source/Core/Core/FifoPlayer/FifoPlayer.h
+++ b/Source/Core/Core/FifoPlayer/FifoPlayer.h
@@ -4,10 +4,11 @@
#pragma once
-#include "FifoPlaybackAnalyzer.h"
#include <string>
#include <vector>
+#include "Core/FifoPlayer/FifoPlaybackAnalyzer.h"
+
class FifoDataFile;
struct MemoryUpdate;
struct AnalyzedFrameInfo;
diff --git a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp
index d628e9b..7e16ddb 100644
--- a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp
@@ -2,15 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FifoAnalyzer.h"
-#include "FifoRecordAnalyzer.h"
-#include "FifoRecorder.h"
-
-#include "Core.h"
-#include "HW/Memmap.h"
-
-#include "OpcodeDecoding.h"
-#include "TextureDecoder.h"
+#include "Core/Core.h"
+#include "Core/FifoPlayer/FifoAnalyzer.h"
+#include "Core/FifoPlayer/FifoRecordAnalyzer.h"
+#include "Core/FifoPlayer/FifoRecorder.h"
+#include "Core/HW/Memmap.h"
+
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/TextureDecoder.h"
using namespace FifoAnalyzer;
diff --git a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h
index 06edc81..bc9a27b 100644
--- a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h
+++ b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h
@@ -4,11 +4,11 @@
#pragma once
-#include "FifoAnalyzer.h"
+#include "Common/Common.h"
-#include "Common.h"
+#include "Core/FifoPlayer/FifoAnalyzer.h"
-#include "BPMemory.h"
+#include "VideoCommon/BPMemory.h"
class FifoRecordAnalyzer
{
diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
index e58b346..7207812 100644
--- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ConfigManager.h"
-#include "Core.h"
-#include "FifoRecorder.h"
-#include "Thread.h"
-#include "HW/Memmap.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/FifoPlayer/FifoRecorder.h"
+#include "Core/HW/Memmap.h"
static FifoRecorder instance;
static std::recursive_mutex sMutex;
diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.h b/Source/Core/Core/FifoPlayer/FifoRecorder.h
index 4cee419..2b7bc0d 100644
--- a/Source/Core/Core/FifoPlayer/FifoRecorder.h
+++ b/Source/Core/Core/FifoPlayer/FifoRecorder.h
@@ -4,8 +4,8 @@
#pragma once
-#include "FifoDataFile.h"
-#include "FifoRecordAnalyzer.h"
+#include "Core/FifoPlayer/FifoDataFile.h"
+#include "Core/FifoPlayer/FifoRecordAnalyzer.h"
class FifoRecorder
{
diff --git a/Source/Core/Core/GeckoCode.cpp b/Source/Core/Core/GeckoCode.cpp
index cfb9e35..310704a 100644
--- a/Source/Core/Core/GeckoCode.cpp
+++ b/Source/Core/Core/GeckoCode.cpp
@@ -2,15 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GeckoCode.h"
+#include <vector>
-#include "Thread.h"
-#include "HW/Memmap.h"
-#include "ConfigManager.h"
-#include "PowerPC/PowerPC.h"
-#include "CommonPaths.h"
+#include "Common/CommonPaths.h"
+#include "Common/Thread.h"
-#include <vector>
+#include "Core/ConfigManager.h"
+#include "Core/GeckoCode.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
namespace Gecko
{
@@ -161,4 +161,4 @@ void RunCodeHandler()
}
}
-} // namespace Gecko
+} // namespace Gecko
diff --git a/Source/Core/Core/GeckoCode.h b/Source/Core/Core/GeckoCode.h
index 0ceb9b7..d91e321 100644
--- a/Source/Core/Core/GeckoCode.h
+++ b/Source/Core/Core/GeckoCode.h
@@ -4,11 +4,11 @@
#pragma once
-#include "Common.h"
-
-#include <vector>
-#include <string>
#include <map>
+#include <string>
+#include <vector>
+
+#include "Common/Common.h"
namespace Gecko
{
@@ -45,4 +45,4 @@ namespace Gecko
bool RunActiveCodes();
void RunCodeHandler();
-} // namespace Gecko
+} // namespace Gecko
diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp
index e5e6496..6d41d2b 100644
--- a/Source/Core/Core/GeckoCodeConfig.cpp
+++ b/Source/Core/Core/GeckoCodeConfig.cpp
@@ -2,24 +2,25 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GeckoCodeConfig.h"
+#include <sstream>
+#include <string>
+#include <vector>
-#include "StringUtil.h"
+#include "Common/StringUtil.h"
-#include <vector>
-#include <string>
-#include <sstream>
+#include "Core/GeckoCodeConfig.h"
namespace Gecko
{
void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector<GeckoCode>& gcodes)
{
- const IniFile* inis[] = {&globalIni, &localIni};
- for (size_t i = 0; i < ArraySize(inis); ++i)
+ const IniFile* inis[2] = { &globalIni, &localIni };
+
+ for (const IniFile* ini : inis)
{
std::vector<std::string> lines;
- inis[i]->GetLines("Gecko", lines, false);
+ ini->GetLines("Gecko", lines, false);
GeckoCode gcode;
@@ -28,7 +29,7 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector<Ge
if (line.empty())
continue;
- std::istringstream ss(line);
+ std::istringstream ss(line);
switch ((line)[0])
{
@@ -40,11 +41,11 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector<Ge
if (gcode.name.size())
gcodes.push_back(gcode);
gcode = GeckoCode();
- gcode.enabled = (1 == ss.tellg()); // silly
- gcode.user_defined = i == 1;
+ gcode.enabled = (1 == ss.tellg()); // silly
+ gcode.user_defined = (ini == &localIni);
ss.seekg(1, std::ios_base::cur);
// read the code name
- std::getline(ss, gcode.name, '['); // stop at [ character (beginning of contributor name)
+ std::getline(ss, gcode.name, '['); // stop at [ character (beginning of contributor name)
gcode.name = StripSpaces(gcode.name);
// read the code creator name
std::getline(ss, gcode.creator, ']');
@@ -73,7 +74,7 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector<Ge
if (gcode.name.size())
gcodes.push_back(gcode);
- inis[i]->GetLines("Gecko_Enabled", lines, false);
+ ini->GetLines("Gecko_Enabled", lines, false);
for (auto line : lines)
{
diff --git a/Source/Core/Core/GeckoCodeConfig.h b/Source/Core/Core/GeckoCodeConfig.h
index 2878650..6131dac 100644
--- a/Source/Core/Core/GeckoCodeConfig.h
+++ b/Source/Core/Core/GeckoCodeConfig.h
@@ -4,9 +4,9 @@
#pragma once
-#include "GeckoCode.h"
+#include "Common/IniFile.h"
-#include "IniFile.h"
+#include "Core/GeckoCode.h"
namespace Gecko
{
diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp
index c0ecc50..1787246 100644
--- a/Source/Core/Core/HLE/HLE.cpp
+++ b/Source/Core/Core/HLE/HLE.cpp
@@ -2,20 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "HLE.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HLE/HLE_OS.h"
+#include "Core/HLE/HLE_Misc.h"
+#include "Core/HW/Memmap.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
-#include "../PowerPC/PowerPC.h"
-#include "../PowerPC/PPCSymbolDB.h"
-#include "../HW/Memmap.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-
-#include "HLE_OS.h"
-#include "HLE_Misc.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_es.h"
-#include "ConfigManager.h"
-#include "Core.h"
namespace HLE
{
@@ -112,7 +111,7 @@ void PatchFunctions()
}
}
- // CBreakPoints::AddBreakPoint(0x8000D3D0, false);
+ // CBreakPoints::AddBreakPoint(0x8000D3D0, false);
}
void Execute(u32 _CurrentPC, u32 _Instruction)
@@ -127,7 +126,7 @@ void Execute(u32 _CurrentPC, u32 _Instruction)
PanicAlert("HLE system tried to call an undefined HLE function %i.", FunctionIndex);
}
- // _dbg_assert_msg_(HLE,NPC == LR, "Broken HLE function (doesn't set NPC)", OSPatches[pos].m_szPatchName);
+ // _dbg_assert_msg_(HLE,NPC == LR, "Broken HLE function (doesn't set NPC)", OSPatches[pos].m_szPatchName);
}
u32 GetFunctionIndex(u32 addr)
diff --git a/Source/Core/Core/HLE/HLE.h b/Source/Core/Core/HLE/HLE.h
index 6deea01..f320ff3 100644
--- a/Source/Core/Core/HLE/HLE.h
+++ b/Source/Core/Core/HLE/HLE.h
@@ -5,7 +5,8 @@
#pragma once
#include <map>
-#include "CommonTypes.h"
+
+#include "Common/CommonTypes.h"
namespace HLE
{
diff --git a/Source/Core/Core/HLE/HLE_Misc.cpp b/Source/Core/Core/HLE/HLE_Misc.cpp
index 9b8754d..3bfb882 100644
--- a/Source/Core/Core/HLE/HLE_Misc.cpp
+++ b/Source/Core/Core/HLE/HLE_Misc.cpp
@@ -3,25 +3,28 @@
// Refer to the license.txt file included.
#include <cmath>
-#include "Common.h"
-#include "HLE_OS.h"
-
-#include "../PowerPC/PowerPC.h"
-#include "../HW/Memmap.h"
-#include "../Host.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_DI.h"
-#include "ConfigManager.h"
-#include "VolumeCreator.h"
-#include "Filesystem.h"
-#include "../Boot/Boot_DOL.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-#include "HLE.h"
-#include "PowerPC/PPCAnalyst.h"
-#include "PowerPC/PPCCache.h"
-#include "PowerPC/SignatureDB.h"
-#include "PowerPC/PPCSymbolDB.h"
-#include "CommonPaths.h"
-#include "TextureCacheBase.h"
+
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HLE/HLE_OS.h"
+#include "Core/HW/Memmap.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCCache.h"
+#include "Core/PowerPC/SignatureDB.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/VolumeCreator.h"
+
+#include "VideoCommon/TextureCacheBase.h"
namespace HLE_Misc
{
diff --git a/Source/Core/Core/HLE/HLE_OS.cpp b/Source/Core/Core/HLE/HLE_OS.cpp
index ed02672..d4bf998 100644
--- a/Source/Core/Core/HLE/HLE_OS.cpp
+++ b/Source/Core/Core/HLE/HLE_OS.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "StringUtil.h"
#include <string>
-#include "Common.h"
-#include "HLE_OS.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
-#include "../PowerPC/PowerPC.h"
-#include "../HW/Memmap.h"
+#include "Core/HLE/HLE_OS.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
namespace HLE_OS
{
diff --git a/Source/Core/Core/HLE/HLE_OS.h b/Source/Core/Core/HLE/HLE_OS.h
index c55f27f..f0d0af2 100644
--- a/Source/Core/Core/HLE/HLE_OS.h
+++ b/Source/Core/Core/HLE/HLE_OS.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace HLE_OS
{
diff --git a/Source/Core/Core/HW/AudioInterface.cpp b/Source/Core/Core/HW/AudioInterface.cpp
index 70a4dd0..1512dba 100644
--- a/Source/Core/Core/HW/AudioInterface.cpp
+++ b/Source/Core/Core/HW/AudioInterface.cpp
@@ -50,18 +50,18 @@ This file mainly deals with the [Drive I/F], however [AIDFR] controls
TODO maybe the files should be merged?
*/
-#include "Common.h"
-#include "MathUtil.h"
-
-#include "StreamADPCM.h"
-#include "AudioInterface.h"
-
-#include "CPU.h"
-#include "ProcessorInterface.h"
-#include "DVDInterface.h"
-#include "../PowerPC/PowerPC.h"
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+
+#include "Core/CoreTiming.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/StreamADPCM.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/PowerPC/PowerPC.h"
namespace AudioInterface
{
@@ -170,43 +170,12 @@ void Shutdown()
{
}
-void Read32(u32& _rReturnValue, const u32 _Address)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- switch (_Address & 0xFFFF)
- {
- case AI_CONTROL_REGISTER:
- _rReturnValue = m_Control.hex;
- break;
-
- case AI_VOLUME_REGISTER:
- _rReturnValue = m_Volume.hex;
- break;
-
- case AI_SAMPLE_COUNTER:
- Update(0, 0);
- _rReturnValue = m_SampleCounter;
- break;
-
- case AI_INTERRUPT_TIMING:
- _rReturnValue = m_InterruptTiming;
- break;
-
- default:
- ERROR_LOG(AUDIO_INTERFACE, "Unknown read 0x%08x", _Address);
- _dbg_assert_msg_(AUDIO_INTERFACE, 0, "AudioInterface - Read from 0x%08x", _Address);
- _rReturnValue = 0;
- return;
- }
- DEBUG_LOG(AUDIO_INTERFACE, "r32 %08x %08x", _Address, _rReturnValue);
-}
-
-void Write32(const u32 _Value, const u32 _Address)
-{
- switch (_Address & 0xFFFF)
- {
- case AI_CONTROL_REGISTER:
- {
- AICR tmpAICtrl(_Value);
+ mmio->Register(base | AI_CONTROL_REGISTER,
+ MMIO::DirectRead<u32>(&m_Control.hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ AICR tmpAICtrl(val);
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
@@ -260,32 +229,30 @@ void Write32(const u32 _Value, const u32 _Address)
}
UpdateInterrupts();
- }
- break;
-
- case AI_VOLUME_REGISTER:
- m_Volume.hex = _Value;
- DEBUG_LOG(AUDIO_INTERFACE, "Set volume: left(%02x) right(%02x)", m_Volume.left, m_Volume.right);
- break;
-
- case AI_SAMPLE_COUNTER:
- // Why was this commented out? Does something do this?
- _dbg_assert_msg_(AUDIO_INTERFACE, 0, "AIS - sample counter is read only");
- m_SampleCounter = _Value;
- break;
-
- case AI_INTERRUPT_TIMING:
- m_InterruptTiming = _Value;
- CoreTiming::RemoveEvent(et_AI);
- CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
- DEBUG_LOG(AUDIO_INTERFACE, "Set interrupt: %08x samples", m_InterruptTiming);
- break;
-
- default:
- ERROR_LOG(AUDIO_INTERFACE, "Unknown write %08x @ %08x", _Value, _Address);
- _dbg_assert_msg_(AUDIO_INTERFACE,0,"AIS - Write %08x to %08x", _Value, _Address);
- break;
- }
+ })
+ );
+
+ mmio->Register(base | AI_VOLUME_REGISTER,
+ MMIO::DirectRead<u32>(&m_Volume.hex),
+ MMIO::DirectWrite<u32>(&m_Volume.hex)
+ );
+
+ mmio->Register(base | AI_SAMPLE_COUNTER,
+ MMIO::ComplexRead<u32>([](u32) {
+ Update(0, 0);
+ return m_SampleCounter;
+ }),
+ MMIO::DirectWrite<u32>(&m_SampleCounter)
+ );
+
+ mmio->Register(base | AI_INTERRUPT_TIMING,
+ MMIO::DirectRead<u32>(&m_InterruptTiming),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ m_InterruptTiming = val;
+ CoreTiming::RemoveEvent(et_AI);
+ CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
+ })
+ );
}
static void UpdateInterrupts()
@@ -364,7 +331,7 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
{
frac &= 0xffff;
- l1 = l2; //current
+ l1 = l2; //current
l2 = pcm[pos * 2]; //next
}
diff --git a/Source/Core/Core/HW/AudioInterface.h b/Source/Core/Core/HW/AudioInterface.h
index 25086b3..404f14d 100644
--- a/Source/Core/Core/HW/AudioInterface.h
+++ b/Source/Core/Core/HW/AudioInterface.h
@@ -6,9 +6,10 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
namespace AudioInterface
{
@@ -17,15 +18,14 @@ void Init();
void Shutdown();
void DoState(PointerWrap &p);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
void Update(u64 userdata, int cyclesLate);
// Called by DSP emulator
void Callback_GetSampleRate(unsigned int &_AISampleRate, unsigned int &_DACSampleRate);
unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples, unsigned int _sampleRate = 48000);
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
-
// Get the audio rates (48000 or 32000 only)
unsigned int GetAIDSampleRate();
diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Apple.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Apple.cpp
index 5309d9f..6d65812 100644
--- a/Source/Core/Core/HW/BBA-TAP/TAP_Apple.cpp
+++ b/Source/Core/Core/HW/BBA-TAP/TAP_Apple.cpp
@@ -1,22 +1,9 @@
-// Copyright (C) 2003-2009 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "../EXI_Device.h"
-#include "../EXI_DeviceEthernet.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceEthernet.h"
bool CEXIETHERNET::Activate()
{
diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
index 1140ef7..c81659e 100644
--- a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
+++ b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
@@ -1,23 +1,10 @@
-// Copyright (C) 2003-2009 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "StringUtil.h"
-#include "../EXI_Device.h"
-#include "../EXI_DeviceEthernet.h"
+#include "Common/StringUtil.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceEthernet.h"
#ifdef __linux__
#include <fcntl.h>
diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp
index c547038..4d8fc3c 100644
--- a/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp
+++ b/Source/Core/Core/HW/BBA-TAP/TAP_Win32.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "StringUtil.h"
-// GROSS CODE ALERT: headers need to be included in the following order
-#include "TAP_Win32.h"
-#include "../EXI_Device.h"
-#include "../EXI_DeviceEthernet.h"
+#include "Common/StringUtil.h"
+
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceEthernet.h"
+#include "Core/HW/BBA-TAP/TAP_Win32.h"
namespace Win32TAPHelper
{
diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp
index dc81955..5a28694 100644
--- a/Source/Core/Core/HW/CPU.cpp
+++ b/Source/Core/Core/HW/CPU.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "Thread.h"
-
-#include "../DSPEmulator.h"
-#include "../PowerPC/PowerPC.h"
-#include "../Host.h"
-#include "../Core.h"
-#include "CPU.h"
-#include "DSP.h"
-#include "Movie.h"
-
-#include "VideoBackendBase.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
+
+#include "Core/Core.h"
+#include "Core/DSPEmulator.h"
+#include "Core/Host.h"
+#include "Core/Movie.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace
{
diff --git a/Source/Core/Core/HW/CPU.h b/Source/Core/Core/HW/CPU.h
index bba52b6..cbdfa91 100644
--- a/Source/Core/Core/HW/CPU.h
+++ b/Source/Core/Core/HW/CPU.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace Common {
class Event;
diff --git a/Source/Core/Core/HW/DSP.cpp b/Source/Core/Core/HW/DSP.cpp
index 821ba69..fe14e1e 100644
--- a/Source/Core/Core/HW/DSP.cpp
+++ b/Source/Core/Core/HW/DSP.cpp
@@ -23,18 +23,19 @@
// the just used buffer through the AXList (or whatever it might be called in
// Nintendo games).
-#include "DSP.h"
-
-#include "../CoreTiming.h"
-#include "../Core.h"
-#include "CPU.h"
-#include "MemoryUtil.h"
-#include "Memmap.h"
-#include "ProcessorInterface.h"
-#include "AudioInterface.h"
-#include "../PowerPC/PowerPC.h"
-#include "../ConfigManager.h"
-#include "../DSPEmulator.h"
+#include "Common/MemoryUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/DSPEmulator.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/PowerPC.h"
namespace DSP
{
@@ -287,138 +288,103 @@ void Shutdown()
dsp_emulator = NULL;
}
-void Read16(u16& _uReturnValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- switch (_iAddress & 0xFFFF)
- {
- // DSP
- case DSP_MAIL_TO_DSP_HI:
- if (dsp_slice > DSP_MAIL_SLICE && dsp_is_lle) {
- dsp_emulator->DSP_Update(DSP_MAIL_SLICE);
- dsp_slice -= DSP_MAIL_SLICE;
- }
- _uReturnValue = dsp_emulator->DSP_ReadMailBoxHigh(true);
- break;
-
- case DSP_MAIL_TO_DSP_LO:
- _uReturnValue = dsp_emulator->DSP_ReadMailBoxLow(true);
- break;
-
- case DSP_MAIL_FROM_DSP_HI:
- if (dsp_slice > DSP_MAIL_SLICE && dsp_is_lle) {
- dsp_emulator->DSP_Update(DSP_MAIL_SLICE);
- dsp_slice -= DSP_MAIL_SLICE;
- }
- _uReturnValue = dsp_emulator->DSP_ReadMailBoxHigh(false);
- break;
-
- case DSP_MAIL_FROM_DSP_LO:
- _uReturnValue = dsp_emulator->DSP_ReadMailBoxLow(false);
- break;
-
- case DSP_CONTROL:
- _uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) |
- (dsp_emulator->DSP_ReadControlRegister() & DSP_CONTROL_MASK);
- break;
-
- // ARAM
- case AR_INFO:
- //PanicAlert("Read %x %x", g_ARAM_Info.Hex,PowerPC::ppcState.pc);
- _uReturnValue = g_ARAM_Info.Hex;
- break;
-
- case AR_MODE:
- _uReturnValue = g_AR_MODE;
- break;
-
- case AR_REFRESH:
- _uReturnValue = g_AR_REFRESH;
- break;
-
- case AR_DMA_MMADDR_H: _uReturnValue = g_arDMA.MMAddr >> 16; return;
- case AR_DMA_MMADDR_L: _uReturnValue = g_arDMA.MMAddr & 0xFFFF; return;
- case AR_DMA_ARADDR_H: _uReturnValue = g_arDMA.ARAddr >> 16; return;
- case AR_DMA_ARADDR_L: _uReturnValue = g_arDMA.ARAddr & 0xFFFF; return;
- case AR_DMA_CNT_H: _uReturnValue = g_arDMA.Cnt.Hex >> 16; return;
- case AR_DMA_CNT_L: _uReturnValue = g_arDMA.Cnt.Hex & 0xFFFF; return;
-
- // AI
- case AUDIO_DMA_BLOCKS_LEFT:
- _uReturnValue = g_audioDMA.BlocksLeft > 0 ? g_audioDMA.BlocksLeft - 1 : 0; // AUDIO_DMA_BLOCKS_LEFT is zero based
- break;
-
- case AUDIO_DMA_START_LO:
- _uReturnValue = g_audioDMA.SourceAddress & 0xFFFF;
- break;
-
- case AUDIO_DMA_START_HI:
- _uReturnValue = g_audioDMA.SourceAddress >> 16;
- break;
-
- case AUDIO_DMA_CONTROL_LEN:
- _uReturnValue = g_audioDMA.AudioDMAControl.Hex;
- break;
-
- default:
- _uReturnValue = 0;
- _dbg_assert_(DSPINTERFACE,0);
- break;
- }
-
- if (_iAddress != (0xCC000000 + DSP_MAIL_FROM_DSP_HI))
+ // Declare all the boilerplate direct MMIOs.
+ struct {
+ u32 addr;
+ u16* ptr;
+ bool align_writes_on_32_bytes;
+ } directly_mapped_vars[] = {
+ { AR_INFO, &g_ARAM_Info.Hex },
+ { AR_MODE, &g_AR_MODE },
+ { AR_REFRESH, &g_AR_REFRESH },
+ { AR_DMA_MMADDR_H, MMIO::Utils::HighPart(&g_arDMA.MMAddr) },
+ { AR_DMA_MMADDR_L, MMIO::Utils::LowPart(&g_arDMA.MMAddr), true },
+ { AR_DMA_ARADDR_H, MMIO::Utils::HighPart(&g_arDMA.ARAddr) },
+ { AR_DMA_ARADDR_L, MMIO::Utils::LowPart(&g_arDMA.ARAddr), true },
+ { AR_DMA_CNT_H, MMIO::Utils::HighPart(&g_arDMA.Cnt.Hex) },
+ // AR_DMA_CNT_L triggers DMA
+ { AUDIO_DMA_START_HI, MMIO::Utils::HighPart(&g_audioDMA.SourceAddress) },
+ { AUDIO_DMA_START_LO, MMIO::Utils::LowPart(&g_audioDMA.SourceAddress) },
+ };
+ for (auto& mapped_var : directly_mapped_vars)
{
- DEBUG_LOG(DSPINTERFACE, "DSPInterface(r16) 0x%08x (0x%04x) (%08x)", _iAddress, _uReturnValue, PowerPC::ppcState.pc);
+ u16 write_mask = mapped_var.align_writes_on_32_bytes ? 0xFFE0 : 0xFFFF;
+ mmio->Register(base | mapped_var.addr,
+ MMIO::DirectRead<u16>(mapped_var.ptr),
+ MMIO::DirectWrite<u16>(mapped_var.ptr, write_mask)
+ );
}
-}
-void Write16(const u16 _Value, const u32 _Address)
-{
- DEBUG_LOG(DSPINTERFACE, "DSPInterface(w16) 0x%08x (0x%04x) (%08x)", _Address, _Value, PowerPC::ppcState.pc);
-
- switch (_Address & 0xFFFF)
- {
- // DSP
- case DSP_MAIL_TO_DSP_HI:
- dsp_emulator->DSP_WriteMailBoxHigh(true, _Value);
- break;
-
- case DSP_MAIL_TO_DSP_LO:
- dsp_emulator->DSP_WriteMailBoxLow(true, _Value);
- break;
-
- case DSP_MAIL_FROM_DSP_HI:
- _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI");
- break;
-
- case DSP_MAIL_FROM_DSP_LO:
- _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO");
- break;
-
- // Control Register
- case DSP_CONTROL:
- {
+ // DSP mail MMIOs call DSP emulator functions to get results or write data.
+ mmio->Register(base | DSP_MAIL_TO_DSP_HI,
+ MMIO::ComplexRead<u16>([](u32) {
+ if (dsp_slice > DSP_MAIL_SLICE && dsp_is_lle)
+ {
+ dsp_emulator->DSP_Update(DSP_MAIL_SLICE);
+ dsp_slice -= DSP_MAIL_SLICE;
+ }
+ return dsp_emulator->DSP_ReadMailBoxHigh(true);
+ }),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ dsp_emulator->DSP_WriteMailBoxHigh(true, val);
+ })
+ );
+ mmio->Register(base | DSP_MAIL_TO_DSP_LO,
+ MMIO::ComplexRead<u16>([](u32) {
+ return dsp_emulator->DSP_ReadMailBoxLow(true);
+ }),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ dsp_emulator->DSP_WriteMailBoxLow(true, val);
+ })
+ );
+ mmio->Register(base | DSP_MAIL_FROM_DSP_HI,
+ MMIO::ComplexRead<u16>([](u32) {
+ if (dsp_slice > DSP_MAIL_SLICE && dsp_is_lle)
+ {
+ dsp_emulator->DSP_Update(DSP_MAIL_SLICE);
+ dsp_slice -= DSP_MAIL_SLICE;
+ }
+ return dsp_emulator->DSP_ReadMailBoxHigh(false);
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+ mmio->Register(base | DSP_MAIL_FROM_DSP_LO,
+ MMIO::ComplexRead<u16>([](u32) {
+ return dsp_emulator->DSP_ReadMailBoxLow(false);
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+
+ mmio->Register(base | DSP_CONTROL,
+ MMIO::ComplexRead<u16>([](u32) {
+ return (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) |
+ (dsp_emulator->DSP_ReadControlRegister() & DSP_CONTROL_MASK);
+ }),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
UDSPControl tmpControl;
- tmpControl.Hex = (_Value & ~DSP_CONTROL_MASK) |
- (dsp_emulator->DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK);
+ tmpControl.Hex = (val & ~DSP_CONTROL_MASK) |
+ (dsp_emulator->DSP_WriteControlRegister(val) & DSP_CONTROL_MASK);
// Not really sure if this is correct, but it works...
// Kind of a hack because DSP_CONTROL_MASK should make this bit
// only viewable to dsp emulator
- if (_Value & 1 /*DSPReset*/)
+ if (val & 1 /*DSPReset*/)
{
g_audioDMA.AudioDMAControl.Hex = 0;
}
// Update DSP related flags
- g_dspState.DSPControl.DSPReset = tmpControl.DSPReset;
- g_dspState.DSPControl.DSPAssertInt = tmpControl.DSPAssertInt;
- g_dspState.DSPControl.DSPHalt = tmpControl.DSPHalt;
- g_dspState.DSPControl.DSPInit = tmpControl.DSPInit;
+ g_dspState.DSPControl.DSPReset = tmpControl.DSPReset;
+ g_dspState.DSPControl.DSPAssertInt = tmpControl.DSPAssertInt;
+ g_dspState.DSPControl.DSPHalt = tmpControl.DSPHalt;
+ g_dspState.DSPControl.DSPInit = tmpControl.DSPInit;
// Interrupt (mask)
- g_dspState.DSPControl.AID_mask = tmpControl.AID_mask;
- g_dspState.DSPControl.ARAM_mask = tmpControl.ARAM_mask;
- g_dspState.DSPControl.DSP_mask = tmpControl.DSP_mask;
+ g_dspState.DSPControl.AID_mask = tmpControl.AID_mask;
+ g_dspState.DSPControl.ARAM_mask = tmpControl.ARAM_mask;
+ g_dspState.DSPControl.DSP_mask = tmpControl.DSP_mask;
// Interrupt
if (tmpControl.AID) g_dspState.DSPControl.AID = 0;
@@ -426,184 +392,55 @@ void Write16(const u16 _Value, const u32 _Address)
if (tmpControl.DSP) g_dspState.DSPControl.DSP = 0;
// unknown
- g_dspState.DSPControl.unk3 = tmpControl.unk3;
- g_dspState.DSPControl.pad = tmpControl.pad;
+ g_dspState.DSPControl.unk3 = tmpControl.unk3;
+ g_dspState.DSPControl.pad = tmpControl.pad;
if (g_dspState.DSPControl.pad != 0)
{
- PanicAlert("DSPInterface (w) g_dspState.DSPControl (CC00500A) gets a value with junk in the padding %08x", _Value);
+ PanicAlert("DSPInterface (w) g_dspState.DSPControl (CC00500A) gets a value with junk in the padding %08x", val);
}
UpdateInterrupts();
- }
- break;
-
- // ARAM
- // DMA back and forth between ARAM and RAM
- case AR_INFO:
- //PanicAlert("AR_INFO %x PC: %x", _Value, PowerPC::ppcState.pc);
- ERROR_LOG(DSPINTERFACE, "AR_INFO %x PC: %x", _Value, PowerPC::ppcState.pc);
- g_ARAM_Info.Hex = _Value;
-
- // 0x43
- // Monster Hunter Tri, DKCR
-
- // 0x43, 0x63:
- // Rebel Strike, Clone Wars, WWE DOR2, Mario Golf
-
- // 0x43, 0x64, 0x63
- // Transworld Surf, Smashing Drive, SSBM, Cel Damage
-
- // __OSInitAudioSystem sets to 0x43 -> expects 16bit adressing and mapping to dsp iram?
- // __OSCheckSize sets = 0x20 | 3 (keeps upper bits)
- // 0x23 -> Zelda standard mode (standard ARAM access ??)
- // 0x43 -> Set by __OSInitAudioSystem
- // 0x58 -> Transworld Surf, Cel Damage, SSBM
- // 0x60 -> Transworld Surf, Cel Damage, SSBM
- // 0x63 -> ARCheckSize Mode (access AR-registers ??) or no exception ??
- // 0x64 -> Transworld Surf, Cel Damage, SSBM
-
- // 0x00 -> Switch to external ARAM
- // 0x04 -> Switch to internal ARAM
- break;
-
- case AR_MODE:
- g_AR_MODE = _Value;
- break;
-
- case AR_REFRESH:
- // 0x9c -> Set by Eternal Darkness
- g_AR_REFRESH = _Value;
- break;
-
- case AR_DMA_MMADDR_H:
- g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF) | (_Value<<16);
- break;
-
- case AR_DMA_MMADDR_L:
- // Align MMAddr to the 32 byte boundary. Verified on real HW
- g_arDMA.MMAddr = ((g_arDMA.MMAddr & 0xFFFF0000) | (_Value)) & ~31;
- break;
-
- case AR_DMA_ARADDR_H:
- g_arDMA.ARAddr = (g_arDMA.ARAddr & 0xFFFF) | (_Value<<16);
- break;
-
- case AR_DMA_ARADDR_L:
- // Align ARAddr to the 32 byte boundary. Verified on real HW
- g_arDMA.ARAddr = ((g_arDMA.ARAddr & 0xFFFF0000) | (_Value)) & ~31;
- break;
-
- case AR_DMA_CNT_H:
- g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF) | (_Value<<16);
- break;
-
- case AR_DMA_CNT_L:
- // Align count to the 32 byte boundary. Verified on real HW
- g_arDMA.Cnt.Hex = ((g_arDMA.Cnt.Hex & 0xFFFF0000) | (_Value)) & ~31;
- Do_ARAM_DMA();
- break;
-
- // AI
- // This is the DMA that goes straight out the speaker.
- case AUDIO_DMA_START_HI:
- g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF) | (_Value<<16);
- break;
-
- case AUDIO_DMA_START_LO:
- g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF0000) | (_Value);
- break;
-
- case AUDIO_DMA_CONTROL_LEN: // called by AIStartDMA()
- g_audioDMA.AudioDMAControl.Hex = _Value;
- g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
- g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
- INFO_LOG(DSPINTERFACE, "AID DMA started - source address %08x, length %i blocks", g_audioDMA.SourceAddress, g_audioDMA.AudioDMAControl.NumBlocks);
- break;
-
- case AUDIO_DMA_BLOCKS_LEFT:
- _dbg_assert_(DSPINTERFACE,0);
- break;
-
- default:
- _dbg_assert_(DSPINTERFACE,0);
- break;
- }
-}
-
-void Read32(u32& _uReturnValue, const u32 _iAddress)
-{
- INFO_LOG(DSPINTERFACE, "DSPInterface(r32) 0x%08x", _iAddress);
-
- switch (_iAddress & 0xFFFF)
- {
- // DSP
- case DSP_MAIL_TO_DSP_HI:
- _uReturnValue = (dsp_emulator->DSP_ReadMailBoxHigh(true) << 16) | dsp_emulator->DSP_ReadMailBoxLow(true);
- break;
-
- // AI
- case AUDIO_DMA_START_HI:
- _uReturnValue = g_audioDMA.SourceAddress;
- break;
-
- // ARAM
- case AR_DMA_ARADDR_H:
- _uReturnValue = g_arDMA.ARAddr;
- break;
-
- case AR_DMA_CNT_H:
- _uReturnValue = g_arDMA.Cnt.Hex;
- break;
-
- case AR_DMA_MMADDR_H:
- _uReturnValue = g_arDMA.MMAddr;
- break;
-
- default:
- _uReturnValue = 0;
- _dbg_assert_(DSPINTERFACE,0);
- break;
- }
-}
-
-void Write32(const u32 _iValue, const u32 _iAddress)
-{
- INFO_LOG(DSPINTERFACE, "DSPInterface(w32) 0x%08x 0x%08x", _iValue, _iAddress);
-
- switch (_iAddress & 0xFFFF)
+ })
+ );
+
+ // ARAM MMIO controlling the DMA start.
+ mmio->Register(base | AR_DMA_CNT_L,
+ MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&g_arDMA.Cnt.Hex)),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF0000) | (val & ~31);
+ Do_ARAM_DMA();
+ })
+ );
+
+ // Audio DMA MMIO controlling the DMA start.
+ mmio->Register(base | AUDIO_DMA_CONTROL_LEN,
+ MMIO::DirectRead<u16>(&g_audioDMA.AudioDMAControl.Hex),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ g_audioDMA.AudioDMAControl.Hex = val;
+ g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
+ g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
+ })
+ );
+
+ // Audio DMA blocks remaining is invalid to write to, and requires logic on
+ // the read side.
+ mmio->Register(base | AUDIO_DMA_BLOCKS_LEFT,
+ MMIO::ComplexRead<u16>([](u32) {
+ return (g_audioDMA.BlocksLeft > 0 ? g_audioDMA.BlocksLeft - 1 : 0);
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+
+ // 32 bit reads/writes are a combination of two 16 bit accesses.
+ for (int i = 0; i < 0x1000; i += 4)
{
- // DSP
- case DSP_MAIL_TO_DSP_HI:
- dsp_emulator->DSP_WriteMailBoxHigh(true, _iValue >> 16);
- dsp_emulator->DSP_WriteMailBoxLow(true, (u16)_iValue);
- break;
-
- // AI
- case AUDIO_DMA_START_HI:
- g_audioDMA.SourceAddress = _iValue;
- break;
-
- // ARAM
- case AR_DMA_MMADDR_H:
- g_arDMA.MMAddr = _iValue & ~31;
- break;
-
- case AR_DMA_ARADDR_H:
- g_arDMA.ARAddr = _iValue & ~31;
- break;
-
- case AR_DMA_CNT_H:
- g_arDMA.Cnt.Hex = _iValue & ~31;
- Do_ARAM_DMA();
- break;
-
- default:
- _dbg_assert_(DSPINTERFACE,0);
- break;
+ mmio->Register(base | i,
+ MMIO::ReadToSmaller<u32>(mmio, base | i, base | (i + 2)),
+ MMIO::WriteToSmaller<u32>(mmio, base | i, base | (i + 2))
+ );
}
}
-
// UpdateInterrupts
void UpdateInterrupts()
{
@@ -623,9 +460,9 @@ void GenerateDSPInterrupt(DSPInterruptType type, bool _bSet)
{
switch (type)
{
- case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break;
- case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break;
- case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break;
+ case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break;
+ case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break;
+ case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break;
}
UpdateInterrupts();
diff --git a/Source/Core/Core/HW/DSP.h b/Source/Core/Core/HW/DSP.h
index 002207c..2a9475a 100644
--- a/Source/Core/Core/HW/DSP.h
+++ b/Source/Core/Core/HW/DSP.h
@@ -4,9 +4,11 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
+
class PointerWrap;
class DSPEmulator;
+namespace MMIO { class Mapping; }
namespace DSP
{
@@ -28,6 +30,8 @@ enum
void Init(bool hle);
void Shutdown();
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
DSPEmulator *GetDSPEmulator();
void DoState(PointerWrap &p);
@@ -35,14 +39,6 @@ void DoState(PointerWrap &p);
void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true);
void GenerateDSPInterruptFromDSPEmu(DSPInterruptType _DSPInterruptType, bool _bSet = true);
-// Read32
-void Read16(u16& _uReturnValue, const u32 _uAddress);
-void Read32(u32& _uReturnValue, const u32 _uAddress);
-
-// Write
-void Write16(const u16 _uValue, const u32 _uAddress);
-void Write32(const u32 _uValue, const u32 _uAddress);
-
// Audio/DSP Helper
u8 ReadARAM(const u32 _uAddress);
void WriteARAM(u8 value, u32 _uAddress);
diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp
index 501bc2a..39a80ac 100644
--- a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp
+++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp
@@ -4,19 +4,19 @@
#include <iostream>
-#include "ChunkFile.h"
-#include "IniFile.h"
-#include "HLEMixer.h"
-#include "StringUtil.h"
-#include "LogManager.h"
-#include "IniFile.h"
-#include "DSPHLE.h"
-#include "UCodes/UCodes.h"
-#include "../AudioInterface.h"
-#include "ConfigManager.h"
-#include "Core.h"
-#include "HW/SystemTimers.h"
-#include "HW/VideoInterface.h"
+#include "Common/ChunkFile.h"
+#include "Common/IniFile.h"
+#include "Common/LogManager.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/HW/DSPHLE/HLEMixer.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
DSPHLE::DSPHLE()
{
diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.h b/Source/Core/Core/HW/DSPHLE/DSPHLE.h
index a5c784c..3a8df83 100644
--- a/Source/Core/Core/HW/DSPHLE/DSPHLE.h
+++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.h
@@ -4,10 +4,11 @@
#pragma once
-#include "AudioCommon.h"
-#include "SoundStream.h"
-#include "MailHandler.h"
-#include "../../DSPEmulator.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/SoundStream.h"
+
+#include "Core/DSPEmulator.h"
+#include "Core/HW/DSPHLE/MailHandler.h"
class IUCode;
diff --git a/Source/Core/Core/HW/DSPHLE/HLEMixer.cpp b/Source/Core/Core/HW/DSPHLE/HLEMixer.cpp
index 3b4e53c..d1d51c4 100644
--- a/Source/Core/Core/HW/DSPHLE/HLEMixer.cpp
+++ b/Source/Core/Core/HW/DSPHLE/HLEMixer.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPHLE.h"
-#include "HLEMixer.h"
-#include "UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
+#include "Core/HW/DSPHLE/HLEMixer.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
void HLEMixer::Premix(short *samples, unsigned int numSamples)
{
diff --git a/Source/Core/Core/HW/DSPHLE/HLEMixer.h b/Source/Core/Core/HW/DSPHLE/HLEMixer.h
index 1e5c21d..135bfe9 100644
--- a/Source/Core/Core/HW/DSPHLE/HLEMixer.h
+++ b/Source/Core/Core/HW/DSPHLE/HLEMixer.h
@@ -4,8 +4,8 @@
#pragma once
-#include "AudioCommon.h"
-#include "Mixer.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/Mixer.h"
class DSPHLE;
diff --git a/Source/Core/Core/HW/DSPHLE/MailHandler.cpp b/Source/Core/Core/HW/DSPHLE/MailHandler.cpp
index bcbc696..7ce1314 100644
--- a/Source/Core/Core/HW/DSPHLE/MailHandler.cpp
+++ b/Source/Core/Core/HW/DSPHLE/MailHandler.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MailHandler.h"
+#include "Core/HW/DSPHLE/MailHandler.h"
CMailHandler::CMailHandler()
{
diff --git a/Source/Core/Core/HW/DSPHLE/MailHandler.h b/Source/Core/Core/HW/DSPHLE/MailHandler.h
index 94a98f8..21b3747 100644
--- a/Source/Core/Core/HW/DSPHLE/MailHandler.h
+++ b/Source/Core/Core/HW/DSPHLE/MailHandler.h
@@ -6,8 +6,8 @@
#include <queue>
-#include "Common.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
class CMailHandler
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp
index 5502335..7dd4f19 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "UCode_AX.h"
-#include "../../DSP.h"
-#include "FileUtil.h"
-#include "ConfigManager.h"
-#include "MathUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/MathUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AX.h"
#define AX_GC
-#include "UCode_AX_Voice.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h"
CUCode_AX::CUCode_AX(DSPHLE* dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
@@ -34,7 +35,7 @@ CUCode_AX::~CUCode_AX()
{
if (m_run_on_thread)
{
- m_cmdlist_size = (u16)-1; // Special value to signal end
+ m_cmdlist_size = (u16)-1; // Special value to signal end
NotifyAXThread();
m_axthread.join();
}
@@ -94,7 +95,7 @@ void CUCode_AX::AXThread()
m_cmdlist_cv.wait(lk);
}
- if (m_cmdlist_size == (u16)-1) // End of thread signal
+ if (m_cmdlist_size == (u16)-1) // End of thread signal
break;
m_processing.lock();
@@ -202,7 +203,7 @@ void CUCode_AX::HandleCommandList()
SetMainLR(HILO_TO_32(addr));
break;
- case CMD_UNK_08: curr_idx += 10; break; // TODO: check
+ case CMD_UNK_08: curr_idx += 10; break; // TODO: check
case CMD_MIX_AUXB_NOWRITE:
addr_hi = m_cmdlist[curr_idx++];
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.h
index 53c9328..ede8ef6 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.h
@@ -12,8 +12,8 @@
#pragma once
-#include "UCodes.h"
-#include "UCode_AXStructs.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
// We can't directly use the mixer_control field from the PB because it does
// not mean the same in all AX versions. The AX UCode converts the
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp
index 4a82082..5a8162e 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MathUtil.h"
-#include "StringUtil.h"
+#include "AudioCommon/Mixer.h"
+#include "Common/MathUtil.h"
+#include "Common/StringUtil.h"
-#include "../MailHandler.h"
-#include "Mixer.h"
+#include "Core/HW/DSPHLE/MailHandler.h"
-#include "UCodes.h"
-#include "UCode_AXStructs.h"
-#include "UCode_AXWii.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AXWii.h"
#define AX_WII
-#include "UCode_AX_Voice.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h"
CUCode_AXWii::CUCode_AXWii(DSPHLE *dsp_hle, u32 l_CRC)
@@ -41,10 +41,10 @@ void CUCode_AXWii::HandleCommandList()
u32 pb_addr = 0;
-// WARN_LOG(DSPHLE, "Command list:");
-// for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
-// WARN_LOG(DSPHLE, "%04x", m_cmdlist[i]);
-// WARN_LOG(DSPHLE, "-------------");
+ // WARN_LOG(DSPHLE, "Command list:");
+ // for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
+ // WARN_LOG(DSPHLE, "%04x", m_cmdlist[i]);
+ // WARN_LOG(DSPHLE, "-------------");
u32 curr_idx = 0;
bool end = false;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.h
index 713b95e..fcee1ea 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AXWii.h
@@ -4,7 +4,7 @@
#pragma once
-#include "UCode_AX.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AX.h"
class CUCode_AXWii : public CUCode_AX
{
@@ -65,7 +65,7 @@ protected:
void UploadAUXMixLRSC(int aux_id, u32* addresses, u16 volume);
void OutputSamples(u32 lr_addr, u32 surround_addr, u16 volume,
bool upload_auxc);
- void OutputWMSamples(u32* addresses); // 4 addresses
+ void OutputWMSamples(u32* addresses); // 4 addresses
private:
enum CmdType
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h
index 645dfe3..3253e94 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX_Voice.h
@@ -12,13 +12,13 @@
#error UCode_AX_Voice.h included without specifying version
#endif
-#include "Common.h"
-#include "MathUtil.h"
-#include "UCode_AXStructs.h"
-#include "../../DSP.h"
-
#include <functional>
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AXStructs.h"
+
#ifdef AX_GC
# define PB_TYPE AXPB
# define MAX_SAMPLES_PER_FRAME 32
@@ -193,7 +193,7 @@ u16 AcceleratorGetSample()
switch (acc_pb->audio_addr.sample_format)
{
- case 0x00: // ADPCM
+ case 0x00: // ADPCM
{
// ADPCM decoding, not much to explain here.
if ((*acc_cur_addr & 15) == 0)
@@ -225,14 +225,14 @@ u16 AcceleratorGetSample()
break;
}
- case 0x0A: // 16-bit PCM audio
+ case 0x0A: // 16-bit PCM audio
ret = (DSP::ReadARAM(*acc_cur_addr * 2) << 8) | DSP::ReadARAM(*acc_cur_addr * 2 + 1);
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
acc_pb->adpcm.yn1 = ret;
*acc_cur_addr += 1;
break;
- case 0x19: // 8-bit PCM audio
+ case 0x19: // 8-bit PCM audio
ret = DSP::ReadARAM(*acc_cur_addr) << 8;
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
acc_pb->adpcm.yn1 = ret;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.cpp
index bb0d858..2ff25c7 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../DSPHLE.h"
-#include "UCodes.h"
-#include "UCode_CARD.h"
-#include "../../DSP.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_CARD.h"
CUCode_CARD::CUCode_CARD(DSPHLE *dsp_hle, u32 crc)
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.h
index 64031a1..5743e5f 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_CARD.h
@@ -4,7 +4,7 @@
#pragma once
-#include "UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_CARD : public IUCode
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.cpp
index 6490dd9..f610702 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.cpp
@@ -2,11 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "UCodes.h"
-#include "UCode_GBA.h"
-
-#include "../../DSP.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_GBA.h"
CUCode_GBA::CUCode_GBA(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.h
index 61e68a9..db0e9a7 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_GBA.h
@@ -4,7 +4,7 @@
#pragma once
-#include "UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
struct CUCode_GBA : public IUCode
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp
index 1d54f70..24bc202 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "UCodes.h"
-#include "UCode_InitAudioSystem.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h"
CUCode_InitAudioSystem::CUCode_InitAudioSystem(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h
index 6d18114..1515f09 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h
@@ -4,7 +4,7 @@
#pragma once
-#include "UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_InitAudioSystem : public IUCode
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp
index 2b63bcf..d6e12f9 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp
@@ -6,11 +6,12 @@
#include <Windows.h>
#endif
-#include "UCodes.h"
-#include "UCode_ROM.h"
-#include "Hash.h"
-#include "../../Memmap.h"
-#include "ConfigManager.h"
+#include "Common/Hash.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_ROM.h"
CUCode_Rom::CUCode_Rom(DSPHLE *dsp_hle, u32 crc)
: IUCode(dsp_hle, crc)
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.h
index 51d5fec..96983e7 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.h
@@ -4,7 +4,7 @@
#pragma once
-#include "UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
class CUCode_Rom : public IUCode
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp
index 899a7d9..a33b546 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp
@@ -6,15 +6,14 @@
// Zelda: The Windwaker, Mario Sunshine, Mario Kart, Twilight Princess,
// Super Mario Galaxy
-#include "UCodes.h"
-#include "UCode_Zelda.h"
-#include "../MailHandler.h"
+#include "AudioCommon/Mixer.h"
+#include "AudioCommon/WaveFile.h"
-#include "Mixer.h"
-
-#include "WaveFile.h"
-#include "../../DSP.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPHLE/MailHandler.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
@@ -126,7 +125,7 @@ void CUCode_Zelda::HandleMail(u32 _uMail)
void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
{
//ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i",
- // _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps);
+ // _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps);
if (m_bSyncCmdPending)
{
@@ -199,11 +198,11 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
if (m_CurBuffer == m_NumBuffers)
{
m_rMailHandler.PushMail(DSP_FRAME_END);
- // DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
+ // DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
-// soundStream->Update(); //do it in this thread to avoid sync problems
+ // soundStream->Update(); //do it in this thread to avoid sync problems
m_bSyncCmdPending = false;
}
@@ -247,23 +246,23 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
m_numSteps = _uMail;
m_step = 0;
}
- else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail
+ else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail
{
// The low part of the mail tells the operation to perform
// Seeing as every possible operation number halts the uCode,
// except 3, that thing seems to be intended for debugging
switch (_uMail & 0xFFFF)
{
- case 0x0003: // Do nothing
+ case 0x0003: // Do nothing
return;
- case 0x0000: // Halt
- case 0x0001: // Dump memory? and halt
- case 0x0002: // Do something and halt
+ case 0x0000: // Halt
+ case 0x0001: // Dump memory? and halt
+ case 0x0002: // Do something and halt
WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received halting operation %04X", _uMail & 0xFFFF);
return;
- default: // Invalid (the real ucode would likely crash)
+ default: // Invalid (the real ucode would likely crash)
WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received invalid operation %04X", _uMail & 0xFFFF);
return;
}
@@ -333,7 +332,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
-// soundStream->Update(); //do it in this thread to avoid sync problems
+ // soundStream->Update(); //do it in this thread to avoid sync problems
m_bSyncCmdPending = false;
}
@@ -381,31 +380,31 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
m_numSteps = _uMail;
m_step = 0;
}
- else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail
+ else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail
{
// The low part of the mail tells the operation to perform
// Seeing as every possible operation number halts the uCode,
// except 3, that thing seems to be intended for debugging
switch (_uMail & 0xFFFF)
{
- case 0x0003: // Do nothing - continue normally
+ case 0x0003: // Do nothing - continue normally
return;
- case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode)
+ case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode)
// TODO find a better way to protect from HLEMixer?
soundStream->GetMixer()->SetHLEReady(false);
m_UploadSetupInProgress = true;
return;
- case 0x0002: // Let IROM play us off
+ case 0x0002: // Let IROM play us off
m_DSPHLE->SetUCode(UCODE_ROM);
return;
- case 0x0000: // Halt
+ case 0x0000: // Halt
WARN_LOG(DSPHLE, "Zelda uCode: received halting operation %04X", _uMail & 0xFFFF);
return;
- default: // Invalid (the real ucode would likely crash)
+ default: // Invalid (the real ucode would likely crash)
WARN_LOG(DSPHLE, "Zelda uCode: received invalid operation %04X", _uMail & 0xFFFF);
return;
}
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.h
index 11227d4..eab6de7 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "UCodes.h"
+#include "Common/Common.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
// Obviously missing things that must be in here, somewhere among the "unknown":
// * Volume
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp
index 2f9d03e..5c28a7f 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "MathUtil.h"
-#include "UCode_Zelda.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed short *out, short *histp, short *hist2p, int type)
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp
index 261ff64..2f90d96 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <math.h>
+#include <cmath>
-#include "UCodes.h"
-#include "UCode_Zelda.h"
-#include "AudioCommon.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/Mixer.h"
-#include "Mixer.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
void CUCode_Zelda::RenderSynth_RectWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
index d013ef6..ccc0298 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
@@ -4,14 +4,14 @@
#include <sstream>
-#include "UCodes.h"
-#include "UCode_Zelda.h"
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/Mixer.h"
+#include "Common/MathUtil.h"
-#include "AudioCommon.h"
-#include "MathUtil.h"
-#include "Mixer.h"
-#include "../../Memmap.h"
-#include "../../DSP.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
void CUCode_Zelda::ReadVoicePB(u32 _Addr, ZeldaVoicePB& PB)
{
@@ -487,9 +487,9 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
}
// XK: Use this to disable MIDI music (GREAT for testing). Also kills some sound FX.
- //if(PB.SoundType == 0x0d00) {
- // PB.NeedsReset = 0;
- // return;
+ //if (PB.SoundType == 0x0d00) {
+ // PB.NeedsReset = 0;
+ // return;
//}
// The Resample calls actually don't resample yet.
@@ -500,18 +500,18 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
// First jump table at ZWW: 2a6
switch (PB.Format)
{
- case 0x0005: // AFC with extra low bitrate (32:5 compression).
- case 0x0009: // AFC with normal bitrate (32:9 compression).
+ case 0x0005: // AFC with extra low bitrate (32:5 compression).
+ case 0x0009: // AFC with normal bitrate (32:9 compression).
RenderVoice_AFC(PB, m_ResampleBuffer + 4, _Size);
Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true);
break;
- case 0x0008: // PCM8 - normal PCM 8-bit audio. Used in Mario Kart DD + very little in Zelda WW.
+ case 0x0008: // PCM8 - normal PCM 8-bit audio. Used in Mario Kart DD + very little in Zelda WW.
RenderVoice_PCM8(PB, m_ResampleBuffer + 4, _Size);
Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true);
break;
- case 0x0010: // PCM16 - normal PCM 16-bit audio.
+ case 0x0010: // PCM16 - normal PCM 16-bit audio.
RenderVoice_PCM16(PB, m_ResampleBuffer + 4, _Size);
Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true);
break;
@@ -535,10 +535,10 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
default:
// Second jump table
// TODO: Cases to find examples of:
- // -0x0002
- // -0x0003
- // -0x0006
- // -0x000a
+ // -0x0002
+ // -0x0003
+ // -0x0006
+ // -0x000a
switch (PB.Format)
{
// Synthesized sounds
@@ -547,8 +547,7 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
RenderSynth_RectWave(PB, m_VoiceBuffer, _Size);
break;
- case 0x0001: // Example: "Denied" sound when trying to pull out a sword
- // indoors in ZWW
+ case 0x0001: // Example: "Denied" sound when trying to pull out a sword indoors in ZWW
RenderSynth_SawWave(PB, m_VoiceBuffer, _Size);
break;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
index c8b847c..82f9e3b 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp
@@ -6,16 +6,16 @@
#include <Windows.h>
#endif
-#include "UCodes.h"
+#include "Common/Hash.h"
-#include "UCode_AX.h"
-#include "UCode_AXWii.h"
-#include "UCode_Zelda.h"
-#include "UCode_ROM.h"
-#include "UCode_CARD.h"
-#include "UCode_InitAudioSystem.h"
-#include "UCode_GBA.h"
-#include "Hash.h"
+#include "Core/HW/DSPHLE/UCodes/UCodes.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AX.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_AXWii.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_CARD.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_GBA.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_ROM.h"
+#include "Core/HW/DSPHLE/UCodes/UCode_Zelda.h"
IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
{
@@ -40,11 +40,11 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door
case 0x3daf59b9: // Alien Hominid
case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball 1/2,cubivore,puzzlecollection,wario,
- // capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
- // smugglers run warzone, smash brothers, sonic mega collection, ZooCube
- // nddemo, starfox
+ // capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
+ // smugglers run warzone, smash brothers, sonic mega collection, ZooCube
+ // nddemo, starfox
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
- // Zelda:OOT, Tony hawk, viewtiful joe
+ // Zelda:OOT, Tony hawk, viewtiful joe
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC);
@@ -116,16 +116,16 @@ void IUCode::PrepareBootUCode(u32 mail)
{
switch (m_NextUCode_steps)
{
- case 0: m_NextUCode.mram_dest_addr = mail; break;
- case 1: m_NextUCode.mram_size = mail & 0xffff; break;
- case 2: m_NextUCode.mram_dram_addr = mail & 0xffff; break;
- case 3: m_NextUCode.iram_mram_addr = mail; break;
- case 4: m_NextUCode.iram_size = mail & 0xffff; break;
- case 5: m_NextUCode.iram_dest = mail & 0xffff; break;
- case 6: m_NextUCode.iram_startpc = mail & 0xffff; break;
- case 7: m_NextUCode.dram_mram_addr = mail; break;
- case 8: m_NextUCode.dram_size = mail & 0xffff; break;
- case 9: m_NextUCode.dram_dest = mail & 0xffff; break;
+ case 0: m_NextUCode.mram_dest_addr = mail; break;
+ case 1: m_NextUCode.mram_size = mail & 0xffff; break;
+ case 2: m_NextUCode.mram_dram_addr = mail & 0xffff; break;
+ case 3: m_NextUCode.iram_mram_addr = mail; break;
+ case 4: m_NextUCode.iram_size = mail & 0xffff; break;
+ case 5: m_NextUCode.iram_dest = mail & 0xffff; break;
+ case 6: m_NextUCode.iram_startpc = mail & 0xffff; break;
+ case 7: m_NextUCode.dram_mram_addr = mail; break;
+ case 8: m_NextUCode.dram_size = mail & 0xffff; break;
+ case 9: m_NextUCode.dram_dest = mail & 0xffff; break;
}
m_NextUCode_steps++;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h
index f1995df..2413c08 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.h
@@ -4,12 +4,12 @@
#pragma once
-#include "Common.h"
-#include "ChunkFile.h"
-#include "Thread.h"
+#include "Common/Common.h"
+#include "Common/ChunkFile.h"
+#include "Common/Thread.h"
-#include "../DSPHLE.h"
-#include "../../Memmap.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
#define UCODE_ROM 0x00000000
#define UCODE_INIT_AUDIO_SYSTEM 0x00000001
@@ -132,8 +132,8 @@ private:
u16 dram_size;
u16 dram_dest;
};
- SUCode m_NextUCode;
- int m_NextUCode_steps;
+ SUCode m_NextUCode;
+ int m_NextUCode_steps;
bool m_NeedsResumeMail;
};
diff --git a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp
index 9343fa7..a6dd80a 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp
@@ -2,13 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPDebugInterface.h"
-
-#include "DSP/DSPCore.h"
-#include "DSP/disassemble.h"
-
-#include "DSPSymbols.h"
-#include "DSP/DSPMemoryMap.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/HW/DSPLLE/DSPDebugInterface.h"
+#include "Core/HW/DSPLLE/DSPSymbols.h"
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
diff --git a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.h b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.h
index 1eca065..608bd3c 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.h
+++ b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.h
@@ -7,8 +7,8 @@
#include <string>
#include <string.h>
-#include "DebugInterface.h"
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/DebugInterface.h"
class DSPDebugInterface : public DebugInterface
{
diff --git a/Source/Core/Core/HW/DSPLLE/DSPHost.cpp b/Source/Core/Core/HW/DSPLLE/DSPHost.cpp
index 5b2dc1f..c29a3e9 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPHost.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPHost.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "Hash.h"
-#include "DSP/DSPAnalyzer.h"
-#include "DSP/DSPCore.h"
-#include "DSP/DSPHost.h"
-#include "DSPSymbols.h"
-#include "DSPLLETools.h"
-#include "../DSP.h"
-#include "../../ConfigManager.h"
-#include "../../PowerPC/PowerPC.h"
-#include "Host.h"
-#include "OnScreenDisplay.h"
+#include "Common/Common.h"
+#include "Common/Hash.h"
+#include "Core/Host.h"
+#include "Core/ConfigManager.h"
+#include "Core/DSP/DSPAnalyzer.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DSPLLE/DSPSymbols.h"
+#include "Core/HW/DSPLLE/DSPLLETools.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "VideoCommon/OnScreenDisplay.h"
// The user of the DSPCore library must supply a few functions so that the
// emulation core can access the environment it runs in. If the emulation
diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp
index af74781..b891bec 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp
@@ -2,38 +2,37 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-
-#include "Common.h"
-#include "CommonPaths.h"
-#include "Atomic.h"
-#include "CommonTypes.h"
-#include "LogManager.h"
-#include "Thread.h"
-#include "ChunkFile.h"
-#include "IniFile.h"
-#include "ConfigManager.h"
-#include "CPUDetect.h"
-#include "Core.h"
-
-#include "DSPLLEGlobals.h" // Local
-#include "DSP/DSPHost.h"
-#include "DSP/DSPInterpreter.h"
-#include "DSP/DSPHWInterface.h"
-#include "DSP/disassemble.h"
-#include "DSPSymbols.h"
-#include "Host.h"
-
-#include "AudioCommon.h"
-#include "Mixer.h"
-
-#include "DSP/DSPTables.h"
-#include "DSP/DSPCore.h"
-#include "DSPLLE.h"
-#include "../Memmap.h"
-#include "../AudioInterface.h"
-
-
-DSPLLE::DSPLLE() {
+#include "AudioCommon/AudioCommon.h"
+#include "AudioCommon/Mixer.h"
+
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/CPUDetect.h"
+#include "Common/IniFile.h"
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPHost.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPHWInterface.h"
+#include "Core/DSP/DSPTables.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/Memmap.h"
+
+#include "Core/HW/DSPLLE/DSPLLE.h"
+#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
+#include "Core/HW/DSPLLE/DSPSymbols.h"
+
+
+DSPLLE::DSPLLE()
+{
soundStream = NULL;
m_InitMixer = false;
m_bIsRunning = false;
diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.h b/Source/Core/Core/HW/DSPLLE/DSPLLE.h
index 7197d8f..adb3326 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPLLE.h
+++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.h
@@ -4,10 +4,11 @@
#pragma once
-#include "Thread.h"
-#include "SoundStream.h"
-#include "DSPLLEGlobals.h" // Local
-#include "../../DSPEmulator.h"
+#include "AudioCommon/SoundStream.h"
+#include "Common/Thread.h"
+
+#include "Core/DSPEmulator.h"
+#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
class DSPLLE : public DSPEmulator
{
diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.cpp
index c879f56..d41db0a 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.cpp
@@ -2,12 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h" // for Common::swap
-#include "FileUtil.h"
-#include "DSP/DSPCore.h"
-#include "DSPLLEGlobals.h"
#include <cinttypes>
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+
+#include "Core/DSP/DSPCore.h"
+#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
+
#if PROFILE
#define PROFILE_MAP_SIZE 0x10000
diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.h b/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.h
index ee845d6..eb903db 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.h
+++ b/Source/Core/Core/HW/DSPLLE/DSPLLEGlobals.h
@@ -4,12 +4,12 @@
#pragma once
-#include "Common.h"
-#include "AudioCommon.h"
+#include "AudioCommon/AudioCommon.h"
+#include "Common/Common.h"
// TODO: Get rid of this file.
-#define PROFILE 0
+#define PROFILE 0
#if PROFILE
void ProfilerDump(u64 _count);
diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLETools.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLETools.cpp
index d0f5083..1d9c0e8 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPLLETools.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPLLETools.cpp
@@ -6,18 +6,18 @@
#include <Windows.h>
#endif
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
-#include "Common.h"
-#include "DSPLLEGlobals.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
-#include "FileUtil.h"
-#include "DSP/DSPCore.h"
-#include "DSP/DSPCodeUtil.h"
-#include "DSPLLETools.h"
-#include "DSP/disassemble.h"
-#include "DSP/DSPInterpreter.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPCodeUtil.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
+#include "Core/HW/DSPLLE/DSPLLETools.h"
bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc)
{
diff --git a/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp b/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp
index 90beaed..0933635 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp
+++ b/Source/Core/Core/HW/DSPLLE/DSPSymbols.cpp
@@ -6,13 +6,13 @@
#include <map>
#include <string>
-#include "Common.h"
-#include "StringUtil.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
-#include "DSP/DSPCore.h"
-#include "DSPSymbols.h"
-#include "DSP/disassemble.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPCore.h"
+#include "Core/HW/DSPLLE/DSPSymbols.h"
namespace DSPSymbols {
diff --git a/Source/Core/Core/HW/DSPLLE/DSPSymbols.h b/Source/Core/Core/HW/DSPLLE/DSPSymbols.h
index 1939731..acf646b 100644
--- a/Source/Core/Core/HW/DSPLLE/DSPSymbols.h
+++ b/Source/Core/Core/HW/DSPLLE/DSPSymbols.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "SymbolDB.h"
+#include "Common/Common.h"
+#include "Common/SymbolDB.h"
namespace DSPSymbols
{
diff --git a/Source/Core/Core/HW/DVDInterface.cpp b/Source/Core/Core/HW/DVDInterface.cpp
index 90e2bbf..b69efec 100644
--- a/Source/Core/Core/HW/DVDInterface.cpp
+++ b/Source/Core/Core/HW/DVDInterface.cpp
@@ -2,21 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h" // Common
-#include "ChunkFile.h"
-#include "../ConfigManager.h"
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-
-#include "StreamADPCM.h" // Core
-#include "DVDInterface.h"
-#include "../PowerPC/PowerPC.h"
-#include "ProcessorInterface.h"
-#include "Thread.h"
-#include "Memmap.h"
-#include "../VolumeHandler.h"
-#include "AudioInterface.h"
-#include "../Movie.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/StreamADPCM.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/PowerPC/PowerPC.h"
// Disc transfer rate measured in bytes per second
static const u32 DISC_TRANSFER_RATE_GC = 5 * 1024 * 1024;
@@ -86,7 +87,7 @@ union UDICVR
u32 Hex;
struct
{
- u32 CVR : 1; // 0: Cover closed 1: Cover open
+ u32 CVR : 1; // 0: Cover closed 1: Cover open
u32 CVRINTMASK : 1; // 1: Interrupt enabled
u32 CVRINT : 1; // r 1: Interrupt requested w 1: Interrupt clear
u32 : 29;
@@ -248,17 +249,17 @@ void TransferComplete(u64 userdata, int cyclesLate)
void Init()
{
- m_DISR.Hex = 0;
- m_DICVR.Hex = 0;
- m_DICMDBUF[0].Hex= 0;
- m_DICMDBUF[1].Hex= 0;
- m_DICMDBUF[2].Hex= 0;
- m_DIMAR.Hex = 0;
- m_DILENGTH.Hex = 0;
- m_DICR.Hex = 0;
- m_DIIMMBUF.Hex = 0;
- m_DICFG.Hex = 0;
- m_DICFG.CONFIG = 1; // Disable bootrom descrambler
+ m_DISR.Hex = 0;
+ m_DICVR.Hex = 0;
+ m_DICMDBUF[0].Hex = 0;
+ m_DICMDBUF[1].Hex = 0;
+ m_DICMDBUF[2].Hex = 0;
+ m_DIMAR.Hex = 0;
+ m_DILENGTH.Hex = 0;
+ m_DICR.Hex = 0;
+ m_DIIMMBUF.Hex = 0;
+ m_DICFG.Hex = 0;
+ m_DICFG.CONFIG = 1; // Disable bootrom descrambler
AudioPos = 0;
LoopStart = 0;
@@ -404,43 +405,17 @@ bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples)
}
}
-void Read32(u32& _uReturnValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- switch (_iAddress & 0xFF)
- {
- case DI_STATUS_REGISTER: _uReturnValue = m_DISR.Hex; break;
- case DI_COVER_REGISTER: _uReturnValue = m_DICVR.Hex; break;
- case DI_COMMAND_0: _uReturnValue = m_DICMDBUF[0].Hex; break;
- case DI_COMMAND_1: _uReturnValue = m_DICMDBUF[1].Hex; break;
- case DI_COMMAND_2: _uReturnValue = m_DICMDBUF[2].Hex; break;
- case DI_DMA_ADDRESS_REGISTER: _uReturnValue = m_DIMAR.Hex; break;
- case DI_DMA_LENGTH_REGISTER: _uReturnValue = m_DILENGTH.Hex; break;
- case DI_DMA_CONTROL_REGISTER: _uReturnValue = m_DICR.Hex; break;
- case DI_IMMEDIATE_DATA_BUFFER: _uReturnValue = m_DIIMMBUF.Hex; break;
- case DI_CONFIG_REGISTER: _uReturnValue = m_DICFG.Hex; break;
-
- default:
- _dbg_assert_(DVDINTERFACE, 0);
- _uReturnValue = 0;
- break;
- }
- DEBUG_LOG(DVDINTERFACE, "(r32): 0x%08x - 0x%08x", _iAddress, _uReturnValue);
-}
+ mmio->Register(base | DI_STATUS_REGISTER,
+ MMIO::DirectRead<u32>(&m_DISR.Hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ UDISR tmpStatusReg(val);
-void Write32(const u32 _iValue, const u32 _iAddress)
-{
- DEBUG_LOG(DVDINTERFACE, "(w32): 0x%08x @ 0x%08x", _iValue, _iAddress);
-
- switch (_iAddress & 0xFF)
- {
- case DI_STATUS_REGISTER:
- {
- UDISR tmpStatusReg(_iValue);
-
- m_DISR.DEINITMASK = tmpStatusReg.DEINITMASK;
- m_DISR.TCINTMASK = tmpStatusReg.TCINTMASK;
- m_DISR.BRKINTMASK = tmpStatusReg.BRKINTMASK;
- m_DISR.BREAK = tmpStatusReg.BREAK;
+ m_DISR.DEINITMASK = tmpStatusReg.DEINITMASK;
+ m_DISR.TCINTMASK = tmpStatusReg.TCINTMASK;
+ m_DISR.BRKINTMASK = tmpStatusReg.BRKINTMASK;
+ m_DISR.BREAK = tmpStatusReg.BREAK;
if (tmpStatusReg.DEINT)
m_DISR.DEINT = 0;
@@ -457,12 +432,13 @@ void Write32(const u32 _iValue, const u32 _iAddress)
}
UpdateInterrupts();
- }
- break;
+ })
+ );
- case DI_COVER_REGISTER:
- {
- UDICVR tmpCoverReg(_iValue);
+ mmio->Register(base | DI_COVER_REGISTER,
+ MMIO::DirectRead<u32>(&m_DICVR.Hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ UDICVR tmpCoverReg(val);
m_DICVR.CVRINTMASK = tmpCoverReg.CVRINTMASK;
@@ -470,26 +446,32 @@ void Write32(const u32 _iValue, const u32 _iAddress)
m_DICVR.CVRINT = 0;
UpdateInterrupts();
- }
- break;
-
- case DI_COMMAND_0: m_DICMDBUF[0].Hex = _iValue; break;
- case DI_COMMAND_1: m_DICMDBUF[1].Hex = _iValue; break;
- case DI_COMMAND_2: m_DICMDBUF[2].Hex = _iValue; break;
-
- case DI_DMA_ADDRESS_REGISTER:
- {
- m_DIMAR.Hex = _iValue & ~0xfc00001f;
- }
- break;
- case DI_DMA_LENGTH_REGISTER:
- {
- m_DILENGTH.Hex = _iValue & ~0x1f;
- }
- break;
- case DI_DMA_CONTROL_REGISTER:
- {
- m_DICR.Hex = _iValue & 7;
+ })
+ );
+
+ // Command registers are very similar and we can register them with a
+ // simple loop.
+ for (int i = 0; i < 3; ++i)
+ mmio->Register(base | (DI_COMMAND_0 + 4 * i),
+ MMIO::DirectRead<u32>(&m_DICMDBUF[i].Hex),
+ MMIO::DirectWrite<u32>(&m_DICMDBUF[i].Hex)
+ );
+
+ // DMA related registers. Mostly direct accesses (+ masking for writes to
+ // handle things like address alignment) and complex write on the DMA
+ // control register that will trigger the DMA.
+ mmio->Register(base | DI_DMA_ADDRESS_REGISTER,
+ MMIO::DirectRead<u32>(&m_DIMAR.Hex),
+ MMIO::DirectWrite<u32>(&m_DIMAR.Hex, ~0xFC00001F)
+ );
+ mmio->Register(base | DI_DMA_LENGTH_REGISTER,
+ MMIO::DirectRead<u32>(&m_DILENGTH.Hex),
+ MMIO::DirectWrite<u32>(&m_DILENGTH.Hex, ~0x1F)
+ );
+ mmio->Register(base | DI_DMA_CONTROL_REGISTER,
+ MMIO::DirectRead<u32>(&m_DICR.Hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ m_DICR.Hex = val & 7;
if (m_DICR.TSTART)
{
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed)
@@ -504,29 +486,27 @@ void Write32(const u32 _iValue, const u32 _iAddress)
ExecuteCommand(m_DICR);
}
}
- }
- break;
-
- case DI_IMMEDIATE_DATA_BUFFER: m_DIIMMBUF.Hex = _iValue; break;
-
- case DI_CONFIG_REGISTER:
- {
- WARN_LOG(DVDINTERFACE, "Write to DICFG, ignored as it's read-only");
- }
- break;
-
- default:
- _dbg_assert_msg_(DVDINTERFACE, 0, "Write to unknown DI address 0x%08x", _iAddress);
- break;
- }
+ })
+ );
+
+ mmio->Register(base | DI_IMMEDIATE_DATA_BUFFER,
+ MMIO::DirectRead<u32>(&m_DIIMMBUF.Hex),
+ MMIO::DirectWrite<u32>(&m_DIIMMBUF.Hex)
+ );
+
+ // DI config register is read only.
+ mmio->Register(base | DI_CONFIG_REGISTER,
+ MMIO::DirectRead<u32>(&m_DICFG.Hex),
+ MMIO::InvalidWrite<u32>()
+ );
}
void UpdateInterrupts()
{
- if ((m_DISR.DEINT & m_DISR.DEINITMASK) ||
- (m_DISR.TCINT & m_DISR.TCINTMASK) ||
- (m_DISR.BRKINT & m_DISR.BRKINTMASK) ||
- (m_DICVR.CVRINT & m_DICVR.CVRINTMASK))
+ if ((m_DISR.DEINT & m_DISR.DEINITMASK) ||
+ (m_DISR.TCINT & m_DISR.TCINTMASK) ||
+ (m_DISR.BRKINT & m_DISR.BRKINTMASK) ||
+ (m_DICVR.CVRINT & m_DICVR.CVRINTMASK))
{
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_DI, true);
}
@@ -543,10 +523,10 @@ void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
{
switch(_DVDInterrupt)
{
- case INT_DEINT: m_DISR.DEINT = 1; break;
- case INT_TCINT: m_DISR.TCINT = 1; break;
- case INT_BRKINT: m_DISR.BRKINT = 1; break;
- case INT_CVRINT: m_DICVR.CVRINT = 1; break;
+ case INT_DEINT: m_DISR.DEINT = 1; break;
+ case INT_TCINT: m_DISR.TCINT = 1; break;
+ case INT_BRKINT: m_DISR.BRKINT = 1; break;
+ case INT_CVRINT: m_DICVR.CVRINT = 1; break;
}
UpdateInterrupts();
@@ -554,7 +534,7 @@ void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
void ExecuteCommand(UDICR& _DICR)
{
-// _dbg_assert_(DVDINTERFACE, _DICR.RW == 0); // only DVD to Memory
+ // _dbg_assert_(DVDINTERFACE, _DICR.RW == 0); // only DVD to Memory
int GCAM = ((SConfig::GetInstance().m_SIDevice[0] == SIDEVICE_AM_BASEBOARD)
&& (SConfig::GetInstance().m_EXIDevice[2] == EXIDEVICE_AM_BASEBOARD))
? 1 : 0;
@@ -845,9 +825,9 @@ void ExecuteCommand(UDICR& _DICR)
break;
// Audio Stream (Immediate)
- // m_DICMDBUF[0].CMDBYTE1 = subcommand
- // m_DICMDBUF[1].Hex << 2 = offset on disc
- // m_DICMDBUF[2].Hex = Length of the stream
+ // m_DICMDBUF[0].CMDBYTE1 = Subcommand
+ // m_DICMDBUF[1].Hex << 2 = Offset on disc
+ // m_DICMDBUF[2].Hex = Length of the stream
case 0xE1:
{
u32 pos = m_DICMDBUF[1].Hex << 2;
diff --git a/Source/Core/Core/HW/DVDInterface.h b/Source/Core/Core/HW/DVDInterface.h
index a51a474..2eaf3b2 100644
--- a/Source/Core/Core/HW/DVDInterface.h
+++ b/Source/Core/Core/HW/DVDInterface.h
@@ -4,8 +4,10 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
+
class PointerWrap;
+namespace MMIO { class Mapping; }
namespace DVDInterface
{
@@ -14,6 +16,8 @@ void Init();
void Shutdown();
void DoState(PointerWrap &p);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
// Disc detection and swapping
void SetDiscInside(bool _DiscInside);
bool IsDiscInside();
@@ -32,12 +36,6 @@ bool DVDRead(u32 _iDVDOffset, u32 _iRamAddress, u32 _iLength);
bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples);
extern bool g_bStream;
-// Read32
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-
-// Write32
-void Write32(const u32 _iValue, const u32 _iAddress);
-
// Not sure about endianness here. I'll just name them like this...
enum DIErrorLow
diff --git a/Source/Core/Core/HW/EXI.cpp b/Source/Core/Core/HW/EXI.cpp
index 4e9c905..b4048c7 100644
--- a/Source/Core/Core/HW/EXI.cpp
+++ b/Source/Core/Core/HW/EXI.cpp
@@ -2,17 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ChunkFile.h"
-#include "../ConfigManager.h"
-#include "../CoreTiming.h"
+#include "Common/Common.h"
+#include "Common/ChunkFile.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/Sram.h"
+#include "Core/PowerPC/PowerPC.h"
-#include "ProcessorInterface.h"
-#include "../PowerPC/PowerPC.h"
-
-#include "EXI.h"
-#include "Sram.h"
-#include "../Movie.h"
SRAM g_SRAM;
namespace ExpansionInterface
@@ -28,15 +29,15 @@ void Init()
g_Channels[i] = new CEXIChannel(i);
if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved())
- g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
+ g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
else if(Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved())
- g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
+ g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
else
- g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
- g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
- g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
- g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
- g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
+ g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
+ g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
+ g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
+ g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
+ g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
}
@@ -62,6 +63,19 @@ void PauseAndLock(bool doLock, bool unpauseOnUnlock)
channel->PauseAndLock(doLock, unpauseOnUnlock);
}
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
+{
+ for (int i = 0; i < MAX_EXI_CHANNELS; ++i)
+ {
+ _dbg_assert_(EXPANSIONINTERFACE, g_Channels[i] != nullptr);
+ // Each channel has 5 32 bit registers assigned to it. We offset the
+ // base that we give to each channel for registration.
+ //
+ // Be careful: this means the base is no longer aligned on a page
+ // boundary and using "base | FOO" is not valid!
+ g_Channels[i]->RegisterMMIO(mmio, base + 5 * 4 * i);
+ }
+}
void ChangeDeviceCallback(u64 userdata, int cyclesLate)
{
@@ -99,38 +113,6 @@ void Update()
g_Channels[2]->Update();
}
-void Read32(u32& _uReturnValue, const u32 _iAddress)
-{
- // TODO 0xfff00000 is mapped to EXI -> mapped to first MB of maskrom
- u32 iAddr = _iAddress & 0x3FF;
- u32 iRegister = (iAddr >> 2) % 5;
- u32 iChannel = (iAddr >> 2) / 5;
-
- _dbg_assert_(EXPANSIONINTERFACE, iChannel < MAX_EXI_CHANNELS);
-
- if (iChannel < MAX_EXI_CHANNELS)
- {
- g_Channels[iChannel]->Read32(_uReturnValue, iRegister);
- }
- else
- {
- _uReturnValue = 0;
- }
-}
-
-void Write32(const u32 _iValue, const u32 _iAddress)
-{
- // TODO 0xfff00000 is mapped to EXI -> mapped to first MB of maskrom
- u32 iAddr = _iAddress & 0x3FF;
- u32 iRegister = (iAddr >> 2) % 5;
- u32 iChannel = (iAddr >> 2) / 5;
-
- _dbg_assert_(EXPANSIONINTERFACE, iChannel < MAX_EXI_CHANNELS);
-
- if (iChannel < MAX_EXI_CHANNELS)
- g_Channels[iChannel]->Write32(_iValue, iRegister);
-}
-
void UpdateInterrupts()
{
// Interrupts are mapped a bit strangely:
diff --git a/Source/Core/Core/HW/EXI.h b/Source/Core/Core/HW/EXI.h
index b60dbda..7e0d2df 100644
--- a/Source/Core/Core/HW/EXI.h
+++ b/Source/Core/Core/HW/EXI.h
@@ -4,10 +4,13 @@
#pragma once
-#include "CommonTypes.h"
-#include "EXI_Channel.h"
-#include "Thread.h"
+#include "Common/CommonTypes.h"
+#include "Common/Thread.h"
+
+#include "Core/HW/EXI_Channel.h"
+
class PointerWrap;
+namespace MMIO { class Mapping; }
enum
{
@@ -22,6 +25,8 @@ void Shutdown();
void DoState(PointerWrap &p);
void PauseAndLock(bool doLock, bool unpauseOnUnlock);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
void Update();
void UpdateInterrupts();
@@ -29,7 +34,4 @@ void ChangeDeviceCallback(u64 userdata, int cyclesLate);
void ChangeDevice(const u8 channel, const TEXIDevices device_type, const u8 device_num);
IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1);
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
-
} // end of namespace ExpansionInterface
diff --git a/Source/Core/Core/HW/EXI_Channel.cpp b/Source/Core/Core/HW/EXI_Channel.cpp
index a57b069..902f50e 100644
--- a/Source/Core/Core/HW/EXI_Channel.cpp
+++ b/Source/Core/Core/HW/EXI_Channel.cpp
@@ -2,19 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "EXI_Channel.h"
-#include "EXI_Device.h"
-#include "EXI.h"
-#include "../ConfigManager.h"
-#include "../Movie.h"
-
-#define EXI_READ 0
-#define EXI_WRITE 1
-#define EXI_READWRITE 2
-
-#include "ProcessorInterface.h"
-#include "../PowerPC/PowerPC.h"
-#include "CoreTiming.h"
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/EXI_Channel.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#define EXI_READ 0
+#define EXI_WRITE 1
+#define EXI_READWRITE 2
CEXIChannel::CEXIChannel(u32 ChannelId) :
m_DMAMemoryAddress(0),
@@ -41,6 +41,117 @@ CEXIChannel::~CEXIChannel()
RemoveDevices();
}
+void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
+{
+ // Warning: the base is not aligned on a page boundary here. We can't use |
+ // to select a register address, instead we need to use +.
+
+ mmio->Register(base + EXI_STATUS,
+ MMIO::ComplexRead<u32>([this](u32) {
+ // check if external device is present
+ // pretty sure it is memcard only, not entirely sure
+ if (m_ChannelId == 2)
+ {
+ m_Status.EXT = 0;
+ }
+ else
+ {
+ m_Status.EXT = GetDevice(1)->IsPresent() ? 1 : 0;
+ }
+
+ return m_Status.Hex;
+ }),
+ MMIO::ComplexWrite<u32>([this](u32, u32 val) {
+ UEXI_STATUS newStatus(val);
+
+ m_Status.EXIINTMASK = newStatus.EXIINTMASK;
+ if (newStatus.EXIINT)
+ m_Status.EXIINT = 0;
+
+ m_Status.TCINTMASK = newStatus.TCINTMASK;
+ if (newStatus.TCINT)
+ m_Status.TCINT = 0;
+
+ m_Status.CLK = newStatus.CLK;
+
+ if (m_ChannelId == 0 || m_ChannelId == 1)
+ {
+ m_Status.EXTINTMASK = newStatus.EXTINTMASK;
+
+ if (newStatus.EXTINT)
+ m_Status.EXTINT = 0;
+ }
+
+ if (m_ChannelId == 0)
+ m_Status.ROMDIS = newStatus.ROMDIS;
+
+ IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT);
+ m_Status.CHIP_SELECT = newStatus.CHIP_SELECT;
+ if (pDevice != NULL)
+ pDevice->SetCS(m_Status.CHIP_SELECT);
+
+ CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
+ })
+ );
+
+ mmio->Register(base + EXI_DMAADDR,
+ MMIO::DirectRead<u32>(&m_DMAMemoryAddress),
+ MMIO::DirectWrite<u32>(&m_DMAMemoryAddress)
+ );
+ mmio->Register(base + EXI_DMALENGTH,
+ MMIO::DirectRead<u32>(&m_DMALength),
+ MMIO::DirectWrite<u32>(&m_DMALength)
+ );
+ mmio->Register(base + EXI_DMACONTROL,
+ MMIO::DirectRead<u32>(&m_Control.Hex),
+ MMIO::ComplexWrite<u32>([this](u32, u32 val) {
+ m_Control.Hex = val;
+
+ if (m_Control.TSTART)
+ {
+ IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT);
+ if (pDevice == NULL)
+ return;
+
+ if (m_Control.DMA == 0)
+ {
+ // immediate data
+ switch (m_Control.RW)
+ {
+ case EXI_READ: m_ImmData = pDevice->ImmRead(m_Control.TLEN + 1); break;
+ case EXI_WRITE: pDevice->ImmWrite(m_ImmData, m_Control.TLEN + 1); break;
+ case EXI_READWRITE: pDevice->ImmReadWrite(m_ImmData, m_Control.TLEN + 1); break;
+ default: _dbg_assert_msg_(EXPANSIONINTERFACE,0,"EXI Imm: Unknown transfer type %i", m_Control.RW);
+ }
+ m_Control.TSTART = 0;
+ }
+ else
+ {
+ // DMA
+ switch (m_Control.RW)
+ {
+ case EXI_READ: pDevice->DMARead (m_DMAMemoryAddress, m_DMALength); break;
+ case EXI_WRITE: pDevice->DMAWrite(m_DMAMemoryAddress, m_DMALength); break;
+ default: _dbg_assert_msg_(EXPANSIONINTERFACE,0,"EXI DMA: Unknown transfer type %i", m_Control.RW);
+ }
+ m_Control.TSTART = 0;
+ }
+
+ if(!m_Control.TSTART) // completed !
+ {
+ m_Status.TCINT = 1;
+ CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
+ }
+ }
+ })
+ );
+
+ mmio->Register(base + EXI_IMMDATA,
+ MMIO::DirectRead<u32>(&m_ImmData),
+ MMIO::DirectWrite<u32>(&m_ImmData)
+ );
+}
+
void CEXIChannel::RemoveDevices()
{
for (auto& device : m_pDevices)
@@ -85,9 +196,9 @@ bool CEXIChannel::IsCausingInterrupt()
if (GetDevice(m_Status.CHIP_SELECT)->IsInterruptSet())
m_Status.EXIINT = 1;
- if ((m_Status.EXIINT & m_Status.EXIINTMASK) ||
- (m_Status.TCINT & m_Status.TCINTMASK) ||
- (m_Status.EXTINT & m_Status.EXTINTMASK))
+ if ((m_Status.EXIINT & m_Status.EXIINTMASK) ||
+ (m_Status.TCINT & m_Status.TCINTMASK) ||
+ (m_Status.EXTINT & m_Status.EXTINTMASK))
{
return true;
}
@@ -115,152 +226,6 @@ void CEXIChannel::Update()
device->Update();
}
-void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
-{
- switch (_iRegister)
- {
- case EXI_STATUS:
- {
- // check if external device is present
- // pretty sure it is memcard only, not entirely sure
- if (m_ChannelId == 2)
- {
- m_Status.EXT = 0;
- }
- else
- {
- m_Status.EXT = GetDevice(1)->IsPresent() ? 1 : 0;
- }
-
- _uReturnValue = m_Status.Hex;
- break;
- }
-
- case EXI_DMAADDR:
- _uReturnValue = m_DMAMemoryAddress;
- break;
-
- case EXI_DMALENGTH:
- _uReturnValue = m_DMALength;
- break;
-
- case EXI_DMACONTROL:
- _uReturnValue = m_Control.Hex;
- break;
-
- case EXI_IMMDATA:
- _uReturnValue = m_ImmData;
- break;
-
- default:
- _dbg_assert_(EXPANSIONINTERFACE, 0);
- _uReturnValue = 0xDEADBEEF;
- }
-
- DEBUG_LOG(EXPANSIONINTERFACE, "(r32) 0x%08x channel: %i register: %s",
- _uReturnValue, m_ChannelId, Debug_GetRegisterName(_iRegister));
-}
-
-void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
-{
- DEBUG_LOG(EXPANSIONINTERFACE, "(w32) 0x%08x channel: %i register: %s",
- _iValue, m_ChannelId, Debug_GetRegisterName(_iRegister));
-
- switch (_iRegister)
- {
- case EXI_STATUS:
- {
- UEXI_STATUS newStatus(_iValue);
-
- m_Status.EXIINTMASK = newStatus.EXIINTMASK;
- if (newStatus.EXIINT)
- m_Status.EXIINT = 0;
-
- m_Status.TCINTMASK = newStatus.TCINTMASK;
- if (newStatus.TCINT)
- m_Status.TCINT = 0;
-
- m_Status.CLK = newStatus.CLK;
-
- if (m_ChannelId == 0 || m_ChannelId == 1)
- {
- m_Status.EXTINTMASK = newStatus.EXTINTMASK;
-
- if (newStatus.EXTINT)
- m_Status.EXTINT = 0;
- }
-
- if (m_ChannelId == 0)
- m_Status.ROMDIS = newStatus.ROMDIS;
-
- IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT);
- m_Status.CHIP_SELECT = newStatus.CHIP_SELECT;
- if (pDevice != NULL)
- pDevice->SetCS(m_Status.CHIP_SELECT);
-
- CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
- }
- break;
-
- case EXI_DMAADDR:
- INFO_LOG(EXPANSIONINTERFACE, "Wrote DMAAddr, channel %i", m_ChannelId);
- m_DMAMemoryAddress = _iValue;
- break;
-
- case EXI_DMALENGTH:
- INFO_LOG(EXPANSIONINTERFACE, "Wrote DMALength, channel %i", m_ChannelId);
- m_DMALength = _iValue;
- break;
-
- case EXI_DMACONTROL:
- INFO_LOG(EXPANSIONINTERFACE, "Wrote DMAControl, channel %i", m_ChannelId);
- m_Control.Hex = _iValue;
-
- if (m_Control.TSTART)
- {
- IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT);
- if (pDevice == NULL)
- return;
-
- if (m_Control.DMA == 0)
- {
- // immediate data
- switch (m_Control.RW)
- {
- case EXI_READ: m_ImmData = pDevice->ImmRead(m_Control.TLEN + 1); break;
- case EXI_WRITE: pDevice->ImmWrite(m_ImmData, m_Control.TLEN + 1); break;
- case EXI_READWRITE: pDevice->ImmReadWrite(m_ImmData, m_Control.TLEN + 1); break;
- default: _dbg_assert_msg_(EXPANSIONINTERFACE,0,"EXI Imm: Unknown transfer type %i", m_Control.RW);
- }
- m_Control.TSTART = 0;
- }
- else
- {
- // DMA
- switch (m_Control.RW)
- {
- case EXI_READ: pDevice->DMARead (m_DMAMemoryAddress, m_DMALength); break;
- case EXI_WRITE: pDevice->DMAWrite(m_DMAMemoryAddress, m_DMALength); break;
- default: _dbg_assert_msg_(EXPANSIONINTERFACE,0,"EXI DMA: Unknown transfer type %i", m_Control.RW);
- }
- m_Control.TSTART = 0;
- }
-
- if(!m_Control.TSTART) // completed !
- {
- m_Status.TCINT = 1;
- CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
- }
- }
- break;
-
- case EXI_IMMDATA:
- INFO_LOG(EXPANSIONINTERFACE, "Wrote IMMData, channel %i", m_ChannelId);
- m_ImmData = _iValue;
- break;
- }
-}
-
void CEXIChannel::DoState(PointerWrap &p)
{
p.DoPOD(m_Status);
diff --git a/Source/Core/Core/HW/EXI_Channel.h b/Source/Core/Core/HW/EXI_Channel.h
index 582ea48..443b920 100644
--- a/Source/Core/Core/HW/EXI_Channel.h
+++ b/Source/Core/Core/HW/EXI_Channel.h
@@ -4,35 +4,25 @@
#pragma once
-#include "CommonTypes.h"
-
-#include "EXI_Device.h"
#include <memory>
+#include "Common/CommonTypes.h"
+#include "Core/HW/EXI_Device.h"
+
+namespace MMIO { class Mapping; }
+
class CEXIChannel
{
private:
enum
{
- EXI_STATUS = 0,
- EXI_DMAADDR = 1,
- EXI_DMALENGTH = 2,
- EXI_DMACONTROL = 3,
- EXI_IMMDATA = 4
+ EXI_STATUS = 0x00,
+ EXI_DMAADDR = 0x04,
+ EXI_DMALENGTH = 0x08,
+ EXI_DMACONTROL = 0x0C,
+ EXI_IMMDATA = 0x10
};
- const char* Debug_GetRegisterName(u32 _register)
- {
- switch (_register)
- {
- case EXI_STATUS: return "STATUS";
- case EXI_DMAADDR: return "DMAADDR";
- case EXI_DMALENGTH: return "DMALENGTH";
- case EXI_DMACONTROL: return "DMACONTROL";
- case EXI_IMMDATA: return "IMMDATA";
- default: return "!!! Unknown EXI Register !!!";
- }
- }
// EXI Status Register - "Channel Parameter Register"
union UEXI_STATUS
@@ -104,15 +94,14 @@ public:
CEXIChannel(u32 ChannelId);
~CEXIChannel();
+ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
void AddDevice(const TEXIDevices device_type, const int device_num);
void AddDevice(IEXIDevice* pDevice, const int device_num, bool notifyPresenceChanged=true);
// Remove all devices
void RemoveDevices();
- void Read32(u32& _uReturnValue, const u32 _iRegister);
- void Write32(const u32 _iValue, const u32 _iRegister);
-
void Update();
bool IsCausingInterrupt();
void DoState(PointerWrap &p);
diff --git a/Source/Core/Core/HW/EXI_Device.cpp b/Source/Core/Core/HW/EXI_Device.cpp
index a1c6e5e..e19ceab 100644
--- a/Source/Core/Core/HW/EXI_Device.cpp
+++ b/Source/Core/Core/HW/EXI_Device.cpp
@@ -2,19 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Memmap.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceIPL.h"
-#include "EXI_DeviceMemoryCard.h"
-#include "EXI_DeviceAD16.h"
-#include "EXI_DeviceMic.h"
-#include "EXI_DeviceEthernet.h"
-#include "EXI_DeviceAMBaseboard.h"
-#include "EXI_DeviceGecko.h"
-
-#include "../Core.h"
-#include "../ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceAD16.h"
+#include "Core/HW/EXI_DeviceAMBaseboard.h"
+#include "Core/HW/EXI_DeviceEthernet.h"
+#include "Core/HW/EXI_DeviceGecko.h"
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/EXI_DeviceMemoryCard.h"
+#include "Core/HW/EXI_DeviceMic.h"
+#include "Core/HW/Memmap.h"
// --- interface IEXIDevice ---
@@ -43,7 +42,7 @@ u32 IEXIDevice::ImmRead(u32 _uSize)
void IEXIDevice::DMAWrite(u32 _uAddr, u32 _uSize)
{
-// _dbg_assert_(EXPANSIONINTERFACE, 0);
+ // _dbg_assert_(EXPANSIONINTERFACE, 0);
while (_uSize--)
{
u8 uByte = Memory::Read_U8(_uAddr++);
@@ -53,7 +52,7 @@ void IEXIDevice::DMAWrite(u32 _uAddr, u32 _uSize)
void IEXIDevice::DMARead(u32 _uAddr, u32 _uSize)
{
-// _dbg_assert_(EXPANSIONINTERFACE, 0);
+ // _dbg_assert_(EXPANSIONINTERFACE, 0);
while (_uSize--)
{
u8 uByte = 0;
@@ -81,10 +80,10 @@ public:
virtual ~CEXIDummy(){}
- void ImmWrite(u32 data, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);}
- u32 ImmRead (u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;}
- void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
- void DMARead (u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);}
+ void ImmWrite(u32 data, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);}
+ u32 ImmRead (u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;}
+ void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
+ void DMARead (u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);}
};
diff --git a/Source/Core/Core/HW/EXI_Device.h b/Source/Core/Core/HW/EXI_Device.h
index f83f45d..69a7761 100644
--- a/Source/Core/Core/HW/EXI_Device.h
+++ b/Source/Core/Core/HW/EXI_Device.h
@@ -4,8 +4,8 @@
#pragma once
-#include "CommonTypes.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/CommonTypes.h"
enum TEXIDevices
{
diff --git a/Source/Core/Core/HW/EXI_DeviceAD16.cpp b/Source/Core/Core/HW/EXI_DeviceAD16.cpp
index e4806b8..6726c31 100644
--- a/Source/Core/Core/HW/EXI_DeviceAD16.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceAD16.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../Core.h"
+#include "Core/Core.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceAD16.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceAD16.h"
CEXIAD16::CEXIAD16() :
m_uPosition(0),
diff --git a/Source/Core/Core/HW/EXI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/EXI_DeviceAMBaseboard.cpp
index 03de830..9975d14 100644
--- a/Source/Core/Core/HW/EXI_DeviceAMBaseboard.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceAMBaseboard.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../Core.h"
+#include "Core/Core.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceAMBaseboard.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceAMBaseboard.h"
CEXIAMBaseboard::CEXIAMBaseboard()
: m_position(0)
diff --git a/Source/Core/Core/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/HW/EXI_DeviceEthernet.cpp
index 5e4b7be..d80f2bb 100644
--- a/Source/Core/Core/HW/EXI_DeviceEthernet.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceEthernet.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Memmap.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceEthernet.h"
-#include "StringUtil.h"
-#include "../ConfigManager.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceEthernet.h"
+#include "Core/HW/Memmap.h"
// XXX: The BBA stores multi-byte elements as little endian.
// Multiple parts of this implementation depend on dolphin
@@ -562,9 +563,9 @@ bool CEXIETHERNET::RecvHandlePacket()
page_ptr(BBA_RHBP));
#endif
- write_ptr = ptr_from_page_ptr(BBA_RWP);
- end_ptr = ptr_from_page_ptr(BBA_RHBP);
- read_ptr = ptr_from_page_ptr(BBA_RRP);
+ write_ptr = ptr_from_page_ptr(BBA_RWP);
+ end_ptr = ptr_from_page_ptr(BBA_RHBP);
+ read_ptr = ptr_from_page_ptr(BBA_RRP);
descriptor = (Descriptor *)write_ptr;
write_ptr += 4;
diff --git a/Source/Core/Core/HW/EXI_DeviceEthernet.h b/Source/Core/Core/HW/EXI_DeviceEthernet.h
index 803e6f0..182f6c2 100644
--- a/Source/Core/Core/HW/EXI_DeviceEthernet.h
+++ b/Source/Core/Core/HW/EXI_DeviceEthernet.h
@@ -8,7 +8,7 @@
#include <Windows.h>
#endif
-#include "Thread.h"
+#include "Common/Thread.h"
// Network Control Register A
enum NCRA
diff --git a/Source/Core/Core/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/HW/EXI_DeviceGecko.cpp
index b8ac071..2938d85 100644
--- a/Source/Core/Core/HW/EXI_DeviceGecko.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceGecko.cpp
@@ -4,16 +4,16 @@
#include <functional>
-#include "EXI_Device.h"
-#include "EXI_DeviceGecko.h"
-#include "../Core.h"
+#include "Core/Core.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceGecko.h"
-u16 GeckoSockServer::server_port;
-int GeckoSockServer::client_count;
-std::thread GeckoSockServer::connectionThread;
-volatile bool GeckoSockServer::server_running;
-std::queue<sf::SocketTCP> GeckoSockServer::waiting_socks;
-std::mutex GeckoSockServer::connection_lock;
+u16 GeckoSockServer::server_port;
+int GeckoSockServer::client_count;
+std::thread GeckoSockServer::connectionThread;
+volatile bool GeckoSockServer::server_running;
+std::queue<sf::SocketTCP> GeckoSockServer::waiting_socks;
+std::mutex GeckoSockServer::connection_lock;
GeckoSockServer::GeckoSockServer()
: client_running(false)
@@ -136,7 +136,7 @@ void GeckoSockServer::ClientThread()
if (client.Send(&packet[0], packet.size()) == sf::Socket::Disconnected)
client_running = false;
}
- } // unlock transfer
+ } // unlock transfer
if (did_nothing)
Common::YieldCPU();
diff --git a/Source/Core/Core/HW/EXI_DeviceGecko.h b/Source/Core/Core/HW/EXI_DeviceGecko.h
index c1d1f7f..4a24c4d 100644
--- a/Source/Core/Core/HW/EXI_DeviceGecko.h
+++ b/Source/Core/Core/HW/EXI_DeviceGecko.h
@@ -4,12 +4,13 @@
#pragma once
-#include "SFML/Network.hpp"
-#include "Thread.h"
-
#include <deque>
#include <queue>
+#include <SFML/Network.hpp>
+
+#include "Common/Thread.h"
+
class GeckoSockServer
: public sf::SocketTCP
{
@@ -28,17 +29,17 @@ public:
std::deque<u8> recv_fifo;
private:
- static int client_count;
- volatile bool client_running;
+ static int client_count;
+ volatile bool client_running;
// Only ever one server thread
static void GeckoConnectionWaiter();
- static u16 server_port;
- static volatile bool server_running;
- static std::thread connectionThread;
- static std::queue<sf::SocketTCP> waiting_socks;
- static std::mutex connection_lock;
+ static u16 server_port;
+ static volatile bool server_running;
+ static std::thread connectionThread;
+ static std::queue<sf::SocketTCP> waiting_socks;
+ static std::mutex connection_lock;
};
class CEXIGecko
@@ -53,13 +54,13 @@ public:
private:
enum
{
- CMD_LED_OFF = 0x7,
- CMD_LED_ON = 0x8,
- CMD_INIT = 0x9,
- CMD_RECV = 0xa,
- CMD_SEND = 0xb,
- CMD_CHK_TX = 0xc,
- CMD_CHK_RX = 0xd,
+ CMD_LED_OFF = 0x7,
+ CMD_LED_ON = 0x8,
+ CMD_INIT = 0x9,
+ CMD_RECV = 0xa,
+ CMD_SEND = 0xb,
+ CMD_CHK_TX = 0xc,
+ CMD_CHK_RX = 0xd,
};
static const u32 ident = 0x04700000;
diff --git a/Source/Core/Core/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI_DeviceIPL.cpp
index 716b049..d0409bd 100644
--- a/Source/Core/Core/HW/EXI_DeviceIPL.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceIPL.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
-#include "Timer.h"
-
-#include "EXI_DeviceIPL.h"
-#include "../Core.h"
-#include "../ConfigManager.h"
-#include "MemoryUtil.h"
-#include "FileUtil.h"
-#include "../Movie.h"
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/MemoryUtil.h"
+#include "Common/Timer.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/SystemTimers.h"
// We should provide an option to choose from the above, or figure out the checksum (the algo in yagcd seems wrong)
// so that people can change default language.
diff --git a/Source/Core/Core/HW/EXI_DeviceIPL.h b/Source/Core/Core/HW/EXI_DeviceIPL.h
index d821967..d127977 100644
--- a/Source/Core/Core/HW/EXI_DeviceIPL.h
+++ b/Source/Core/Core/HW/EXI_DeviceIPL.h
@@ -4,8 +4,8 @@
#pragma once
-#include "EXI_Device.h"
-#include "Sram.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/Sram.h"
class CEXIIPL : public IEXIDevice
{
@@ -31,16 +31,16 @@ private:
enum
{
- REGION_RTC = 0x200000,
- REGION_SRAM = 0x200001,
- REGION_UART = 0x200100,
- REGION_UART_UNK = 0x200103,
- REGION_BARNACLE = 0x200113,
- REGION_WRTC0 = 0x210000,
- REGION_WRTC1 = 0x210001,
- REGION_WRTC2 = 0x210008,
- REGION_EUART_UNK= 0x300000,
- REGION_EUART = 0x300001
+ REGION_RTC = 0x200000,
+ REGION_SRAM = 0x200001,
+ REGION_UART = 0x200100,
+ REGION_UART_UNK = 0x200103,
+ REGION_BARNACLE = 0x200113,
+ REGION_WRTC0 = 0x210000,
+ REGION_WRTC1 = 0x210001,
+ REGION_WRTC2 = 0x210008,
+ REGION_EUART_UNK = 0x300000,
+ REGION_EUART = 0x300001
};
// Region
diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp
index 2d1fb56..1b638b2 100644
--- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp
@@ -2,26 +2,26 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "../Core.h"
-#include "../CoreTiming.h"
-
-#include "../ConfigManager.h"
-#include "../Movie.h"
-#include "EXI.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceMemoryCard.h"
-#include "Sram.h"
-#include "GCMemcard.h"
-
-#define MC_STATUS_BUSY 0x80
-#define MC_STATUS_UNLOCKED 0x40
-#define MC_STATUS_SLEEP 0x20
-#define MC_STATUS_ERASEERROR 0x10
-#define MC_STATUS_PROGRAMEERROR 0x08
-#define MC_STATUS_READY 0x01
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceMemoryCard.h"
+#include "Core/HW/GCMemcard.h"
+#include "Core/HW/Sram.h"
+
+#define MC_STATUS_BUSY 0x80
+#define MC_STATUS_UNLOCKED 0x40
+#define MC_STATUS_SLEEP 0x20
+#define MC_STATUS_ERASEERROR 0x10
+#define MC_STATUS_PROGRAMEERROR 0x08
+#define MC_STATUS_READY 0x01
#define SIZE_TO_Mb (1024 * 8 * 16)
#define MC_HDR_SIZE 0xA000
@@ -63,12 +63,12 @@ CEXIMemoryCard::CEXIMemoryCard(const int index)
formatDelay = 0;
//Nintendo Memory Card EXI IDs
- //0x00000004 Memory Card 59 4Mbit
- //0x00000008 Memory Card 123 8Mb
- //0x00000010 Memory Card 251 16Mb
- //0x00000020 Memory Card 507 32Mb
- //0x00000040 Memory Card 1019 64Mb
- //0x00000080 Memory Card 2043 128Mb
+ //0x00000004 Memory Card 59 4Mbit
+ //0x00000008 Memory Card 123 8Mb
+ //0x00000010 Memory Card 251 16Mb
+ //0x00000020 Memory Card 507 32Mb
+ //0x00000040 Memory Card 1019 64Mb
+ //0x00000080 Memory Card 2043 128Mb
//0x00000510 16Mb "bigben" card
//card_id = 0xc243;
diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.h b/Source/Core/Core/HW/EXI_DeviceMemoryCard.h
index 070c519..47f5ff4 100644
--- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.h
+++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Thread.h"
+#include "Common/Thread.h"
// Data structure to be passed to the flushing thread.
struct FlushData
diff --git a/Source/Core/Core/HW/EXI_DeviceMic.cpp b/Source/Core/Core/HW/EXI_DeviceMic.cpp
index 6ad84cc..4d4268f 100644
--- a/Source/Core/Core/HW/EXI_DeviceMic.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceMic.cpp
@@ -2,20 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
#if HAVE_PORTAUDIO
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-
-#include "EXI_Device.h"
-#include "EXI_DeviceMic.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceMic.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/SystemTimers.h"
#include <portaudio.h>
-#include "GCPad.h"
-
void CEXIMic::StreamLog(const char *msg)
{
DEBUG_LOG(EXPANSIONINTERFACE, "%s: %s",
@@ -179,7 +177,7 @@ void CEXIMic::SetCS(int cs)
void CEXIMic::UpdateNextInterruptTicks()
{
next_int_ticks = CoreTiming::GetTicks() +
- (SystemTimers::GetTicksPerSecond() / sample_rate) * buff_size_samples;
+ (SystemTimers::GetTicksPerSecond() / sample_rate) * buff_size_samples;
}
bool CEXIMic::IsInterruptSet()
@@ -203,8 +201,8 @@ void CEXIMic::TransferByte(u8 &byte)
{
if (m_position == 0)
{
- command = byte; // first byte is command
- byte = 0xFF; // would be tristate, but we don't care.
+ command = byte; // first byte is command
+ byte = 0xFF; // would be tristate, but we don't care.
m_position++;
return;
}
diff --git a/Source/Core/Core/HW/EXI_DeviceMic.h b/Source/Core/Core/HW/EXI_DeviceMic.h
index 3ae9d60..00cda0f 100644
--- a/Source/Core/Core/HW/EXI_DeviceMic.h
+++ b/Source/Core/Core/HW/EXI_DeviceMic.h
@@ -6,7 +6,7 @@
#if HAVE_PORTAUDIO
-#include "StdMutex.h"
+#include "Common/StdMutex.h"
class CEXIMic : public IEXIDevice
{
diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp
index d320f01..99fcd86 100644
--- a/Source/Core/Core/HW/GCMemcard.cpp
+++ b/Source/Core/Core/HW/GCMemcard.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GCMemcard.h"
-#include "ColorUtil.h"
-
#include <cinttypes>
+#include "Common/ColorUtil.h"
+#include "Core/HW/GCMemcard.h"
+
static void ByteSwap(u8 *valueA, u8 *valueB)
{
u8 tmp = *valueA;
@@ -824,7 +824,7 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
gci.ReadBytes(tmp, 0xD);
if (!strcasecmp(fileType.c_str(), ".gcs"))
{
- if (!memcmp(tmp, "GCSAVE", 6)) // Header must be uppercase
+ if (!memcmp(tmp, "GCSAVE", 6)) // Header must be uppercase
offset = GCS;
else
return GCSFAIL;
@@ -988,7 +988,8 @@ void GCMemcard::Gcs_SavConvert(DEntry &tempDEntry, int saveType, int length)
switch(saveType)
{
case GCS:
- { // field containing the Block count as displayed within
+ {
+ // field containing the Block count as displayed within
// the GameSaves software is not stored in the GCS file.
// It is stored only within the corresponding GSV file.
// If the GCS file is added without using the GameSaves software,
@@ -1269,7 +1270,7 @@ void GCMemcard::FormatInternal(GCMC_Header &GCP)
p_hdr->SramBias = g_SRAM.counter_bias;
p_hdr->SramLang = g_SRAM.lang;
// TODO: determine the purpose of Unk2 1 works for slot A, 0 works for both slot A and slot B
- *(u32*)&p_hdr->Unk2 = 0; // = _viReg[55]; static vu16* const _viReg = (u16*)0xCC002000;
+ *(u32*)&p_hdr->Unk2 = 0; // = _viReg[55]; static vu16* const _viReg = (u16*)0xCC002000;
*(u16*)&p_hdr->deviceID = 0;
calc_checksumsBE((u16*)p_hdr, 0xFE, &p_hdr->Checksum, &p_hdr->Checksum_Inv);
diff --git a/Source/Core/Core/HW/GCMemcard.h b/Source/Core/Core/HW/GCMemcard.h
index 08ca5ce..37a601d 100644
--- a/Source/Core/Core/HW/GCMemcard.h
+++ b/Source/Core/Core/HW/GCMemcard.h
@@ -4,11 +4,12 @@
#pragma once
-#include "Common.h"
-#include "CommonPaths.h"
-#include "Sram.h"
-#include "StringUtil.h"
-#include "EXI_DeviceIPL.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/StringUtil.h"
+
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/Sram.h"
#define BE64(x) (Common::swap64(x))
#define BE32(x) (Common::swap32(x))
diff --git a/Source/Core/Core/HW/GCPad.cpp b/Source/Core/Core/HW/GCPad.cpp
index 1ba87e3..4c3b1aa 100644
--- a/Source/Core/Core/HW/GCPad.cpp
+++ b/Source/Core/Core/HW/GCPad.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "GCPadStatus.h"
+#include "Common/Common.h"
-#include "ControllerInterface/ControllerInterface.h"
-#include "GCPadEmu.h"
-#include "../ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/GCPadEmu.h"
+
+#include "InputCommon/GCPadStatus.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
+#include "InputCommon/InputConfig.h"
-#include "../../InputCommon/InputConfig.h"
namespace Pad
{
diff --git a/Source/Core/Core/HW/GCPad.h b/Source/Core/Core/HW/GCPad.h
index e687208..ee03c3c 100644
--- a/Source/Core/Core/HW/GCPad.h
+++ b/Source/Core/Core/HW/GCPad.h
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonTypes.h"
-#include "GCPadStatus.h"
-#include "../InputCommon/InputConfig.h"
+#include "Common/CommonTypes.h"
+#include "InputCommon/GCPadStatus.h"
+#include "InputCommon/InputConfig.h"
#pragma once
diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp
index 4173b23..ad24815 100644
--- a/Source/Core/Core/HW/GCPadEmu.cpp
+++ b/Source/Core/Core/HW/GCPadEmu.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GCPadEmu.h"
-#include "../Host.h"
+#include "Core/Host.h"
+#include "Core/HW/GCPadEmu.h"
const u16 button_bitmasks[] =
{
@@ -13,7 +13,7 @@ const u16 button_bitmasks[] =
PAD_BUTTON_Y,
PAD_TRIGGER_Z,
PAD_BUTTON_START,
- 0 // MIC HAX
+ 0 // MIC HAX
};
const u16 trigger_bitmasks[] =
@@ -138,21 +138,21 @@ void GCPad::SetOutput(const u8 on)
void GCPad::LoadDefaults(const ControllerInterface& ciface)
{
- #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
+ #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
ControllerEmu::LoadDefaults(ciface);
// Buttons
- set_control(m_buttons, 0, "X"); // A
- set_control(m_buttons, 1, "Z"); // B
- set_control(m_buttons, 2, "C"); // X
- set_control(m_buttons, 3, "S"); // Y
- set_control(m_buttons, 4, "D"); // Z
+ set_control(m_buttons, 0, "X"); // A
+ set_control(m_buttons, 1, "Z"); // B
+ set_control(m_buttons, 2, "C"); // X
+ set_control(m_buttons, 3, "S"); // Y
+ set_control(m_buttons, 4, "D"); // Z
#ifdef _WIN32
- set_control(m_buttons, 5, "RETURN"); // Start
+ set_control(m_buttons, 5, "RETURN"); // Start
#else
// osx/linux
- set_control(m_buttons, 5, "Return"); // Start
+ set_control(m_buttons, 5, "Return"); // Start
#endif
// stick modifiers to 50 %
@@ -160,51 +160,51 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
m_c_stick->controls[4]->control_ref->range = 0.5f;
// D-Pad
- set_control(m_dpad, 0, "T"); // Up
- set_control(m_dpad, 1, "G"); // Down
- set_control(m_dpad, 2, "F"); // Left
- set_control(m_dpad, 3, "H"); // Right
+ set_control(m_dpad, 0, "T"); // Up
+ set_control(m_dpad, 1, "G"); // Down
+ set_control(m_dpad, 2, "F"); // Left
+ set_control(m_dpad, 3, "H"); // Right
// C-Stick
- set_control(m_c_stick, 0, "I"); // Up
- set_control(m_c_stick, 1, "K"); // Down
- set_control(m_c_stick, 2, "J"); // Left
- set_control(m_c_stick, 3, "L"); // Right
+ set_control(m_c_stick, 0, "I"); // Up
+ set_control(m_c_stick, 1, "K"); // Down
+ set_control(m_c_stick, 2, "J"); // Left
+ set_control(m_c_stick, 3, "L"); // Right
#ifdef _WIN32
- set_control(m_c_stick, 4, "LCONTROL"); // Modifier
+ set_control(m_c_stick, 4, "LCONTROL"); // Modifier
// Main Stick
- set_control(m_main_stick, 0, "UP"); // Up
- set_control(m_main_stick, 1, "DOWN"); // Down
- set_control(m_main_stick, 2, "LEFT"); // Left
- set_control(m_main_stick, 3, "RIGHT"); // Right
- set_control(m_main_stick, 4, "LSHIFT"); // Modifier
+ set_control(m_main_stick, 0, "UP"); // Up
+ set_control(m_main_stick, 1, "DOWN"); // Down
+ set_control(m_main_stick, 2, "LEFT"); // Left
+ set_control(m_main_stick, 3, "RIGHT"); // Right
+ set_control(m_main_stick, 4, "LSHIFT"); // Modifier
#elif __APPLE__
- set_control(m_c_stick, 4, "Left Control"); // Modifier
+ set_control(m_c_stick, 4, "Left Control"); // Modifier
// Main Stick
- set_control(m_main_stick, 0, "Up Arrow"); // Up
- set_control(m_main_stick, 1, "Down Arrow"); // Down
- set_control(m_main_stick, 2, "Left Arrow"); // Left
- set_control(m_main_stick, 3, "Right Arrow"); // Right
- set_control(m_main_stick, 4, "Left Shift"); // Modifier
+ set_control(m_main_stick, 0, "Up Arrow"); // Up
+ set_control(m_main_stick, 1, "Down Arrow"); // Down
+ set_control(m_main_stick, 2, "Left Arrow"); // Left
+ set_control(m_main_stick, 3, "Right Arrow"); // Right
+ set_control(m_main_stick, 4, "Left Shift"); // Modifier
#else
// not sure if these are right
- set_control(m_c_stick, 4, "Control_L"); // Modifier
+ set_control(m_c_stick, 4, "Control_L"); // Modifier
// Main Stick
- set_control(m_main_stick, 0, "Up"); // Up
- set_control(m_main_stick, 1, "Down"); // Down
- set_control(m_main_stick, 2, "Left"); // Left
- set_control(m_main_stick, 3, "Right"); // Right
- set_control(m_main_stick, 4, "Shift_L"); // Modifier
+ set_control(m_main_stick, 0, "Up"); // Up
+ set_control(m_main_stick, 1, "Down"); // Down
+ set_control(m_main_stick, 2, "Left"); // Left
+ set_control(m_main_stick, 3, "Right"); // Right
+ set_control(m_main_stick, 4, "Shift_L"); // Modifier
#endif
// Triggers
- set_control(m_triggers, 0, "Q"); // L
- set_control(m_triggers, 1, "W"); // R
+ set_control(m_triggers, 0, "Q"); // L
+ set_control(m_triggers, 1, "W"); // R
}
bool GCPad::GetMicButton() const
diff --git a/Source/Core/Core/HW/GCPadEmu.h b/Source/Core/Core/HW/GCPadEmu.h
index c81f73b..150ef15 100644
--- a/Source/Core/Core/HW/GCPadEmu.h
+++ b/Source/Core/Core/HW/GCPadEmu.h
@@ -6,7 +6,7 @@
#include <string>
-#include "ControllerEmu.h"
+#include "InputCommon/ControllerEmu.h"
class GCPad : public ControllerEmu
{
@@ -25,14 +25,14 @@ public:
private:
- Buttons* m_buttons;
- AnalogStick* m_main_stick;
- AnalogStick* m_c_stick;
- Buttons* m_dpad;
- MixedTriggers* m_triggers;
- ControlGroup* m_rumble;
- ControlGroup* m_options;
+ Buttons* m_buttons;
+ AnalogStick* m_main_stick;
+ AnalogStick* m_c_stick;
+ Buttons* m_dpad;
+ MixedTriggers* m_triggers;
+ ControlGroup* m_rumble;
+ ControlGroup* m_options;
- const unsigned int m_index;
+ const unsigned int m_index;
};
diff --git a/Source/Core/Core/HW/GPFifo.cpp b/Source/Core/Core/HW/GPFifo.cpp
index 88371a6..1aafdf3 100644
--- a/Source/Core/Core/HW/GPFifo.cpp
+++ b/Source/Core/Core/HW/GPFifo.cpp
@@ -2,15 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ChunkFile.h"
-#include "ProcessorInterface.h"
-#include "Memmap.h"
-#include "VideoBackendBase.h"
-#include "../PowerPC/JitCommon/JitBase.h"
-#include "../PowerPC/PowerPC.h"
-
-#include "GPFifo.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace GPFifo
{
diff --git a/Source/Core/Core/HW/GPFifo.h b/Source/Core/Core/HW/GPFifo.h
index 3a895a7..6871d95 100644
--- a/Source/Core/Core/HW/GPFifo.h
+++ b/Source/Core/Core/HW/GPFifo.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
class PointerWrap;
namespace GPFifo
diff --git a/Source/Core/Core/HW/HW.cpp b/Source/Core/Core/HW/HW.cpp
index 586344e..acc78f1 100644
--- a/Source/Core/Core/HW/HW.cpp
+++ b/Source/Core/Core/HW/HW.cpp
@@ -2,27 +2,28 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "../Core.h"
-#include "HW.h"
-#include "../PowerPC/PowerPC.h"
-#include "CPU.h"
-#include "DSP.h"
-#include "DVDInterface.h"
-#include "EXI.h"
-#include "GPFifo.h"
-#include "Memmap.h"
-#include "ProcessorInterface.h"
-#include "SI.h"
-#include "AudioInterface.h"
-#include "VideoInterface.h"
-#include "WII_IPC.h"
-#include "../ConfigManager.h"
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-#include "../IPC_HLE/WII_IPC_HLE.h"
-#include "../State.h"
-#include "../PowerPC/PPCAnalyst.h"
+#include "Common/Common.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/State.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/HW.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/HW/WII_IPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
namespace HW
{
@@ -38,11 +39,11 @@ namespace HW
VideoInterface::Init();
SerialInterface::Init();
ProcessorInterface::Init();
+ ExpansionInterface::Init(); // Needs to be initialized before Memory
Memory::Init();
DSP::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE);
DVDInterface::Init();
GPFifo::Init();
- ExpansionInterface::Init();
CCPU::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore);
SystemTimers::Init();
diff --git a/Source/Core/Core/HW/HW.h b/Source/Core/Core/HW/HW.h
index 3ce3bab..684d25c 100644
--- a/Source/Core/Core/HW/HW.h
+++ b/Source/Core/Core/HW/HW.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/ChunkFile.h"
namespace HW
{
diff --git a/Source/Core/Core/HW/MMIO.cpp b/Source/Core/Core/HW/MMIO.cpp
new file mode 100644
index 0000000..2f8788b
--- /dev/null
+++ b/Source/Core/Core/HW/MMIO.cpp
@@ -0,0 +1,383 @@
+// Copyright 2013 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include <functional>
+
+#include "Core/HW/MMIO.h"
+#include "Core/HW/MMIOHandlers.h"
+
+namespace MMIO
+{
+
+// Base classes for the two handling method hierarchies. Note that a single
+// class can inherit from both.
+//
+// At the moment the only common element between all the handling method is
+// that they should be able to accept a visitor of the appropriate type.
+template <typename T>
+class ReadHandlingMethod
+{
+public:
+ virtual ~ReadHandlingMethod() {}
+ virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const = 0;
+};
+template <typename T>
+class WriteHandlingMethod
+{
+public:
+ virtual ~WriteHandlingMethod() {}
+ virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const = 0;
+};
+
+// Constant: handling method holds a single integer and passes it to the
+// visitor. This is a read only handling method: storing to a constant does not
+// mean anything.
+template <typename T>
+class ConstantHandlingMethod : public ReadHandlingMethod<T>
+{
+public:
+ explicit ConstantHandlingMethod(T value) : value_(value)
+ {
+ }
+
+ virtual ~ConstantHandlingMethod() {}
+
+ virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitConstant(value_);
+ }
+
+private:
+ T value_;
+};
+template <typename T>
+ReadHandlingMethod<T>* Constant(T value)
+{
+ return new ConstantHandlingMethod<T>(value);
+}
+
+// Nop: extremely simple write handling method that does nothing at all, only
+// respond to visitors and dispatch to the correct method. This is write only
+// since reads should always at least return a value.
+template <typename T>
+class NopHandlingMethod : public WriteHandlingMethod<T>
+{
+public:
+ NopHandlingMethod() {}
+ virtual ~NopHandlingMethod() {}
+ virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitNop();
+ }
+};
+template <typename T>
+WriteHandlingMethod<T>* Nop()
+{
+ return new NopHandlingMethod<T>();
+}
+
+// Direct: handling method holds a pointer to the value where to read/write the
+// data from, as well as a mask that is used to restrict reading/writing only
+// to a given set of bits.
+template <typename T>
+class DirectHandlingMethod : public ReadHandlingMethod<T>,
+ public WriteHandlingMethod<T>
+{
+public:
+ DirectHandlingMethod(T* addr, u32 mask) : addr_(addr), mask_(mask)
+ {
+ }
+
+ virtual ~DirectHandlingMethod() {}
+
+ virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitDirect(addr_, mask_);
+ }
+
+ virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitDirect(addr_, mask_);
+ }
+
+private:
+ T* addr_;
+ u32 mask_;
+};
+template <typename T>
+ReadHandlingMethod<T>* DirectRead(const T* addr, u32 mask)
+{
+ return new DirectHandlingMethod<T>(const_cast<T*>(addr), mask);
+}
+template <typename T>
+ReadHandlingMethod<T>* DirectRead(volatile const T* addr, u32 mask)
+{
+ return new DirectHandlingMethod<T>((T*)addr, mask);
+}
+template <typename T>
+WriteHandlingMethod<T>* DirectWrite(T* addr, u32 mask)
+{
+ return new DirectHandlingMethod<T>(addr, mask);
+}
+template <typename T>
+WriteHandlingMethod<T>* DirectWrite(volatile T* addr, u32 mask)
+{
+ return new DirectHandlingMethod<T>((T*)addr, mask);
+}
+
+// Complex: holds a lambda that is called when a read or a write is executed.
+// This gives complete control to the user as to what is going to happen during
+// that read or write, but reduces the optimization potential.
+template <typename T>
+class ComplexHandlingMethod : public ReadHandlingMethod<T>,
+ public WriteHandlingMethod<T>
+{
+public:
+ explicit ComplexHandlingMethod(std::function<T(u32)> read_lambda)
+ : read_lambda_(read_lambda), write_lambda_(InvalidWriteLambda())
+ {
+ }
+
+ explicit ComplexHandlingMethod(std::function<void(u32, T)> write_lambda)
+ : read_lambda_(InvalidReadLambda()), write_lambda_(write_lambda)
+ {
+ }
+
+ virtual ~ComplexHandlingMethod() {}
+
+ virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitComplex(read_lambda_);
+ }
+
+ virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const
+ {
+ v.VisitComplex(write_lambda_);
+ }
+
+private:
+ std::function<T(u32)> InvalidReadLambda() const
+ {
+ return [](u32) {
+ _dbg_assert_msg_(MEMMAP, 0, "Called the read lambda on a write "
+ "complex handler.");
+ return 0;
+ };
+ }
+
+ std::function<void(u32, T)> InvalidWriteLambda() const
+ {
+ return [](u32, T) {
+ _dbg_assert_msg_(MEMMAP, 0, "Called the write lambda on a read "
+ "complex handler.");
+ };
+ }
+
+ std::function<T(u32)> read_lambda_;
+ std::function<void(u32, T)> write_lambda_;
+};
+template <typename T>
+ReadHandlingMethod<T>* ComplexRead(std::function<T(u32)> lambda)
+{
+ return new ComplexHandlingMethod<T>(lambda);
+}
+template <typename T>
+WriteHandlingMethod<T>* ComplexWrite(std::function<void(u32, T)> lambda)
+{
+ return new ComplexHandlingMethod<T>(lambda);
+}
+
+// Invalid: specialization of the complex handling type with lambdas that
+// display error messages.
+template <typename T>
+ReadHandlingMethod<T>* InvalidRead()
+{
+ return ComplexRead<T>([](u32 addr) {
+ ERROR_LOG(MEMMAP, "Trying to read from an invalid MMIO (addr=%08x)",
+ addr);
+ return -1;
+ });
+}
+template <typename T>
+WriteHandlingMethod<T>* InvalidWrite()
+{
+ return ComplexWrite<T>([](u32 addr, T val) {
+ ERROR_LOG(MEMMAP, "Trying to write to an invalid MMIO (addr=%08x, val=%08x)",
+ addr, (u32)val);
+ });
+}
+
+// Converters to larger and smaller size. Probably the most complex of these
+// handlers to implement. They do not define new handling method types but
+// instead will internally use the types defined above.
+template <typename T> struct SmallerAccessSize {};
+template <> struct SmallerAccessSize<u16> { typedef u8 value; };
+template <> struct SmallerAccessSize<u32> { typedef u16 value; };
+
+template <typename T> struct LargerAccessSize {};
+template <> struct LargerAccessSize<u8> { typedef u16 value; };
+template <> struct LargerAccessSize<u16> { typedef u32 value; };
+
+template <typename T>
+ReadHandlingMethod<T>* ReadToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr)
+{
+ typedef typename SmallerAccessSize<T>::value ST;
+
+ const ReadHandler<ST>* high_part;
+ const ReadHandler<ST>* low_part;
+ mmio->GetHandlerForRead(high_part_addr, &high_part);
+ mmio->GetHandlerForRead(low_part_addr, &low_part);
+
+ // TODO(delroth): optimize
+ return ComplexRead<T>([high_part, low_part](u32 addr) {
+ return ((T)high_part->Read(addr) << (8 * sizeof (ST))) | low_part->Read(addr);
+ });
+}
+
+template <typename T>
+WriteHandlingMethod<T>* WriteToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr)
+{
+ typedef typename SmallerAccessSize<T>::value ST;
+
+ const WriteHandler<ST>* high_part;
+ const WriteHandler<ST>* low_part;
+ mmio->GetHandlerForWrite(high_part_addr, &high_part);
+ mmio->GetHandlerForWrite(low_part_addr, &low_part);
+
+ // TODO(delroth): optimize
+ return ComplexWrite<T>([high_part, low_part](u32 addr, T val) {
+ high_part->Write(addr, val >> (8 * sizeof (ST)));
+ low_part->Write(addr, (ST)val);
+ });
+}
+
+template <typename T>
+ReadHandlingMethod<T>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift)
+{
+ typedef typename LargerAccessSize<T>::value LT;
+
+ const ReadHandler<LT>* large;
+ mmio->GetHandlerForRead(larger_addr, &large);
+
+ // TODO(delroth): optimize
+ return ComplexRead<T>([large, shift](u32 addr) {
+ return large->Read(addr & ~(sizeof (LT) - 1)) >> shift;
+ });
+}
+
+// Inplementation of the ReadHandler and WriteHandler class. There is a lot of
+// redundant code between these two classes but trying to abstract it away
+// brings more trouble than it fixes.
+template <typename T>
+ReadHandler<T>::ReadHandler() : m_Method(nullptr)
+{
+ ResetMethod(InvalidRead<T>());
+}
+
+template <typename T>
+ReadHandler<T>::ReadHandler(ReadHandlingMethod<T>* method)
+ : m_Method(nullptr)
+{
+ ResetMethod(method);
+}
+
+template <typename T>
+ReadHandler<T>::~ReadHandler()
+{
+}
+
+template <typename T>
+void ReadHandler<T>::Visit(ReadHandlingMethodVisitor<T>& visitor) const
+{
+ m_Method->AcceptReadVisitor(visitor);
+}
+
+template <typename T>
+void ReadHandler<T>::ResetMethod(ReadHandlingMethod<T>* method)
+{
+ m_Method.reset(method);
+
+ struct FuncCreatorVisitor : public ReadHandlingMethodVisitor<T>
+ {
+ std::function<T(u32)> ret;
+
+ virtual void VisitConstant(T value)
+ {
+ ret = [value](u32) { return value; };
+ }
+
+ virtual void VisitDirect(const T* addr, u32 mask)
+ {
+ ret = [addr, mask](u32) { return *addr & mask; };
+ }
+
+ virtual void VisitComplex(std::function<T(u32)> lambda)
+ {
+ ret = lambda;
+ }
+ };
+
+ FuncCreatorVisitor v;
+ Visit(v);
+ m_ReadFunc = v.ret;
+}
+
+template <typename T>
+WriteHandler<T>::WriteHandler() : m_Method(nullptr)
+{
+ ResetMethod(InvalidWrite<T>());
+}
+
+template <typename T>
+WriteHandler<T>::WriteHandler(WriteHandlingMethod<T>* method)
+ : m_Method(nullptr)
+{
+ ResetMethod(method);
+}
+
+template <typename T>
+WriteHandler<T>::~WriteHandler()
+{
+}
+
+template <typename T>
+void WriteHandler<T>::Visit(WriteHandlingMethodVisitor<T>& visitor) const
+{
+ m_Method->AcceptWriteVisitor(visitor);
+}
+
+template <typename T>
+void WriteHandler<T>::ResetMethod(WriteHandlingMethod<T>* method)
+{
+ m_Method.reset(method);
+
+ struct FuncCreatorVisitor : public WriteHandlingMethodVisitor<T>
+ {
+ std::function<void(u32, T)> ret;
+
+ virtual void VisitNop()
+ {
+ ret = [](u32, T) {};
+ }
+
+ virtual void VisitDirect(T* ptr, u32 mask)
+ {
+ ret = [ptr, mask](u32, T val) { *ptr = val & mask; };
+ }
+
+ virtual void VisitComplex(std::function<void(u32, T)> lambda)
+ {
+ ret = lambda;
+ }
+ };
+
+ FuncCreatorVisitor v;
+ Visit(v);
+ m_WriteFunc = v.ret;
+}
+
+// Define all the public specializations that are exported in MMIOHandlers.h.
+MMIO_PUBLIC_SPECIALIZATIONS();
+
+}
diff --git a/Source/Core/Core/HW/MMIO.h b/Source/Core/Core/HW/MMIO.h
new file mode 100644
index 0000000..541d75b
--- /dev/null
+++ b/Source/Core/Core/HW/MMIO.h
@@ -0,0 +1,156 @@
+// Copyright 2013 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <string>
+#include <type_traits>
+
+#include "Common/Common.h"
+#include "Core/HW/MMIOHandlers.h"
+
+namespace MMIO
+{
+
+// There are three main MMIO blocks on the Wii (only one on the GameCube):
+// - 0xCC00xxxx: GameCube MMIOs (CP, PE, VI, PI, MI, DSP, DVD, SI, EI, AI, GP)
+// - 0xCD00xxxx: Wii MMIOs and GC mirrors (IPC, DVD, SI, EI, AI)
+// - 0xCD80xxxx: Mirror of 0xCD00xxxx.
+//
+// In practice, since the third block is a mirror of the second one, we can
+// assume internally that there are only two blocks: one for GC, one for Wii.
+enum Block
+{
+ GC_BLOCK = 0,
+ WII_BLOCK = 1,
+
+ NUM_BLOCKS
+};
+const u32 BLOCK_SIZE = 0x10000;
+const u32 NUM_MMIOS = NUM_BLOCKS * BLOCK_SIZE;
+
+// Compute the internal unique ID for a given MMIO address. This ID is computed
+// from a very simple formula: (1 + block_id) * lower_16_bits(address).
+//
+// The block ID can easily be computed by simply checking bit 24 (CC vs. CD).
+inline u32 UniqueID(u32 address)
+{
+ _dbg_assert_msg_(MEMMAP, ((address & 0xFFFF0000) == 0xCC000000) ||
+ ((address & 0xFFFF0000) == 0xCD000000) ||
+ ((address & 0xFFFF0000) == 0xCD800000),
+ "Trying to get the ID of a non-existing MMIO address.");
+
+ return (1 + ((address >> 24) & 1)) * (address & 0xFFFF);
+}
+
+// Some utilities functions to define MMIO mappings.
+namespace Utils
+{
+// Allow grabbing pointers to the high and low part of a 32 bits pointer.
+inline u16* LowPart(u32* ptr) { return (u16*)ptr; }
+inline u16* LowPart(volatile u32* ptr) { return (u16*)ptr; }
+inline u16* HighPart(u32* ptr) { return LowPart(ptr) + 1; }
+inline u16* HighPart(volatile u32* ptr) { return LowPart(ptr) + 1; }
+}
+
+class Mapping
+{
+public:
+ // MMIO registration interface. Use this to register new MMIO handlers.
+ //
+ // Example usages can be found in just about any HW/ module in Dolphin's
+ // codebase.
+#define REGISTER_FUNCS(Size) \
+ void RegisterRead(u32 addr, ReadHandlingMethod<u##Size>* read) \
+ { \
+ u32 id = UniqueID(addr) / sizeof (u##Size); \
+ m_Read##Size##Handlers[id].ResetMethod(read); \
+ } \
+ void RegisterWrite(u32 addr, WriteHandlingMethod<u##Size>* write) \
+ { \
+ u32 id = UniqueID(addr) / sizeof (u##Size); \
+ m_Write##Size##Handlers[id].ResetMethod(write); \
+ } \
+ void Register(u32 addr, ReadHandlingMethod<u##Size>* read, \
+ WriteHandlingMethod<u##Size>* write) \
+ { \
+ RegisterRead(addr, read); \
+ RegisterWrite(addr, write); \
+ }
+ REGISTER_FUNCS(8) REGISTER_FUNCS(16) REGISTER_FUNCS(32)
+#undef REGISTER_FUNCS
+
+ // Direct read/write interface.
+ //
+ // These functions allow reading/writing an MMIO register at a given
+ // address. They are used by the Memory:: access functions, which are
+ // called in interpreter mode, from Dolphin's own code, or from JIT'd code
+ // where the access address could not be predicted.
+ //
+ // Note that for reads we cannot simply return the read value because C++
+ // allows overloading only with parameter types, not return types.
+#define READ_FUNC(Size) \
+ void Read(u32 addr, u##Size* val) const \
+ { \
+ u32 id = UniqueID(addr) / sizeof (u##Size); \
+ *val = m_Read##Size##Handlers[id].Read(addr); \
+ }
+ READ_FUNC(8) READ_FUNC(16) READ_FUNC(32)
+#undef READ_FUNC
+
+#define WRITE_FUNC(Size) \
+ void Write(u32 addr, u##Size val) const \
+ { \
+ u32 id = UniqueID(addr) / sizeof (u##Size); \
+ m_Write##Size##Handlers[id].Write(addr, val); \
+ }
+ WRITE_FUNC(8) WRITE_FUNC(16) WRITE_FUNC(32)
+#undef WRITE_FUNC
+
+ // Handlers access interface.
+ //
+ // Use when you care more about how to access the MMIO register for an
+ // address than the current value of that register. For example, this is
+ // what could be used to implement fast MMIO accesses in Dolphin's JIT.
+ //
+ // Two variants of each GetHandler function are provided: one that returns
+ // the handler directly and one that has a pointer parameter to return the
+ // value. This second variant is needed because C++ doesn't do overloads
+ // based on return type but only based on argument types.
+#define GET_HANDLERS_FUNC(Type, Size) \
+ const Type##Handler<u##Size>& GetHandlerFor##Type##Size(u32 addr) const \
+ { \
+ return m_##Type##Size##Handlers[UniqueID(addr) / sizeof (u##Size)]; \
+ } \
+ void GetHandlerFor##Type(u32 addr, const Type##Handler<u##Size>** h) const \
+ { \
+ *h = &GetHandlerFor##Type##Size(addr); \
+ }
+ GET_HANDLERS_FUNC(Read, 8) GET_HANDLERS_FUNC(Read, 16) GET_HANDLERS_FUNC(Read, 32)
+ GET_HANDLERS_FUNC(Write, 8) GET_HANDLERS_FUNC(Write, 16) GET_HANDLERS_FUNC(Write, 32)
+#undef GET_HANDLERS_FUNC
+
+ // Dummy 64 bits variants of these functions. While 64 bits MMIO access is
+ // not supported, we need these in order to make the code compile.
+ void Read(u32 addr, u64* val) const { _dbg_assert_(MEMMAP, 0); }
+ void Write(u32 addr, u64 val) const { _dbg_assert_(MEMMAP, 0); }
+
+private:
+ // These arrays contain the handlers for each MMIO access type: read/write
+ // to 8/16/32 bits. They are indexed using the UniqueID(addr) function
+ // defined earlier, which maps an MMIO address to a unique ID by using the
+ // MMIO block ID.
+ //
+ // Each array contains NUM_MMIOS / sizeof (AccessType) because larger
+ // access types mean less possible adresses (assuming aligned only
+ // accesses).
+#define HANDLERS(Size) \
+ std::array<ReadHandler<u##Size>, NUM_MMIOS / sizeof (u##Size)> m_Read##Size##Handlers; \
+ std::array<WriteHandler<u##Size>, NUM_MMIOS / sizeof (u##Size)> m_Write##Size##Handlers;
+ HANDLERS(8) HANDLERS(16) HANDLERS(32)
+#undef HANDLERS
+};
+
+}
diff --git a/Source/Core/Core/HW/MMIOHandlers.h b/Source/Core/Core/HW/MMIOHandlers.h
new file mode 100644
index 0000000..b0f41a4
--- /dev/null
+++ b/Source/Core/Core/HW/MMIOHandlers.h
@@ -0,0 +1,201 @@
+// Copyright 2013 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <functional>
+#include <memory>
+
+#include "Common/Common.h"
+
+// All the templated and very repetitive MMIO-related code is isolated in this
+// file for easier reading. It mostly contains code related to handling methods
+// (including the declaration of the public functions for creating handling
+// method objects), visitors for these handling methods, and interface of the
+// handler classes.
+//
+// This code is very genericized (aka. lots of templates) in order to handle
+// u8/u16/u32 with the same code while providing type safety: it is impossible
+// to mix code from these types, and the type system enforces it.
+
+namespace MMIO
+{
+
+class Mapping;
+
+// Read and write handling methods are separated for type safety. On top of
+// that, some handling methods require different arguments for reads and writes
+// (Complex, for example).
+template <typename T> class ReadHandlingMethod;
+template <typename T> class WriteHandlingMethod;
+
+// Constant: use when the value read on this MMIO is always the same. This is
+// only for reads.
+template <typename T> ReadHandlingMethod<T>* Constant(T value);
+
+// Nop: use for writes that shouldn't have any effect and shouldn't log an
+// error either.
+template <typename T> WriteHandlingMethod<T>* Nop();
+
+// Direct: use when all the MMIO does is read/write the given value to/from a
+// global variable, with an optional mask applied on the read/written value.
+template <typename T> ReadHandlingMethod<T>* DirectRead(const T* addr, u32 mask = 0xFFFFFFFF);
+template <typename T> ReadHandlingMethod<T>* DirectRead(volatile const T* addr, u32 mask = 0xFFFFFFFF);
+template <typename T> WriteHandlingMethod<T>* DirectWrite(T* addr, u32 mask = 0xFFFFFFFF);
+template <typename T> WriteHandlingMethod<T>* DirectWrite(volatile T* addr, u32 mask = 0xFFFFFFFF);
+
+// Complex: use when no other handling method fits your needs. These allow you
+// to directly provide a function that will be called when a read/write needs
+// to be done.
+template <typename T> ReadHandlingMethod<T>* ComplexRead(std::function<T(u32)>);
+template <typename T> WriteHandlingMethod<T>* ComplexWrite(std::function<void(u32, T)>);
+
+// Invalid: log an error and return -1 in case of a read. These are the default
+// handlers set for all MMIO types.
+template <typename T> ReadHandlingMethod<T>* InvalidRead();
+template <typename T> WriteHandlingMethod<T>* InvalidWrite();
+
+// {Read,Write}To{Smaller,Larger}: these functions are not themselves handling
+// methods but will try to combine accesses to two handlers into one new
+// handler object.
+//
+// This is used for example when 32 bit reads have the exact same handling as
+// 16 bit. Handlers need to be registered for both 32 and 16, and it would be
+// repetitive and unoptimal to require users to write the same handling code in
+// both cases. Instead, an MMIO module can simply define all handlers in terms
+// of 16 bit reads, then use ReadToSmaller<u32> to convert u32 reads to u16
+// reads.
+//
+// Internally, these size conversion functions have some magic to make the
+// combined handlers as fast as possible. For example, if the two underlying
+// u16 handlers for a u32 reads are Direct to consecutive memory addresses,
+// they can be transformed into a Direct u32 access.
+//
+// Warning: unlike the other handling methods, *ToSmaller are obviously not
+// available for u8, and *ToLarger are not available for u32.
+template <typename T> ReadHandlingMethod<T>* ReadToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr);
+template <typename T> WriteHandlingMethod<T>* WriteToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr);
+template <typename T> ReadHandlingMethod<T>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift);
+
+// Use these visitors interfaces if you need to write code that performs
+// different actions based on the handling method used by a handler. Write your
+// visitor implementing that interface, then use handler->VisitHandlingMethod
+// to run the proper function.
+template <typename T>
+class ReadHandlingMethodVisitor
+{
+public:
+ virtual void VisitConstant(T value) = 0;
+ virtual void VisitDirect(const T* addr, u32 mask) = 0;
+ virtual void VisitComplex(std::function<T(u32)> lambda) = 0;
+};
+template <typename T>
+class WriteHandlingMethodVisitor
+{
+public:
+ virtual void VisitNop() = 0;
+ virtual void VisitDirect(T* addr, u32 mask) = 0;
+ virtual void VisitComplex(std::function<void(u32, T)> lambda) = 0;
+};
+
+// These classes are INTERNAL. Do not use outside of the MMIO implementation
+// code. Unfortunately, because we want to make Read() and Write() fast and
+// inlinable, we need to provide some of the implementation of these two
+// classes here and can't just use a forward declaration.
+template <typename T>
+class ReadHandler : public NonCopyable
+{
+public:
+ ReadHandler();
+
+ // Takes ownership of "method".
+ ReadHandler(ReadHandlingMethod<T>* method);
+
+ ~ReadHandler();
+
+ // Entry point for read handling method visitors.
+ void Visit(ReadHandlingMethodVisitor<T>& visitor) const;
+
+ T Read(u32 addr) const
+ {
+ return m_ReadFunc(addr);
+ }
+
+ // Internal method called when changing the internal method object. Its
+ // main role is to make sure the read function is updated at the same time.
+ void ResetMethod(ReadHandlingMethod<T>* method);
+
+private:
+ std::unique_ptr<ReadHandlingMethod<T>> m_Method;
+ std::function<T(u32)> m_ReadFunc;
+};
+template <typename T>
+class WriteHandler : public NonCopyable
+{
+public:
+ WriteHandler();
+
+ // Takes ownership of "method".
+ WriteHandler(WriteHandlingMethod<T>* method);
+
+ ~WriteHandler();
+
+ // Entry point for write handling method visitors.
+ void Visit(WriteHandlingMethodVisitor<T>& visitor) const;
+
+ void Write(u32 addr, T val) const
+ {
+ m_WriteFunc(addr, val);
+ }
+
+ // Internal method called when changing the internal method object. Its
+ // main role is to make sure the write function is updated at the same
+ // time.
+ void ResetMethod(WriteHandlingMethod<T>* method);
+
+private:
+ std::unique_ptr<WriteHandlingMethod<T>> m_Method;
+ std::function<void(u32, T)> m_WriteFunc;
+};
+
+// Boilerplate boilerplate boilerplate.
+//
+// This is used to be able to avoid putting the templates implementation in the
+// header files and slow down compilation times. Instead, we declare 3
+// specializations in the header file as already implemented in another
+// compilation unit: u8, u16, u32.
+//
+// The "MaybeExtern" is there because that same macro is used for declaration
+// (where MaybeExtern = "extern") and definition (MaybeExtern = "").
+#define MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, T) \
+ MaybeExtern template ReadHandlingMethod<T>* Constant<T>(T value); \
+ MaybeExtern template WriteHandlingMethod<T>* Nop<T>(); \
+ MaybeExtern template ReadHandlingMethod<T>* DirectRead(const T* addr, u32 mask); \
+ MaybeExtern template ReadHandlingMethod<T>* DirectRead(volatile const T* addr, u32 mask); \
+ MaybeExtern template WriteHandlingMethod<T>* DirectWrite(T* addr, u32 mask); \
+ MaybeExtern template WriteHandlingMethod<T>* DirectWrite(volatile T* addr, u32 mask); \
+ MaybeExtern template ReadHandlingMethod<T>* ComplexRead<T>(std::function<T(u32)>); \
+ MaybeExtern template WriteHandlingMethod<T>* ComplexWrite<T>(std::function<void(u32, T)>); \
+ MaybeExtern template ReadHandlingMethod<T>* InvalidRead<T>(); \
+ MaybeExtern template WriteHandlingMethod<T>* InvalidWrite<T>(); \
+ MaybeExtern template class ReadHandler<T>; \
+ MaybeExtern template class WriteHandler<T>
+
+#define MMIO_SPECIAL_PUBLIC_SPECIALIZATIONS(MaybeExtern) \
+ MaybeExtern template ReadHandlingMethod<u16>* ReadToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr); \
+ MaybeExtern template ReadHandlingMethod<u32>* ReadToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr); \
+ MaybeExtern template WriteHandlingMethod<u16>* WriteToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr); \
+ MaybeExtern template WriteHandlingMethod<u32>* WriteToSmaller(Mapping* mmio, u32 high_part_addr, u32 low_part_addr); \
+ MaybeExtern template ReadHandlingMethod<u8>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift); \
+ MaybeExtern template ReadHandlingMethod<u16>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift)
+
+#define MMIO_PUBLIC_SPECIALIZATIONS(MaybeExtern) \
+ MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u8); \
+ MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u16); \
+ MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u32); \
+ MMIO_SPECIAL_PUBLIC_SPECIALIZATIONS(MaybeExtern);
+
+MMIO_PUBLIC_SPECIALIZATIONS(extern)
+
+}
diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp
index 82f3141..fa56961 100644
--- a/Source/Core/Core/HW/Memmap.cpp
+++ b/Source/Core/Core/HW/Memmap.cpp
@@ -8,32 +8,32 @@
// However, if a JITed instruction (for example lwz) wants to access a bad memory area that call
// may be redirected here (for example to Read_U32()).
-
-#include "Common.h"
-#include "MemoryUtil.h"
-#include "MemArena.h"
-#include "ChunkFile.h"
-
-#include "Memmap.h"
-#include "../Core.h"
-#include "../PowerPC/PowerPC.h"
-#include "../PowerPC/JitCommon/JitBase.h"
-#include "../HLE/HLE.h"
-#include "CPU.h"
-#include "ProcessorInterface.h"
-#include "DSP.h"
-#include "DVDInterface.h"
-#include "GPFifo.h"
-#include "VideoInterface.h"
-#include "SI.h"
-#include "EXI.h"
-#include "AudioInterface.h"
-#include "MemoryInterface.h"
-#include "WII_IOB.h"
-#include "WII_IPC.h"
-#include "../ConfigManager.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-#include "VideoBackendBase.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/MemArena.h"
+#include "Common/MemoryUtil.h"
+
+#include "Core/Core.h"
+#include "Core/ConfigManager.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/MemoryInterface.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/WII_IPC.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace Memory
{
@@ -53,7 +53,7 @@ bool bMMU = false;
// Init() declarations
// ----------------
// Store the MemArena here
-u8* base = NULL;
+u8* base = NULL;
// The MemArena class
MemArena g_arena;
@@ -83,230 +83,32 @@ u8 *m_pVirtualUncachedEXRAM; // wii only
u8 *m_pVirtualL1Cache;
u8 *m_pVirtualFakeVMEM;
-// =================================
-// Read and write shortcuts
-// ----------------
-writeFn8 hwWrite8 [NUMHWMEMFUN];
-writeFn16 hwWrite16[NUMHWMEMFUN];
-writeFn32 hwWrite32[NUMHWMEMFUN];
-writeFn64 hwWrite64[NUMHWMEMFUN];
-
-readFn8 hwRead8 [NUMHWMEMFUN];
-readFn16 hwRead16[NUMHWMEMFUN];
-readFn32 hwRead32[NUMHWMEMFUN];
-readFn64 hwRead64[NUMHWMEMFUN];
-
-writeFn8 hwWriteWii8 [NUMHWMEMFUN];
-writeFn16 hwWriteWii16[NUMHWMEMFUN];
-writeFn32 hwWriteWii32[NUMHWMEMFUN];
-writeFn64 hwWriteWii64[NUMHWMEMFUN];
-
-readFn8 hwReadWii8 [NUMHWMEMFUN];
-readFn16 hwReadWii16[NUMHWMEMFUN];
-readFn32 hwReadWii32[NUMHWMEMFUN];
-readFn64 hwReadWii64[NUMHWMEMFUN];
-
-// Default read and write functions
-template <class T>
-void HW_Default_Write(const T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Write%lu %08x", (unsigned long)sizeof(T)*8, _Address);_dbg_assert_(MEMMAP, 0);}
-
-template <class T>
-void HW_Default_Read(T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Read%lu %08x", (unsigned long)sizeof(T)*8, _Address); _dbg_assert_(MEMMAP, 0);}
-
-#define HW_PAGE_SHIFT 10
-#define HW_PAGE_SIZE (1 << HW_PAGE_SHIFT)
-#define HW_PAGE_MASK (HW_PAGE_SHIFT - 1)
-
-template <class T, u8 *P> void HW_Read_Memory(T &_Data, const u32 _Address)
-{
- _Data = *(T *)&P[_Address & HW_PAGE_MASK];
-}
-
-template <class T, u8 *P> void HW_Write_Memory(T _Data, const u32 _Address)
-{
- *(T *)&P[_Address & HW_PAGE_MASK] = _Data;
-}
+// MMIO mapping object.
+MMIO::Mapping* mmio_mapping;
-// Create shortcuts to the hardware devices' read and write functions.
-// This can be seen as an alternative to a switch() or if() table.
-#define BLOCKSIZE 4
-#define CP_START 0x00 //0x0000 >> 10
-#define WII_IPC_START 0x00 //0x0000 >> 10
-#define PE_START 0x04 //0x1000 >> 10
-#define VI_START 0x08 //0x2000 >> 10
-#define PI_START 0x0C //0x3000 >> 10
-#define MI_START 0x10 //0x4000 >> 10
-#define DSP_START 0x14 //0x5000 >> 10
-#define DVD_START 0x18 //0x6000 >> 10
-#define SI_START 0x19 //0x6400 >> 10
-#define EI_START 0x1A //0x6800 >> 10
-#define AUDIO_START 0x1B //0x6C00 >> 10
-#define GP_START 0x20 //0x8000 >> 10
-
-void InitHWMemFuncs()
+void InitMMIO(MMIO::Mapping* mmio)
{
- for (int i = 0; i < NUMHWMEMFUN; i++)
- {
- hwWrite8 [i] = HW_Default_Write<u8>;
- hwWrite16[i] = HW_Default_Write<u16>;
- hwWrite32[i] = HW_Default_Write<u32>;
- hwWrite64[i] = HW_Default_Write<u64>;
- hwRead8 [i] = HW_Default_Read<u8&>;
- hwRead16 [i] = HW_Default_Read<u16&>;
- hwRead32 [i] = HW_Default_Read<u32&>;
- hwRead64 [i] = HW_Default_Read<u64&>;
-
- // To prevent Dolphin from crashing when accidentally running Wii
- // executables in GC mode (or running malicious GC executables...)
- hwWriteWii8 [i] = HW_Default_Write<u8>;
- hwWriteWii16[i] = HW_Default_Write<u16>;
- hwWriteWii32[i] = HW_Default_Write<u32>;
- hwWriteWii64[i] = HW_Default_Write<u64>;
- hwReadWii8 [i] = HW_Default_Read<u8&>;
- hwReadWii16 [i] = HW_Default_Read<u16&>;
- hwReadWii32 [i] = HW_Default_Read<u32&>;
- hwReadWii64 [i] = HW_Default_Read<u64&>;
- }
-
- for (int i = 0; i < BLOCKSIZE; i++)
- {
- hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16();
- hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16();
-
- hwRead16 [PE_START+i] = g_video_backend->Video_PERead16();
- hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16();
- hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32();
-
- hwRead8 [VI_START+i] = VideoInterface::Read8;
- hwRead16 [VI_START+i] = VideoInterface::Read16;
- hwRead32 [VI_START+i] = VideoInterface::Read32;
- hwWrite16[VI_START+i] = VideoInterface::Write16;
- hwWrite32[VI_START+i] = VideoInterface::Write32;
-
- hwRead16 [PI_START+i] = ProcessorInterface::Read16;
- hwRead32 [PI_START+i] = ProcessorInterface::Read32;
- hwWrite32[PI_START+i] = ProcessorInterface::Write32;
-
- hwRead16 [MI_START+i] = MemoryInterface::Read16;
- hwRead32 [MI_START+i] = MemoryInterface::Read32;
- hwWrite32[MI_START+i] = MemoryInterface::Write32;
- hwWrite16[MI_START+i] = MemoryInterface::Write16;
-
- hwRead16 [DSP_START+i] = DSP::Read16;
- hwWrite16[DSP_START+i] = DSP::Write16;
- hwRead32 [DSP_START+i] = DSP::Read32;
- hwWrite32[DSP_START+i] = DSP::Write32;
- }
-
- hwRead32 [DVD_START] = DVDInterface::Read32;
- hwWrite32[DVD_START] = DVDInterface::Write32;
-
- hwRead32 [SI_START] = SerialInterface::Read32;
- hwWrite32[SI_START] = SerialInterface::Write32;
-
- hwRead32 [EI_START] = ExpansionInterface::Read32;
- hwWrite32[EI_START] = ExpansionInterface::Write32;
-
- hwRead32 [AUDIO_START] = AudioInterface::Read32;
- hwWrite32[AUDIO_START] = AudioInterface::Write32;
-
- hwWrite8 [GP_START] = GPFifo::Write8;
- hwWrite16[GP_START] = GPFifo::Write16;
- hwWrite32[GP_START] = GPFifo::Write32;
- hwWrite64[GP_START] = GPFifo::Write64;
+ g_video_backend->RegisterCPMMIO(mmio, 0xCC000000);
+ g_video_backend->RegisterPEMMIO(mmio, 0xCC001000);
+ VideoInterface::RegisterMMIO(mmio, 0xCC002000);
+ ProcessorInterface::RegisterMMIO(mmio, 0xCC003000);
+ MemoryInterface::RegisterMMIO(mmio, 0xCC004000);
+ DSP::RegisterMMIO(mmio, 0xCC005000);
+ DVDInterface::RegisterMMIO(mmio, 0xCC006000);
+ SerialInterface::RegisterMMIO(mmio, 0xCC006400);
+ ExpansionInterface::RegisterMMIO(mmio, 0xCC006800);
+ AudioInterface::RegisterMMIO(mmio, 0xCC006C00);
}
-
-void InitHWMemFuncsWii()
+void InitMMIOWii(MMIO::Mapping* mmio)
{
- for (int i = 0; i < NUMHWMEMFUN; i++)
- {
- hwWrite8 [i] = HW_Default_Write<u8>;
- hwWrite16[i] = HW_Default_Write<u16>;
- hwWrite32[i] = HW_Default_Write<u32>;
- hwWrite64[i] = HW_Default_Write<u64>;
- hwRead8 [i] = HW_Default_Read<u8&>;
- hwRead16 [i] = HW_Default_Read<u16&>;
- hwRead32 [i] = HW_Default_Read<u32&>;
- hwRead64 [i] = HW_Default_Read<u64&>;
-
- hwWriteWii8 [i] = HW_Default_Write<u8>;
- hwWriteWii16[i] = HW_Default_Write<u16>;
- hwWriteWii32[i] = HW_Default_Write<u32>;
- hwWriteWii64[i] = HW_Default_Write<u64>;
- hwReadWii8 [i] = HW_Default_Read<u8&>;
- hwReadWii16 [i] = HW_Default_Read<u16&>;
- hwReadWii32 [i] = HW_Default_Read<u32&>;
- hwReadWii64 [i] = HW_Default_Read<u64&>;
- }
-
- // MI, PI, DSP are still mapped to 0xCCxxxxxx
- for (int i = 0; i < BLOCKSIZE; i++)
- {
- hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16();
- hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16();
-
- hwRead16 [PE_START+i] = g_video_backend->Video_PERead16();
- hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16();
- hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32();
-
- hwRead16 [PI_START+i] = ProcessorInterface::Read16;
- hwRead32 [PI_START+i] = ProcessorInterface::Read32;
- hwWrite32[PI_START+i] = ProcessorInterface::Write32;
-
- hwRead8 [VI_START+i] = VideoInterface::Read8;
- hwRead16 [VI_START+i] = VideoInterface::Read16;
- hwRead32 [VI_START+i] = VideoInterface::Read32;
- hwWrite16[VI_START+i] = VideoInterface::Write16;
- hwWrite32[VI_START+i] = VideoInterface::Write32;
-
- hwRead16 [MI_START+i] = MemoryInterface::Read16;
- hwRead32 [MI_START+i] = MemoryInterface::Read32;
- hwWrite32[MI_START+i] = MemoryInterface::Write32;
- hwWrite16[MI_START+i] = MemoryInterface::Write16;
-
- hwRead16 [DSP_START+i] = DSP::Read16;
- hwWrite16[DSP_START+i] = DSP::Write16;
- hwRead32 [DSP_START+i] = DSP::Read32;
- hwWrite32[DSP_START+i] = DSP::Write32;
- }
+ InitMMIO(mmio);
- hwWrite8 [GP_START] = GPFifo::Write8;
- hwWrite16[GP_START] = GPFifo::Write16;
- hwWrite32[GP_START] = GPFifo::Write32;
- hwWrite64[GP_START] = GPFifo::Write64;
-
- for (int i = 0; i < BLOCKSIZE; i++)
- {
- hwReadWii32[WII_IPC_START+i] = WII_IPCInterface::Read32;
- hwWriteWii32[WII_IPC_START+i] = WII_IPCInterface::Write32;
- }
-
- hwRead32 [DVD_START] = DVDInterface::Read32;
- hwReadWii32 [DVD_START] = DVDInterface::Read32;
- hwWrite32 [DVD_START] = DVDInterface::Write32;
- hwWriteWii32[DVD_START] = DVDInterface::Write32;
-
- hwRead32 [SI_START] = SerialInterface::Read32;
- hwReadWii32 [SI_START] = SerialInterface::Read32;
- hwWrite32 [SI_START] = SerialInterface::Write32;
- hwWriteWii32[SI_START] = SerialInterface::Write32;
-
- hwRead32 [EI_START] = ExpansionInterface::Read32;
- hwReadWii32 [EI_START] = ExpansionInterface::Read32;
- hwWrite32 [EI_START] = ExpansionInterface::Write32;
- hwWriteWii32[EI_START] = ExpansionInterface::Write32;
-
- // [F|RES] i thought this doesn't exist anymore
- hwRead32 [AUDIO_START] = AudioInterface::Read32;
- hwReadWii32 [AUDIO_START] = AudioInterface::Read32;
- hwWrite32 [AUDIO_START] = AudioInterface::Write32;
- hwWriteWii32[AUDIO_START] = AudioInterface::Write32;
-}
-
-writeFn32 GetHWWriteFun32(const u32 _Address)
-{
- return hwWrite32[(_Address >> HWSHIFT) & (NUMHWMEMFUN-1)];
+ WII_IPCInterface::RegisterMMIO(mmio, 0xCD000000);
+ DVDInterface::RegisterMMIO(mmio, 0xCD006000);
+ SerialInterface::RegisterMMIO(mmio, 0xCD006400);
+ ExpansionInterface::RegisterMMIO(mmio, 0xCD006800);
+ AudioInterface::RegisterMMIO(mmio, 0xCD006C00);
}
bool IsInitialized()
@@ -325,7 +127,7 @@ static const MemoryView views[] =
// Don't map any memory for the EFB. We want all access to this area to go
// through the hardware access handlers.
#ifndef _M_X64
-// {&m_pEFB, &m_pVirtualEFB, 0xC8000000, EFB_SIZE, 0},
+// {&m_pEFB, &m_pVirtualEFB, 0xC8000000, EFB_SIZE, 0},
#endif
{&m_pL1Cache, &m_pVirtualL1Cache, 0xE0000000, L1_CACHE_SIZE, 0},
@@ -348,10 +150,12 @@ void Init()
if (bFakeVMEM) flags |= MV_FAKE_VMEM;
base = MemoryMap_Setup(views, num_views, flags, &g_arena);
+ mmio_mapping = new MMIO::Mapping();
+
if (wii)
- InitHWMemFuncsWii();
+ InitMMIOWii(mmio_mapping);
else
- InitHWMemFuncs();
+ InitMMIO(mmio_mapping);
INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirrors at 0 @ %p, 0x80000000 @ %p , 0xC0000000 @ %p)",
m_pRAM, m_pPhysicalRAM, m_pVirtualCachedRAM, m_pVirtualUncachedRAM);
@@ -362,7 +166,7 @@ void DoState(PointerWrap &p)
{
bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
p.DoArray(m_pPhysicalRAM, RAM_SIZE);
-// p.DoArray(m_pVirtualEFB, EFB_SIZE);
+ //p.DoArray(m_pVirtualEFB, EFB_SIZE);
p.DoArray(m_pVirtualL1Cache, L1_CACHE_SIZE);
p.DoMarker("Memory RAM");
if (bFakeVMEM)
@@ -382,6 +186,7 @@ void Shutdown()
MemoryMap_Shutdown(views, num_views, flags, &g_arena);
g_arena.ReleaseSpace();
base = NULL;
+ delete mmio_mapping;
INFO_LOG(MEMMAP, "Memory system shut down.");
}
diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h
index 1f89148..85c2a36 100644
--- a/Source/Core/Core/HW/Memmap.h
+++ b/Source/Core/Core/HW/Memmap.h
@@ -17,9 +17,9 @@
#pragma once
-// Includes
#include <string>
-#include "Common.h"
+
+#include "Common/Common.h"
// Enable memory checks in the Debug/DebugFast builds, but NOT in release
#if defined(_DEBUG) || defined(DEBUGFAST)
@@ -28,16 +28,7 @@
// Global declarations
class PointerWrap;
-
-typedef void (*writeFn8 )(const u8, const u32);
-typedef void (*writeFn16)(const u16,const u32);
-typedef void (*writeFn32)(const u32,const u32);
-typedef void (*writeFn64)(const u64,const u32);
-
-typedef void (*readFn8 )(u8&, const u32);
-typedef void (*readFn16)(u16&, const u32);
-typedef void (*readFn32)(u32&, const u32);
-typedef void (*readFn64)(u64&, const u32);
+namespace MMIO { class Mapping; }
namespace Memory
{
@@ -83,6 +74,9 @@ enum
#endif
};
+// MMIO mapping object.
+extern MMIO::Mapping* mmio_mapping;
+
// Init and Shutdown
bool IsInitialized();
void Init();
@@ -99,11 +93,7 @@ u32 ReadUnchecked_U32(const u32 _Address);
void WriteUnchecked_U8(const u8 _Data, const u32 _Address);
void WriteUnchecked_U32(const u32 _Data, const u32 _Address);
-void InitHWMemFuncs();
-void InitHWMemFuncsWii();
-
bool IsRAMAddress(const u32 addr, bool allow_locked_cache = false, bool allow_fake_vmem = false);
-writeFn32 GetHWWriteFun32(const u32 _Address);
inline u8* GetCachePtr() {return m_pL1Cache;}
inline u8* GetMainRAMPtr() {return m_pRAM;}
diff --git a/Source/Core/Core/HW/MemmapFunctions.cpp b/Source/Core/Core/HW/MemmapFunctions.cpp
index 40bc5f4..3a85a1e 100644
--- a/Source/Core/Core/HW/MemmapFunctions.cpp
+++ b/Source/Core/Core/HW/MemmapFunctions.cpp
@@ -15,18 +15,19 @@
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-#include "Atomic.h"
+#include "Common/Atomic.h"
+#include "Common/Common.h"
-#include "GPFifo.h"
-#include "Memmap.h"
-#include "WII_IOB.h"
-#include "../Core.h"
-#include "../PowerPC/PowerPC.h"
-#include "VideoBackendBase.h"
+#include "Core/Core.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
#ifdef USE_GDBSTUB
-#include "../PowerPC/GDBStub.h"
+#include "Core/PowerPC/GDBStub.h"
#endif
namespace Memory
@@ -35,15 +36,15 @@ namespace Memory
// EFB RE
/*
GXPeekZ
-80322de8: rlwinm r0, r3, 2, 14, 29 (0003fffc) a = x << 2 & 0x3fffc
-80322dec: oris r0, r0, 0xC800 a |= 0xc8000000
-80322df0: rlwinm r3, r0, 0, 20, 9 (ffc00fff) x = a & 0xffc00fff
-80322df4: rlwinm r0, r4, 12, 4, 19 (0ffff000) a = (y << 12) & 0x0ffff000;
-80322df8: or r0, r3, r0 a |= x;
-80322dfc: rlwinm r0, r0, 0, 10, 7 (ff3fffff) a &= 0xff3fffff
-80322e00: oris r3, r0, 0x0040 x = a | 0x00400000
-80322e04: lwz r0, 0 (r3) r0 = *r3
-80322e08: stw r0, 0 (r5) z =
+80322de8: rlwinm r0, r3, 2, 14, 29 (0003fffc) a = x << 2 & 0x3fffc
+80322dec: oris r0, r0, 0xC800 a |= 0xc8000000
+80322df0: rlwinm r3, r0, 0, 20, 9 (ffc00fff) x = a & 0xffc00fff
+80322df4: rlwinm r0, r4, 12, 4, 19 (0ffff000) a = (y << 12) & 0x0ffff000;
+80322df8: or r0, r3, r0 a |= x;
+80322dfc: rlwinm r0, r0, 0, 10, 7 (ff3fffff) a &= 0xff3fffff
+80322e00: oris r3, r0, 0x0040 x = a | 0x00400000
+80322e04: lwz r0, 0 (r3) r0 = *r3
+80322e08: stw r0, 0 (r5) z =
80322e0c: blr
*/
@@ -61,28 +62,6 @@ extern u8 *m_pEFB;
extern bool m_IsInitialized;
extern bool bFakeVMEM;
-// Read and write shortcuts
-
-// It appears that some clever games use stfd to write 64 bits to the fifo. Hence the hwWrite64.
-
-extern writeFn8 hwWrite8 [NUMHWMEMFUN];
-extern writeFn16 hwWrite16[NUMHWMEMFUN];
-extern writeFn32 hwWrite32[NUMHWMEMFUN];
-extern writeFn64 hwWrite64[NUMHWMEMFUN];
-
-extern readFn8 hwRead8 [NUMHWMEMFUN];
-extern readFn16 hwRead16[NUMHWMEMFUN];
-extern readFn32 hwRead32[NUMHWMEMFUN];
-
-extern writeFn8 hwWriteWii8 [NUMHWMEMFUN];
-extern writeFn16 hwWriteWii16[NUMHWMEMFUN];
-extern writeFn32 hwWriteWii32[NUMHWMEMFUN];
-extern writeFn64 hwWriteWii64[NUMHWMEMFUN];
-
-extern readFn8 hwReadWii8 [NUMHWMEMFUN];
-extern readFn16 hwReadWii16[NUMHWMEMFUN];
-extern readFn32 hwReadWii32[NUMHWMEMFUN];
-
// Overloaded byteswap functions, for use within the templated functions below.
inline u8 bswap(u8 val) {return val;}
inline u16 bswap(u16 val) {return Common::swap16(val);}
@@ -91,42 +70,6 @@ inline u64 bswap(u64 val) {return Common::swap64(val);}
// =================
-// Read and write
-// ----------------
-// The read and write macros that direct us to the right functions
-
-// All these little inline functions are needed because we can't paste symbols together in templates
-// like we can in macros.
-inline void hwRead(u8 &var, u32 addr) {hwRead8 [(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwRead(u16 &var, u32 addr) {hwRead16[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwRead(u32 &var, u32 addr) {hwRead32[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwRead(u64 &var, u32 addr) {PanicAlert("hwRead: There's no 64-bit HW read. %08x", addr);}
-
-inline void hwWrite(u8 var, u32 addr) {hwWrite8[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWrite(u16 var, u32 addr) {hwWrite16[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWrite(u32 var, u32 addr) {hwWrite32[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWrite(u64 var, u32 addr) {hwWrite64[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-
-inline void hwReadWii(u8 &var, u32 addr) {hwReadWii8 [(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwReadWii(u16 &var, u32 addr) {hwReadWii16[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwReadWii(u32 &var, u32 addr) {hwReadWii32[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwReadWii(u64 &var, u32 addr) {PanicAlert("hwReadWii: There's no 64-bit HW read. %08x", addr);}
-
-inline void hwWriteWii(u8 var, u32 addr) {hwWriteWii8[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWriteWii(u16 var, u32 addr) {hwWriteWii16[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWriteWii(u32 var, u32 addr) {hwWriteWii32[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-inline void hwWriteWii(u64 var, u32 addr) {hwWriteWii64[(addr>>HWSHIFT) & (NUMHWMEMFUN-1)](var, addr);}
-
-inline void hwReadIOBridge(u8 &var, u32 addr) {WII_IOBridge::Read8(var, addr);}
-inline void hwReadIOBridge(u16 &var, u32 addr) {WII_IOBridge::Read16(var, addr);}
-inline void hwReadIOBridge(u32 &var, u32 addr) {WII_IOBridge::Read32(var, addr);}
-inline void hwReadIOBridge(u64 &var, u32 addr) {PanicAlert("hwReadIOBridge: There's no 64-bit HW read. %08x", addr);}
-
-inline void hwWriteIOBridge(u8 var, u32 addr) {WII_IOBridge::Write8(var, addr);}
-inline void hwWriteIOBridge(u16 var, u32 addr) {WII_IOBridge::Write16(var, addr);}
-inline void hwWriteIOBridge(u32 var, u32 addr) {WII_IOBridge::Write32(var, addr);}
-inline void hwWriteIOBridge(u64 var, u32 addr) {PanicAlert("hwWriteIOBridge: There's no 64-bit HW write. %08x", addr);}
-
// Nasty but necessary. Super Mario Galaxy pointer relies on this stuff.
u32 EFB_Read(const u32 addr)
{
@@ -155,20 +98,8 @@ inline void ReadFromHardware(T &_var, const u32 em_address, const u32 effective_
{
if (em_address < 0xcc000000)
_var = EFB_Read(em_address);
- else if (em_address <= 0xcc009000)
- hwRead(_var, em_address);
- /* WIIMODE */
- else if (((em_address & 0xFF000000) == 0xCD000000) &&
- (em_address <= 0xcd009000))
- hwReadWii(_var, em_address);
- else if (((em_address & 0xFFF00000) == 0xCD800000) &&
- (em_address <= 0xCD809000))
- hwReadIOBridge(_var, em_address);
else
- {
- /* Disabled because the debugger makes trouble with */
- /*_dbg_assert_(MEMMAP,0); */
- }
+ mmio_mapping->Read(em_address, &_var);
}
else if (((em_address & 0xF0000000) == 0x80000000) ||
((em_address & 0xF0000000) == 0xC0000000) ||
@@ -218,11 +149,12 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
// reason we end up in this function:
if (em_address == 0xCC008000)
{
- switch (sizeof(T)) {
- case 1: GPFifo::Write8((u8)data, em_address); return;
- case 2: GPFifo::Write16((u16)data, em_address); return;
- case 4: GPFifo::Write32((u32)data, em_address); return;
- case 8: GPFifo::Write64((u64)data, em_address); return;
+ switch (sizeof(T))
+ {
+ case 1: GPFifo::Write8((u8)data, em_address); return;
+ case 2: GPFifo::Write16((u16)data, em_address); return;
+ case 4: GPFifo::Write32((u32)data, em_address); return;
+ case 8: GPFifo::Write64((u64)data, em_address); return;
}
}
if ((em_address & 0xC8000000) == 0xC8000000)
@@ -245,28 +177,10 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
}
return;
}
- else if (em_address <= 0xcc009000)
- {
- hwWrite(data, em_address);
- return;
- }
- /* WIIMODE */
- else if (((em_address & 0xFF000000) == 0xCD000000) &&
- (em_address <= 0xcd009000))
- {
- hwWriteWii(data,em_address);
- return;
- }
- else if (((em_address & 0xFFF00000) == 0xCD800000) &&
- (em_address <= 0xCD809000))
- {
- hwWriteIOBridge(data,em_address);
- return;
- }
else
{
- ERROR_LOG(MEMMAP, "hwwrite [%08x] := %08x (PC: %08x)", em_address, (u32)data, PC);
- _dbg_assert_msg_(MEMMAP,0,"Memory - Unknown HW address %08x", em_address);
+ mmio_mapping->Write(em_address, data);
+ return;
}
}
else if (((em_address & 0xF0000000) == 0x80000000) ||
@@ -554,23 +468,23 @@ void WriteUnchecked_U32(const u32 _iValue, const u32 _Address)
// *********************************************************************************
/*
-* PearPC
-* ppc_mmu.cc
+* PearPC
+* ppc_mmu.cc
*
-* Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net)
+* Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net)
*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License version 2 as
-* published by the Free Software Foundation.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
@@ -591,8 +505,8 @@ void WriteUnchecked_U32(const u32 _iValue, const u32 _Address)
#define EA_SR(v) (((v)>>28)&0xf)
#define EA_PageIndex(v) (((v)>>12)&0xffff)
-#define EA_Offset(v) ((v)&0xfff)
-#define EA_API(v) (((v)>>22)&0x3f)
+#define EA_Offset(v) ((v)&0xfff)
+#define EA_API(v) (((v)>>22)&0x3f)
#define PA_RPN(v) (((v)>>12)&0xfffff)
#define PA_Offset(v) ((v)&0xfff)
@@ -847,10 +761,10 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag)
u32 sr = PowerPC::ppcState.sr[EA_SR(_Address)];
- u32 offset = EA_Offset(_Address); // 12 bit
- u32 page_index = EA_PageIndex(_Address); // 16 bit
- u32 VSID = SR_VSID(sr); // 24 bit
- u32 api = EA_API(_Address); // 6 bit (part of page_index)
+ u32 offset = EA_Offset(_Address); // 12 bit
+ u32 page_index = EA_PageIndex(_Address); // 16 bit
+ u32 VSID = SR_VSID(sr); // 24 bit
+ u32 api = EA_API(_Address); // 6 bit (part of page_index)
u8* pRAM = GetPointer(0);
diff --git a/Source/Core/Core/HW/MemoryInterface.cpp b/Source/Core/Core/HW/MemoryInterface.cpp
index 975260f..e3fae0c 100644
--- a/Source/Core/Core/HW/MemoryInterface.cpp
+++ b/Source/Core/Core/HW/MemoryInterface.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include "../PowerPC/PowerPC.h"
-#include "MemoryInterface.h"
+#include "Core/HW/MemoryInterface.h"
+#include "Core/HW/MMIO.h"
+#include "Core/PowerPC/PowerPC.h"
namespace MemoryInterface
{
@@ -14,67 +15,199 @@ namespace MemoryInterface
// internal hardware addresses
enum
{
- MEM_CHANNEL0_HI = 0x000,
- MEM_CHANNEL0_LO = 0x002,
- MEM_CHANNEL1_HI = 0x004,
- MEM_CHANNEL1_LO = 0x006,
- MEM_CHANNEL2_HI = 0x008,
- MEM_CHANNEL2_LO = 0x00A,
- MEM_CHANNEL3_HI = 0x00C,
- MEM_CHANNEL3_LO = 0x00E,
- MEM_CHANNEL_CTRL = 0x010
+ MI_REGION0_FIRST = 0x000,
+ MI_REGION0_LAST = 0x002,
+ MI_REGION1_FIRST = 0x004,
+ MI_REGION1_LAST = 0x006,
+ MI_REGION2_FIRST = 0x008,
+ MI_REGION2_LAST = 0x00A,
+ MI_REGION3_FIRST = 0x00C,
+ MI_REGION3_LAST = 0x00E,
+ MI_PROT_TYPE = 0x010,
+ MI_IRQMASK = 0x01C,
+ MI_IRQFLAG = 0x01E,
+ MI_UNKNOWN1 = 0x020,
+ MI_PROT_ADDR_LO = 0x022,
+ MI_PROT_ADDR_HI = 0x024,
+ MI_TIMER0_HI = 0x032,
+ MI_TIMER0_LO = 0x034,
+ MI_TIMER1_HI = 0x036,
+ MI_TIMER1_LO = 0x038,
+ MI_TIMER2_HI = 0x03A,
+ MI_TIMER2_LO = 0x03C,
+ MI_TIMER3_HI = 0x03E,
+ MI_TIMER3_LO = 0x040,
+ MI_TIMER4_HI = 0x042,
+ MI_TIMER4_LO = 0x044,
+ MI_TIMER5_HI = 0x046,
+ MI_TIMER5_LO = 0x048,
+ MI_TIMER6_HI = 0x04A,
+ MI_TIMER6_LO = 0x04C,
+ MI_TIMER7_HI = 0x04E,
+ MI_TIMER7_LO = 0x050,
+ MI_TIMER8_HI = 0x052,
+ MI_TIMER8_LO = 0x054,
+ MI_TIMER9_HI = 0x056,
+ MI_TIMER9_LO = 0x058,
+ MI_UNKNOWN2 = 0x05A,
};
-struct MIMemStruct
+union MIRegion
{
- u32 Channel0_Addr;
- u32 Channel1_Addr;
- u32 Channel2_Addr;
- u32 Channel3_Addr;
- u32 Channel_Ctrl;
+ u32 hex;
+ struct { u16 first_page; u16 last_page; };
};
-// STATE_TO_SAVE
-static MIMemStruct miMem;
+union MIProtType
+{
+ u16 hex;
+ struct
+ {
+ u16 reg0 : 2;
+ u16 reg1 : 2;
+ u16 reg2 : 2;
+ u16 reg3 : 2;
+ u16 : 8;
+ };
+};
-void DoState(PointerWrap &p)
+union MIIRQMask
{
- p.Do(miMem);
-}
+ u16 hex;
+ struct
+ {
+ u16 reg0 : 1;
+ u16 reg1 : 1;
+ u16 reg2 : 1;
+ u16 reg3 : 1;
+ u16 all_regs : 1;
+ u16 : 11;
+ };
+};
-void Read16(u16& _uReturnValue, const u32 _iAddress)
+union MIIRQFlag
{
- //0x30 -> 0x5a : gp memory metrics
- INFO_LOG(MEMMAP, "(r16) 0x%04x @ 0x%08x", 0, _iAddress);
- _uReturnValue = 0;
-}
+ u16 hex;
+ struct
+ {
+ u16 reg0 : 1;
+ u16 reg1 : 1;
+ u16 reg2 : 1;
+ u16 reg3 : 1;
+ u16 all_regs : 1;
+ u16 : 11;
+ };
+};
-void Read32(u32& _uReturnValue, const u32 _iAddress)
+union MIProtAddr
{
- INFO_LOG(MEMMAP, "(r32) 0x%08x @ 0x%08x", 0, _iAddress);
- _uReturnValue = 0;
-}
+ u32 hex;
+ struct { u16 lo; u16 hi; };
+ struct
+ {
+ u32 : 5;
+ u32 addr : 25;
+ u32 : 2;
+ };
+};
-void Write32(const u32 _iValue, const u32 _iAddress)
+union MITimer
+{
+ u32 hex;
+ struct { u16 lo; u16 hi; };
+};
+
+struct MIMemStruct
{
- INFO_LOG(MEMMAP, "(w32) 0x%08x @ 0x%08x", _iValue, _iAddress);
+ MIRegion regions[4];
+ MIProtType prot_type;
+ MIIRQMask irq_mask;
+ MIIRQFlag irq_flag;
+ u16 unknown1;
+ MIProtAddr prot_addr;
+ MITimer timers[10];
+ u16 unknown2;
+};
+
+// STATE_TO_SAVE
+static MIMemStruct g_mi_mem;
+
+void DoState(PointerWrap &p)
+{
+ p.Do(g_mi_mem);
}
-//TODO : check
-void Write16(const u16 _iValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- INFO_LOG(MEMMAP, "(w16) 0x%04x @ 0x%08x", _iValue, _iAddress);
- switch(_iAddress & 0xFFF)
+ for (int i = 0; i < MI_REGION0_FIRST; i += 4)
+ {
+ auto& region = g_mi_mem.regions[i / 4];
+ mmio->Register(base | i,
+ MMIO::DirectRead<u16>(®ion.first_page),
+ MMIO::DirectWrite<u16>(®ion.first_page)
+ );
+ mmio->Register(base | (i + 2),
+ MMIO::DirectRead<u16>(®ion.last_page),
+ MMIO::DirectWrite<u16>(®ion.last_page)
+ );
+ }
+
+ mmio->Register(base | MI_PROT_TYPE,
+ MMIO::DirectRead<u16>(&g_mi_mem.prot_type.hex),
+ MMIO::DirectWrite<u16>(&g_mi_mem.prot_type.hex)
+ );
+
+ mmio->Register(base | MI_IRQMASK,
+ MMIO::DirectRead<u16>(&g_mi_mem.irq_mask.hex),
+ MMIO::DirectWrite<u16>(&g_mi_mem.irq_mask.hex)
+ );
+
+ mmio->Register(base | MI_IRQFLAG,
+ MMIO::DirectRead<u16>(&g_mi_mem.irq_flag.hex),
+ MMIO::DirectWrite<u16>(&g_mi_mem.irq_flag.hex)
+ );
+
+ mmio->Register(base | MI_UNKNOWN1,
+ MMIO::DirectRead<u16>(&g_mi_mem.unknown1),
+ MMIO::DirectWrite<u16>(&g_mi_mem.unknown1)
+ );
+
+ // The naming is confusing here: the registed contains the lower part of
+ // the address (hence MI_..._LO but this is still the high part of the
+ // overall register.
+ mmio->Register(base | MI_PROT_ADDR_LO,
+ MMIO::DirectRead<u16>(&g_mi_mem.prot_addr.hi),
+ MMIO::DirectWrite<u16>(&g_mi_mem.prot_addr.hi)
+ );
+ mmio->Register(base | MI_PROT_ADDR_HI,
+ MMIO::DirectRead<u16>(&g_mi_mem.prot_addr.lo),
+ MMIO::DirectWrite<u16>(&g_mi_mem.prot_addr.lo)
+ );
+
+ for (int i = 0; i < 10; ++i)
+ {
+ auto& timer = g_mi_mem.timers[i];
+ mmio->Register(base | (MI_TIMER0_HI + 4 * i),
+ MMIO::DirectRead<u16>(&timer.hi),
+ MMIO::DirectWrite<u16>(&timer.hi)
+ );
+ mmio->Register(base | (MI_TIMER0_LO + 4 * i),
+ MMIO::DirectRead<u16>(&timer.lo),
+ MMIO::DirectWrite<u16>(&timer.lo)
+ );
+ }
+
+ mmio->Register(base | MI_UNKNOWN2,
+ MMIO::DirectRead<u16>(&g_mi_mem.unknown2),
+ MMIO::DirectWrite<u16>(&g_mi_mem.unknown2)
+ );
+
+ for (int i = 0; i < 0x1000; i += 4)
{
- case MEM_CHANNEL0_HI: miMem.Channel0_Addr = (miMem.Channel0_Addr & 0xFFFF) | (_iValue<<16); return;
- case MEM_CHANNEL0_LO: miMem.Channel0_Addr = (miMem.Channel0_Addr & 0xFFFF0000) | (_iValue); return;
- case MEM_CHANNEL1_HI: miMem.Channel1_Addr = (miMem.Channel1_Addr & 0xFFFF) | (_iValue<<16); return;
- case MEM_CHANNEL1_LO: miMem.Channel1_Addr = (miMem.Channel1_Addr & 0xFFFF0000) | (_iValue); return;
- case MEM_CHANNEL2_HI: miMem.Channel2_Addr = (miMem.Channel2_Addr & 0xFFFF) | (_iValue<<16); return;
- case MEM_CHANNEL2_LO: miMem.Channel2_Addr = (miMem.Channel2_Addr & 0xFFFF0000) | (_iValue); return;
- case MEM_CHANNEL3_HI: miMem.Channel3_Addr = (miMem.Channel3_Addr & 0xFFFF) | (_iValue<<16); return;
- case MEM_CHANNEL3_LO: miMem.Channel3_Addr = (miMem.Channel3_Addr & 0xFFFF0000) | (_iValue); return;
- case MEM_CHANNEL_CTRL: miMem.Channel_Ctrl = _iValue; return;
+ mmio->Register(base | i,
+ MMIO::ReadToSmaller<u32>(mmio, base | i, base | (i + 2)),
+ MMIO::WriteToSmaller<u32>(mmio, base | i, base | (i + 2))
+ );
}
}
diff --git a/Source/Core/Core/HW/MemoryInterface.h b/Source/Core/Core/HW/MemoryInterface.h
index ad35aef..3d4891f 100644
--- a/Source/Core/Core/HW/MemoryInterface.h
+++ b/Source/Core/Core/HW/MemoryInterface.h
@@ -4,15 +4,14 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
+
+namespace MMIO { class Mapping; }
class PointerWrap;
namespace MemoryInterface
{
void DoState(PointerWrap &p);
-void Read16(u16& _uReturnValue, const u32 _iAddress);
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
-void Write16(const u16 _iValue, const u32 _iAddress);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
} // end of namespace MemoryInterface
diff --git a/Source/Core/Core/HW/ProcessorInterface.cpp b/Source/Core/Core/HW/ProcessorInterface.cpp
index 4b8215f..52547fd 100644
--- a/Source/Core/Core/HW/ProcessorInterface.cpp
+++ b/Source/Core/Core/HW/ProcessorInterface.cpp
@@ -2,18 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
+#include <cstdio>
-#include "Common.h"
-#include "Atomic.h"
-#include "ChunkFile.h"
-#include "../PowerPC/PowerPC.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include "CPU.h"
-#include "../CoreTiming.h"
-#include "ProcessorInterface.h"
-#include "GPFifo.h"
-#include "VideoBackendBase.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace ProcessorInterface
{
@@ -90,113 +92,67 @@ void Init()
toggleResetButton = CoreTiming::RegisterEvent("ToggleResetButton", ToggleResetButtonCallback);
}
-void Read16(u16& _uReturnValue, const u32 _iAddress)
-{
- u32 word;
- Read32(word, _iAddress & ~3);
- _uReturnValue = word >> (_iAddress & 3) ? 16 : 0;
-}
-
-void Read32(u32& _uReturnValue, const u32 _iAddress)
-{
- //INFO_LOG(PROCESSORINTERFACE, "(r32) 0x%08x", _iAddress);
-
- switch(_iAddress & 0xFFF)
- {
- case PI_INTERRUPT_CAUSE:
- _uReturnValue = m_InterruptCause;
- return;
-
- case PI_INTERRUPT_MASK:
- _uReturnValue = m_InterruptMask;
- return;
-
- case PI_FIFO_BASE:
- DEBUG_LOG(PROCESSORINTERFACE, "Read CPU FIFO base, value = %08x", Fifo_CPUBase);
- _uReturnValue = Fifo_CPUBase;
- return;
-
- case PI_FIFO_END:
- DEBUG_LOG(PROCESSORINTERFACE, "Read CPU FIFO end, value = %08x", Fifo_CPUEnd);
- _uReturnValue = Fifo_CPUEnd;
- return;
-
- case PI_FIFO_WPTR:
- DEBUG_LOG(PROCESSORINTERFACE, "Read writepointer, value = %08x", Fifo_CPUWritePointer);
- _uReturnValue = Fifo_CPUWritePointer; //really writes in 32-byte chunks
- // Monk's gcube does some crazy align trickery here.
- return;
-
- case PI_RESET_CODE:
- INFO_LOG(PROCESSORINTERFACE, "Read reset code, 0x%08x", m_ResetCode);
- _uReturnValue = m_ResetCode;
- return;
-
- case PI_FLIPPER_REV:
- INFO_LOG(PROCESSORINTERFACE, "Read flipper rev, 0x%08x", m_FlipperRev);
- _uReturnValue = m_FlipperRev;
- return;
-
- default:
- ERROR_LOG(PROCESSORINTERFACE, "!!!!Unknown write!!!! 0x%08x", _iAddress);
- break;
- }
-
- _uReturnValue = 0xAFFE0000;
-}
-
-void Write32(const u32 _uValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- //INFO_LOG(PROCESSORINTERFACE, "(w32) 0x%08x @ 0x%08x", _uValue, _iAddress);
- switch(_iAddress & 0xFFF)
+ mmio->Register(base | PI_INTERRUPT_CAUSE,
+ MMIO::DirectRead<u32>(&m_InterruptCause),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ Common::AtomicAnd(m_InterruptCause, ~val);
+ UpdateException();
+ })
+ );
+
+ mmio->Register(base | PI_INTERRUPT_MASK,
+ MMIO::DirectRead<u32>(&m_InterruptMask),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ m_InterruptMask = val;
+ UpdateException();
+ })
+ );
+
+ mmio->Register(base | PI_FIFO_BASE,
+ MMIO::DirectRead<u32>(&Fifo_CPUBase),
+ MMIO::DirectWrite<u32>(&Fifo_CPUBase, 0xFFFFFFE0)
+ );
+
+ mmio->Register(base | PI_FIFO_END,
+ MMIO::DirectRead<u32>(&Fifo_CPUEnd),
+ MMIO::DirectWrite<u32>(&Fifo_CPUEnd, 0xFFFFFFE0)
+ );
+
+ mmio->Register(base | PI_FIFO_WPTR,
+ MMIO::DirectRead<u32>(&Fifo_CPUWritePointer),
+ MMIO::DirectWrite<u32>(&Fifo_CPUWritePointer, 0xFFFFFFE0)
+ );
+
+ mmio->Register(base | PI_FIFO_RESET,
+ MMIO::InvalidRead<u32>(),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ WARN_LOG(PROCESSORINTERFACE, "Fifo reset (%08x)", val);
+ })
+ );
+
+ mmio->Register(base | PI_RESET_CODE,
+ MMIO::DirectRead<u32>(&m_ResetCode),
+ MMIO::DirectWrite<u32>(&m_ResetCode)
+ );
+
+ mmio->Register(base | PI_FLIPPER_REV,
+ MMIO::DirectRead<u32>(&m_FlipperRev),
+ MMIO::InvalidWrite<u32>()
+ );
+
+ // 16 bit reads are based on 32 bit reads.
+ for (int i = 0; i < 0x1000; i += 4)
{
- case PI_INTERRUPT_CAUSE:
- Common::AtomicAnd(m_InterruptCause, ~_uValue); // writes turn them off
- UpdateException();
- return;
-
- case PI_INTERRUPT_MASK:
- m_InterruptMask = _uValue;
- DEBUG_LOG(PROCESSORINTERFACE,"New Interrupt mask: %08x", m_InterruptMask);
- UpdateException();
- return;
-
- case PI_FIFO_BASE:
- Fifo_CPUBase = _uValue & 0xFFFFFFE0;
- DEBUG_LOG(PROCESSORINTERFACE,"Fifo base = %08x", _uValue);
- break;
-
- case PI_FIFO_END:
- Fifo_CPUEnd = _uValue & 0xFFFFFFE0;
- DEBUG_LOG(PROCESSORINTERFACE,"Fifo end = %08x", _uValue);
- break;
-
- case PI_FIFO_WPTR:
- Fifo_CPUWritePointer = _uValue & 0xFFFFFFE0;
- DEBUG_LOG(PROCESSORINTERFACE,"Fifo writeptr = %08x", _uValue);
- break;
-
- case PI_FIFO_RESET:
- //Abort the actual frame
- //g_video_backend->Video_AbortFrame();
- //Fifo_CPUWritePointer = Fifo_CPUBase; ??
- //PanicAlert("Unknown write to PI_FIFO_RESET (%08x)", _uValue);
- WARN_LOG(PROCESSORINTERFACE, "Fifo reset (%08x)", _uValue);
- break;
-
- case PI_RESET_CODE:
- DEBUG_LOG(PROCESSORINTERFACE, "Write %08x to PI_RESET_CODE", _uValue);
- m_ResetCode = _uValue;
- break;
-
- case PI_FLIPPER_UNK:
- DEBUG_LOG(PROCESSORINTERFACE, "Write %08x to unknown PI register %08x", _uValue, _iAddress);
- break;
-
- default:
- ERROR_LOG(PROCESSORINTERFACE,"!!!!Unknown PI write!!!! 0x%08x", _iAddress);
- PanicAlert("Unknown write to PI: %08x", _iAddress);
- break;
+ mmio->Register(base | i,
+ MMIO::ReadToLarger<u16>(mmio, base | i, 0),
+ MMIO::InvalidWrite<u16>()
+ );
+ mmio->Register(base | (i + 2),
+ MMIO::ReadToLarger<u16>(mmio, base | i, 16),
+ MMIO::InvalidWrite<u16>()
+ );
}
}
@@ -212,23 +168,23 @@ static const char *Debug_GetInterruptName(u32 _causemask)
{
switch (_causemask)
{
- case INT_CAUSE_PI: return "INT_CAUSE_PI";
- case INT_CAUSE_DI: return "INT_CAUSE_DI";
- case INT_CAUSE_RSW: return "INT_CAUSE_RSW";
- case INT_CAUSE_SI: return "INT_CAUSE_SI";
- case INT_CAUSE_EXI: return "INT_CAUSE_EXI";
- case INT_CAUSE_AI: return "INT_CAUSE_AI";
- case INT_CAUSE_DSP: return "INT_CAUSE_DSP";
- case INT_CAUSE_MEMORY: return "INT_CAUSE_MEMORY";
- case INT_CAUSE_VI: return "INT_CAUSE_VI";
- case INT_CAUSE_PE_TOKEN: return "INT_CAUSE_PE_TOKEN";
- case INT_CAUSE_PE_FINISH: return "INT_CAUSE_PE_FINISH";
- case INT_CAUSE_CP: return "INT_CAUSE_CP";
- case INT_CAUSE_DEBUG: return "INT_CAUSE_DEBUG";
- case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC";
- case INT_CAUSE_HSP: return "INT_CAUSE_HSP";
- case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON";
- default: return "!!! ERROR-unknown Interrupt !!!";
+ case INT_CAUSE_PI: return "INT_CAUSE_PI";
+ case INT_CAUSE_DI: return "INT_CAUSE_DI";
+ case INT_CAUSE_RSW: return "INT_CAUSE_RSW";
+ case INT_CAUSE_SI: return "INT_CAUSE_SI";
+ case INT_CAUSE_EXI: return "INT_CAUSE_EXI";
+ case INT_CAUSE_AI: return "INT_CAUSE_AI";
+ case INT_CAUSE_DSP: return "INT_CAUSE_DSP";
+ case INT_CAUSE_MEMORY: return "INT_CAUSE_MEMORY";
+ case INT_CAUSE_VI: return "INT_CAUSE_VI";
+ case INT_CAUSE_PE_TOKEN: return "INT_CAUSE_PE_TOKEN";
+ case INT_CAUSE_PE_FINISH: return "INT_CAUSE_PE_FINISH";
+ case INT_CAUSE_CP: return "INT_CAUSE_CP";
+ case INT_CAUSE_DEBUG: return "INT_CAUSE_DEBUG";
+ case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC";
+ case INT_CAUSE_HSP: return "INT_CAUSE_HSP";
+ case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON";
+ default: return "!!! ERROR-unknown Interrupt !!!";
}
}
diff --git a/Source/Core/Core/HW/ProcessorInterface.h b/Source/Core/Core/HW/ProcessorInterface.h
index ca7953f..e2fe43c 100644
--- a/Source/Core/Core/HW/ProcessorInterface.h
+++ b/Source/Core/Core/HW/ProcessorInterface.h
@@ -4,9 +4,11 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
+
// Holds statuses of things like the write gatherer used for fifos, and interrupts from various sources
namespace ProcessorInterface
@@ -14,22 +16,22 @@ namespace ProcessorInterface
enum InterruptCause
{
- INT_CAUSE_PI = 0x1, // YAGCD says: GP runtime error
- INT_CAUSE_RSW = 0x2, // Reset Switch
- INT_CAUSE_DI = 0x4, // DVD interrupt
- INT_CAUSE_SI = 0x8, // Serial interface
- INT_CAUSE_EXI = 0x10, // Expansion interface
- INT_CAUSE_AI = 0x20, // Audio Interface Streaming
- INT_CAUSE_DSP = 0x40, // DSP interface
- INT_CAUSE_MEMORY = 0x80, // Memory interface
- INT_CAUSE_VI = 0x100, // Video interface
- INT_CAUSE_PE_TOKEN = 0x200, // GP Token
- INT_CAUSE_PE_FINISH = 0x400, // GP Finished
- INT_CAUSE_CP = 0x800, // Command Fifo
- INT_CAUSE_DEBUG = 0x1000, // Debugger (from devkit)
- INT_CAUSE_HSP = 0x2000, // High Speed Port (from sdram controller)
- INT_CAUSE_WII_IPC = 0x4000, // Wii IPC
- INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) it's a state, not maskable
+ INT_CAUSE_PI = 0x1, // YAGCD says: GP runtime error
+ INT_CAUSE_RSW = 0x2, // Reset Switch
+ INT_CAUSE_DI = 0x4, // DVD interrupt
+ INT_CAUSE_SI = 0x8, // Serial interface
+ INT_CAUSE_EXI = 0x10, // Expansion interface
+ INT_CAUSE_AI = 0x20, // Audio Interface Streaming
+ INT_CAUSE_DSP = 0x40, // DSP interface
+ INT_CAUSE_MEMORY = 0x80, // Memory interface
+ INT_CAUSE_VI = 0x100, // Video interface
+ INT_CAUSE_PE_TOKEN = 0x200, // GP Token
+ INT_CAUSE_PE_FINISH = 0x400, // GP Finished
+ INT_CAUSE_CP = 0x800, // Command Fifo
+ INT_CAUSE_DEBUG = 0x1000, // Debugger (from devkit)
+ INT_CAUSE_HSP = 0x2000, // High Speed Port (from sdram controller)
+ INT_CAUSE_WII_IPC = 0x4000, // Wii IPC
+ INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) it's a state, not maskable
};
@@ -43,10 +45,7 @@ extern u32 Fifo_CPUWritePointer;
void Init();
void DoState(PointerWrap &p);
-void Read16(u16& _uReturnValue, const u32 _iAddress);
-
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
inline u32 GetMask() { return m_InterruptMask; }
inline u32 GetCause() { return m_InterruptCause; }
diff --git a/Source/Core/Core/HW/SI.cpp b/Source/Core/Core/HW/SI.cpp
index 8e087df..6c7d983 100644
--- a/Source/Core/Core/HW/SI.cpp
+++ b/Source/Core/Core/HW/SI.cpp
@@ -2,19 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ChunkFile.h"
-#include "../ConfigManager.h"
-#include "../CoreTiming.h"
-#include "../Movie.h"
-#include "../NetPlayProto.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include "SystemTimers.h"
-#include "ProcessorInterface.h"
-#include "VideoInterface.h"
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_DeviceGBA.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
-#include "SI.h"
-#include "SI_DeviceGBA.h"
namespace SerialInterface
{
@@ -97,10 +98,10 @@ union USIChannelIn_Lo
// SI Channel
struct SSIChannel
{
- USIChannelOut m_Out;
+ USIChannelOut m_Out;
USIChannelIn_Hi m_InHi;
USIChannelIn_Lo m_InLo;
- ISIDevice* m_pDevice;
+ ISIDevice* m_pDevice;
};
// SI Poll: Controls how often a device is polled
@@ -281,199 +282,99 @@ void Shutdown()
GBAConnectionWaiter_Shutdown();
}
-void Read32(u32& _uReturnValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- // SIBuffer
- if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
- (_iAddress >= 0xCD006480 && _iAddress < 0xCD006500))
+ // Register SI buffer direct accesses.
+ for (int i = 0; i < 0x80; i += 4)
+ mmio->Register(base | (0x80 + i),
+ MMIO::DirectRead<u32>((u32*)&g_SIBuffer[i]),
+ MMIO::DirectWrite<u32>((u32*)&g_SIBuffer[i])
+ );
+
+ // In and out for the 4 SI channels.
+ for (int i = 0; i < MAX_SI_CHANNELS; ++i)
{
- _uReturnValue = *(u32*)&g_SIBuffer[_iAddress & 0x7F];
- return;
+ // We need to clear the RDST bit for the SI channel when reading.
+ // CH0 -> Bit 24 + 5
+ // CH1 -> Bit 16 + 5
+ // CH2 -> Bit 8 + 5
+ // CH3 -> Bit 0 + 5
+ int rdst_bit = 8 * (3 - i) + 5;
+
+ mmio->Register(base | (SI_CHANNEL_0_OUT + 0xC * i),
+ MMIO::DirectRead<u32>(&g_Channel[i].m_Out.Hex),
+ MMIO::DirectWrite<u32>(&g_Channel[i].m_Out.Hex)
+ );
+ mmio->Register(base | (SI_CHANNEL_0_IN_HI + 0xC * i),
+ MMIO::ComplexRead<u32>([i, rdst_bit](u32) {
+ g_StatusReg.Hex &= ~(1 << rdst_bit);
+ UpdateInterrupts();
+ return g_Channel[i].m_InHi.Hex;
+ }),
+ MMIO::DirectWrite<u32>(&g_Channel[i].m_InHi.Hex)
+ );
+ mmio->Register(base | (SI_CHANNEL_0_IN_LO + 0xC * i),
+ MMIO::ComplexRead<u32>([i, rdst_bit](u32) {
+ g_StatusReg.Hex &= ~(1 << rdst_bit);
+ UpdateInterrupts();
+ return g_Channel[i].m_InLo.Hex;
+ }),
+ MMIO::DirectWrite<u32>(&g_Channel[i].m_InLo.Hex)
+ );
}
- // error if not changed in the switch
- _uReturnValue = 0xdeadbeef;
+ mmio->Register(base | SI_POLL,
+ MMIO::DirectRead<u32>(&g_Poll.Hex),
+ MMIO::DirectWrite<u32>(&g_Poll.Hex)
+ );
- // registers
- switch (_iAddress & 0x3FF)
- {
- //////////////////////////////////////////////////////////////////////////
- // Channel 0
- //////////////////////////////////////////////////////////////////////////
- case SI_CHANNEL_0_OUT:
- _uReturnValue = g_Channel[0].m_Out.Hex;
- break;
-
- case SI_CHANNEL_0_IN_HI:
- g_StatusReg.RDST0 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[0].m_InHi.Hex;
- break;
-
- case SI_CHANNEL_0_IN_LO:
- g_StatusReg.RDST0 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[0].m_InLo.Hex;
- break;
-
- //////////////////////////////////////////////////////////////////////////
- // Channel 1
- //////////////////////////////////////////////////////////////////////////
- case SI_CHANNEL_1_OUT:
- _uReturnValue = g_Channel[1].m_Out.Hex;
- break;
-
- case SI_CHANNEL_1_IN_HI:
- g_StatusReg.RDST1 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[1].m_InHi.Hex;
- break;
-
- case SI_CHANNEL_1_IN_LO:
- g_StatusReg.RDST1 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[1].m_InLo.Hex;
- break;
-
- //////////////////////////////////////////////////////////////////////////
- // Channel 2
- //////////////////////////////////////////////////////////////////////////
- case SI_CHANNEL_2_OUT:
- _uReturnValue = g_Channel[2].m_Out.Hex;
- break;
-
- case SI_CHANNEL_2_IN_HI:
- g_StatusReg.RDST2 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[2].m_InHi.Hex;
- break;
-
- case SI_CHANNEL_2_IN_LO:
- g_StatusReg.RDST2 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[2].m_InLo.Hex;
- break;
-
- //////////////////////////////////////////////////////////////////////////
- // Channel 3
- //////////////////////////////////////////////////////////////////////////
- case SI_CHANNEL_3_OUT:
- _uReturnValue = g_Channel[3].m_Out.Hex;
- break;
-
- case SI_CHANNEL_3_IN_HI:
- g_StatusReg.RDST3 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[3].m_InHi.Hex;
- break;
-
- case SI_CHANNEL_3_IN_LO:
- g_StatusReg.RDST3 = 0;
- UpdateInterrupts();
- _uReturnValue = g_Channel[3].m_InLo.Hex;
- break;
-
- //////////////////////////////////////////////////////////////////////////
- // Other
- //////////////////////////////////////////////////////////////////////////
- case SI_POLL: _uReturnValue = g_Poll.Hex; break;
- case SI_COM_CSR: _uReturnValue = g_ComCSR.Hex; break;
- case SI_STATUS_REG: _uReturnValue = g_StatusReg.Hex; break;
-
- case SI_EXI_CLOCK_COUNT: _uReturnValue = g_EXIClockCount.Hex; break;
-
- default:
- INFO_LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
- _dbg_assert_(SERIALINTERFACE,0);
- break;
- }
-
- DEBUG_LOG(SERIALINTERFACE, "(r32) 0x%08x - 0x%08x", _iAddress, _uReturnValue);
-}
-
-void Write32(const u32 _iValue, const u32 _iAddress)
-{
- DEBUG_LOG(SERIALINTERFACE, "(w32) 0x%08x @ 0x%08x", _iValue, _iAddress);
-
- // SIBuffer
- if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
- (_iAddress >= 0xCD006480 && _iAddress < 0xCD006500))
- {
- *(u32*)&g_SIBuffer[_iAddress & 0x7F] = _iValue;
- return;
- }
+ mmio->Register(base | SI_COM_CSR,
+ MMIO::DirectRead<u32>(&g_ComCSR.Hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ USIComCSR tmpComCSR(val);
- // registers
- switch (_iAddress & 0x3FF)
- {
- case SI_CHANNEL_0_OUT: g_Channel[0].m_Out.Hex = _iValue; break;
- case SI_CHANNEL_0_IN_HI: g_Channel[0].m_InHi.Hex = _iValue; break;
- case SI_CHANNEL_0_IN_LO: g_Channel[0].m_InLo.Hex = _iValue; break;
- case SI_CHANNEL_1_OUT: g_Channel[1].m_Out.Hex = _iValue; break;
- case SI_CHANNEL_1_IN_HI: g_Channel[1].m_InHi.Hex = _iValue; break;
- case SI_CHANNEL_1_IN_LO: g_Channel[1].m_InLo.Hex = _iValue; break;
- case SI_CHANNEL_2_OUT: g_Channel[2].m_Out.Hex = _iValue; break;
- case SI_CHANNEL_2_IN_HI: g_Channel[2].m_InHi.Hex = _iValue; break;
- case SI_CHANNEL_2_IN_LO: g_Channel[2].m_InLo.Hex = _iValue; break;
- case SI_CHANNEL_3_OUT: g_Channel[3].m_Out.Hex = _iValue; break;
- case SI_CHANNEL_3_IN_HI: g_Channel[3].m_InHi.Hex = _iValue; break;
- case SI_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break;
-
- case SI_POLL:
- INFO_LOG(SERIALINTERFACE, "Wrote Poll: X=%03d Y=%03d %s%s%s%s%s%s%s%s",
- g_Poll.X, g_Poll.Y,
- g_Poll.EN0 ? "EN0 ":" ", g_Poll.EN1 ? "EN1 ":" ",
- g_Poll.EN2 ? "EN2 ":" ", g_Poll.EN3 ? "EN3 ":" ",
- g_Poll.VBCPY0 ? "VBCPY0 ":" ", g_Poll.VBCPY1 ? "VBCPY1 ":" ",
- g_Poll.VBCPY2 ? "VBCPY2 ":" ", g_Poll.VBCPY3 ? "VBCPY3 ":" ");
- g_Poll.Hex = _iValue;
- break;
-
- case SI_COM_CSR:
- {
- USIComCSR tmpComCSR(_iValue);
-
- g_ComCSR.CHANNEL = tmpComCSR.CHANNEL;
- g_ComCSR.INLNGTH = tmpComCSR.INLNGTH;
- g_ComCSR.OUTLNGTH = tmpComCSR.OUTLNGTH;
+ g_ComCSR.CHANNEL = tmpComCSR.CHANNEL;
+ g_ComCSR.INLNGTH = tmpComCSR.INLNGTH;
+ g_ComCSR.OUTLNGTH = tmpComCSR.OUTLNGTH;
g_ComCSR.RDSTINTMSK = tmpComCSR.RDSTINTMSK;
- g_ComCSR.TCINTMSK = tmpComCSR.TCINTMSK;
+ g_ComCSR.TCINTMSK = tmpComCSR.TCINTMSK;
- g_ComCSR.COMERR = 0;
+ g_ComCSR.COMERR = 0;
- if (tmpComCSR.RDSTINT) g_ComCSR.RDSTINT = 0;
- if (tmpComCSR.TCINT) g_ComCSR.TCINT = 0;
+ if (tmpComCSR.RDSTINT) g_ComCSR.RDSTINT = 0;
+ if (tmpComCSR.TCINT) g_ComCSR.TCINT = 0;
// be careful: run si-buffer after updating the INT flags
- if (tmpComCSR.TSTART) RunSIBuffer();
+ if (tmpComCSR.TSTART) RunSIBuffer();
UpdateInterrupts();
- }
- break;
+ })
+ );
- case SI_STATUS_REG:
- {
- USIStatusReg tmpStatus(_iValue);
+ mmio->Register(base | SI_STATUS_REG,
+ MMIO::DirectRead<u32>(&g_StatusReg.Hex),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ USIStatusReg tmpStatus(val);
// clear bits ( if(tmp.bit) SISR.bit=0 )
- if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0;
- if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0;
- if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0;
- if (tmpStatus.UNRUN0) g_StatusReg.UNRUN0 = 0;
-
- if (tmpStatus.NOREP1) g_StatusReg.NOREP1 = 0;
- if (tmpStatus.COLL1) g_StatusReg.COLL1 = 0;
- if (tmpStatus.OVRUN1) g_StatusReg.OVRUN1 = 0;
- if (tmpStatus.UNRUN1) g_StatusReg.UNRUN1 = 0;
-
- if (tmpStatus.NOREP2) g_StatusReg.NOREP2 = 0;
- if (tmpStatus.COLL2) g_StatusReg.COLL2 = 0;
- if (tmpStatus.OVRUN2) g_StatusReg.OVRUN2 = 0;
- if (tmpStatus.UNRUN2) g_StatusReg.UNRUN2 = 0;
-
- if (tmpStatus.NOREP3) g_StatusReg.NOREP3 = 0;
- if (tmpStatus.COLL3) g_StatusReg.COLL3 = 0;
- if (tmpStatus.OVRUN3) g_StatusReg.OVRUN3 = 0;
- if (tmpStatus.UNRUN3) g_StatusReg.UNRUN3 = 0;
+ if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0;
+ if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0;
+ if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0;
+ if (tmpStatus.UNRUN0) g_StatusReg.UNRUN0 = 0;
+
+ if (tmpStatus.NOREP1) g_StatusReg.NOREP1 = 0;
+ if (tmpStatus.COLL1) g_StatusReg.COLL1 = 0;
+ if (tmpStatus.OVRUN1) g_StatusReg.OVRUN1 = 0;
+ if (tmpStatus.UNRUN1) g_StatusReg.UNRUN1 = 0;
+
+ if (tmpStatus.NOREP2) g_StatusReg.NOREP2 = 0;
+ if (tmpStatus.COLL2) g_StatusReg.COLL2 = 0;
+ if (tmpStatus.OVRUN2) g_StatusReg.OVRUN2 = 0;
+ if (tmpStatus.UNRUN2) g_StatusReg.UNRUN2 = 0;
+
+ if (tmpStatus.NOREP3) g_StatusReg.NOREP3 = 0;
+ if (tmpStatus.COLL3) g_StatusReg.COLL3 = 0;
+ if (tmpStatus.OVRUN3) g_StatusReg.OVRUN3 = 0;
+ if (tmpStatus.UNRUN3) g_StatusReg.UNRUN3 = 0;
// send command to devices
if (tmpStatus.WR)
@@ -489,21 +390,13 @@ void Write32(const u32 _iValue, const u32 _iAddress)
g_StatusReg.WRST2 = 0;
g_StatusReg.WRST3 = 0;
}
- }
- break;
-
- case SI_EXI_CLOCK_COUNT:
- g_EXIClockCount.Hex = _iValue;
- break;
+ })
+ );
- case 0x80: // Bogus? never seen it with ma own eyes
- INFO_LOG(SERIALINTERFACE, "WII something at 0xCD006480");
- break;
-
- default:
- _dbg_assert_(SERIALINTERFACE, 0);
- break;
- }
+ mmio->Register(base | SI_EXI_CLOCK_COUNT,
+ MMIO::DirectRead<u32>(&g_EXIClockCount.Hex),
+ MMIO::DirectWrite<u32>(&g_EXIClockCount.Hex)
+ );
}
void UpdateInterrupts()
@@ -516,8 +409,8 @@ void UpdateInterrupts()
g_ComCSR.RDSTINT = 0;
// check if we have to generate an interrupt
- if ((g_ComCSR.RDSTINT & g_ComCSR.RDSTINTMSK) ||
- (g_ComCSR.TCINT & g_ComCSR.TCINTMSK))
+ if ((g_ComCSR.RDSTINT & g_ComCSR.RDSTINTMSK) ||
+ (g_ComCSR.TCINT & g_ComCSR.TCINTMSK))
{
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_SI, true);
}
@@ -531,8 +424,8 @@ void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
{
switch(_SIInterrupt)
{
- case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
- case INT_TCINT: g_ComCSR.TCINT = 1; break;
+ case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
+ case INT_TCINT: g_ComCSR.TCINT = 1; break;
}
UpdateInterrupts();
diff --git a/Source/Core/Core/HW/SI.h b/Source/Core/Core/HW/SI.h
index c2225a2..4d14f76 100644
--- a/Source/Core/Core/HW/SI.h
+++ b/Source/Core/Core/HW/SI.h
@@ -4,10 +4,12 @@
#pragma once
-#include "Common.h"
-#include "SI_Device.h"
+#include "Common/Common.h"
+#include "Core/HW/SI_Device.h"
+
class PointerWrap;
class ISIDevice;
+namespace MMIO { class Mapping; }
// SI number of channels
enum
@@ -22,6 +24,8 @@ void Init();
void Shutdown();
void DoState(PointerWrap &p);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
void UpdateDevices();
void RemoveDevice(int _iDeviceNumber);
@@ -31,9 +35,6 @@ void AddDevice(ISIDevice* pDevice);
void ChangeDeviceCallback(u64 userdata, int cyclesLate);
void ChangeDevice(SIDevices device, int channel);
-void Read32(u32& _uReturnValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
-
int GetTicksToNextSIPoll();
}; // end of namespace SerialInterface
diff --git a/Source/Core/Core/HW/SI_Device.cpp b/Source/Core/Core/HW/SI_Device.cpp
index ee0e649..01a173b 100644
--- a/Source/Core/Core/HW/SI_Device.cpp
+++ b/Source/Core/Core/HW/SI_Device.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SI_Device.h"
-#include "SI_DeviceGCController.h"
-#include "SI_DeviceGCSteeringWheel.h"
-#include "SI_DeviceDanceMat.h"
-#include "SI_DeviceGBA.h"
-#include "SI_DeviceAMBaseboard.h"
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceAMBaseboard.h"
+#include "Core/HW/SI_DeviceDanceMat.h"
+#include "Core/HW/SI_DeviceGBA.h"
+#include "Core/HW/SI_DeviceGCController.h"
+#include "Core/HW/SI_DeviceGCSteeringWheel.h"
// --- interface ISIDevice ---
diff --git a/Source/Core/Core/HW/SI_Device.h b/Source/Core/Core/HW/SI_Device.h
index a091298..5c819dc 100644
--- a/Source/Core/Core/HW/SI_Device.h
+++ b/Source/Core/Core/HW/SI_Device.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
class PointerWrap;
diff --git a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp
index 96d3fba..49f3f60 100644
--- a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp
+++ b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp
@@ -2,13 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceAMBaseboard.h"
-#include "SI.h"
-#include "SI_Device.h"
-#include "SI_DeviceAMBaseboard.h"
-
-#include "GCPadStatus.h"
-#include "GCPad.h"
+#include "Core/HW/GCPad.h"
+#include "InputCommon/GCPadStatus.h"
// where to put baseboard debug
#define AMBASEBOARDDEBUG OSREPORT
diff --git a/Source/Core/Core/HW/SI_DeviceDanceMat.cpp b/Source/Core/Core/HW/SI_DeviceDanceMat.cpp
index 72420ab..40405b6 100644
--- a/Source/Core/Core/HW/SI_DeviceDanceMat.cpp
+++ b/Source/Core/Core/HW/SI_DeviceDanceMat.cpp
@@ -2,21 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SI.h"
-#include "SI_Device.h"
-#include "SI_DeviceDanceMat.h"
-
-#include "EXI_Device.h"
-#include "EXI_DeviceMic.h"
-
-#include "GCPad.h"
-
-#include "../Movie.h"
-
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-#include "ProcessorInterface.h"
-#include "../Core.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceMic.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceDanceMat.h"
+#include "Core/HW/SystemTimers.h"
// --- Dance mat gamecube controller ---
CSIDevice_DanceMat::CSIDevice_DanceMat(SIDevices device, int _iDeviceNumber)
@@ -26,16 +22,16 @@ CSIDevice_DanceMat::CSIDevice_DanceMat(SIDevices device, int _iDeviceNumber)
, m_LastButtonCombo(COMBO_NONE)
{
memset(&m_Origin, 0, sizeof(SOrigin));
- m_Origin.uCommand = CMD_ORIGIN;
- m_Origin.uOriginStickX = 0x80; // center
- m_Origin.uOriginStickY = 0x80;
- m_Origin.uSubStickStickX = 0x80;
- m_Origin.uSubStickStickY = 0x80;
- m_Origin.uTrigger_L = 0x00;
- m_Origin.uTrigger_R = 0x00;
+ m_Origin.uCommand = CMD_ORIGIN;
+ m_Origin.uOriginStickX = 0x80; // center
+ m_Origin.uOriginStickY = 0x80;
+ m_Origin.uSubStickStickX = 0x80;
+ m_Origin.uSubStickStickY = 0x80;
+ m_Origin.uTrigger_L = 0x00;
+ m_Origin.uTrigger_R = 0x00;
// Dunno if we need to do this, game/lib should set it?
- m_Mode = 0x03;
+ m_Mode = 0x03;
}
int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength)
@@ -60,8 +56,8 @@ int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength)
GetData(high, low);
for (int i = 0; i < (_iLength - 1) / 2; i++)
{
- _pBuffer[0 + i] = (high >> (i * 8)) & 0xff;
- _pBuffer[4 + i] = (low >> (i * 8)) & 0xff;
+ _pBuffer[i + 0] = (high >> (i * 8)) & 0xff;
+ _pBuffer[i + 4] = (low >> (i * 8)) & 0xff;
}
}
break;
@@ -119,8 +115,8 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{
- _Hi = netValues[0]; // first 4 bytes
- _Low = netValues[1]; // last 4 bytes
+ _Hi = netValues[0]; // first 4 bytes
+ _Low = netValues[1]; // last 4 bytes
return true;
}
@@ -170,21 +166,21 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
}
else if (m_Mode == 1)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
}
else if (m_Mode == 2)
{
@@ -194,18 +190,18 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
else if (m_Mode == 3)
{
// Analog A/B are always 0
- _Low = (u8)PadStatus.triggerRight; // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low = (u8)PadStatus.triggerRight; // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
else if (m_Mode == 4)
{
- _Low = (u8)(PadStatus.analogB); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
+ _Low = (u8)(PadStatus.analogB); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
return true;
}
diff --git a/Source/Core/Core/HW/SI_DeviceDanceMat.h b/Source/Core/Core/HW/SI_DeviceDanceMat.h
index 6fd73c3..2185d84 100644
--- a/Source/Core/Core/HW/SI_DeviceDanceMat.h
+++ b/Source/Core/Core/HW/SI_DeviceDanceMat.h
@@ -4,9 +4,8 @@
#pragma once
-#include "SI_Device.h"
-#include "GCPadStatus.h"
-
+#include "Core/HW/SI_Device.h"
+#include "InputCommon/GCPadStatus.h"
// standard gamecube controller
class CSIDevice_DanceMat : public ISIDevice
diff --git a/Source/Core/Core/HW/SI_DeviceGBA.cpp b/Source/Core/Core/HW/SI_DeviceGBA.cpp
index 754c17d..0e83744 100644
--- a/Source/Core/Core/HW/SI_DeviceGBA.cpp
+++ b/Source/Core/Core/HW/SI_DeviceGBA.cpp
@@ -2,12 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SI_Device.h"
-#include "SI_DeviceGBA.h"
+#include <queue>
#include "SFML/Network.hpp"
-#include "Thread.h"
-#include <queue>
+
+#include "Common/Thread.h"
+
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceGBA.h"
static std::thread connectionThread;
static std::queue<sf::SocketTCP> waiting_socks;
diff --git a/Source/Core/Core/HW/SI_DeviceGCController.cpp b/Source/Core/Core/HW/SI_DeviceGCController.cpp
index 2db017d..09129f9 100644
--- a/Source/Core/Core/HW/SI_DeviceGCController.cpp
+++ b/Source/Core/Core/HW/SI_DeviceGCController.cpp
@@ -2,21 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SI.h"
-#include "SI_Device.h"
-#include "SI_DeviceGCController.h"
-
-#include "EXI_Device.h"
-#include "EXI_DeviceMic.h"
-
-#include "GCPad.h"
-
-#include "../Movie.h"
-
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-#include "ProcessorInterface.h"
-#include "../Core.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceMic.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceGCController.h"
+#include "Core/HW/SystemTimers.h"
// --- standard gamecube controller ---
CSIDevice_GCController::CSIDevice_GCController(SIDevices device, int _iDeviceNumber)
@@ -26,16 +22,16 @@ CSIDevice_GCController::CSIDevice_GCController(SIDevices device, int _iDeviceNum
, m_LastButtonCombo(COMBO_NONE)
{
memset(&m_Origin, 0, sizeof(SOrigin));
- m_Origin.uCommand = CMD_ORIGIN;
- m_Origin.uOriginStickX = 0x80; // center
- m_Origin.uOriginStickY = 0x80;
- m_Origin.uSubStickStickX = 0x80;
- m_Origin.uSubStickStickY = 0x80;
- m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
- m_Origin.uTrigger_R = 0x1F;
+ m_Origin.uCommand = CMD_ORIGIN;
+ m_Origin.uOriginStickX = 0x80; // center
+ m_Origin.uOriginStickY = 0x80;
+ m_Origin.uSubStickStickX = 0x80;
+ m_Origin.uSubStickStickY = 0x80;
+ m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
+ m_Origin.uTrigger_R = 0x1F;
// Dunno if we need to do this, game/lib should set it?
- m_Mode = 0x03;
+ m_Mode = 0x03;
}
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
@@ -60,8 +56,8 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
GetData(high, low);
for (int i = 0; i < (_iLength - 1) / 2; i++)
{
- _pBuffer[0 + i] = (high >> (i * 8)) & 0xff;
- _pBuffer[4 + i] = (low >> (i * 8)) & 0xff;
+ _pBuffer[i + 0] = (high >> (i * 8)) & 0xff;
+ _pBuffer[i + 4] = (low >> (i * 8)) & 0xff;
}
}
break;
@@ -119,8 +115,8 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{
- _Hi = netValues[0]; // first 4 bytes
- _Low = netValues[1]; // last 4 bytes
+ _Hi = netValues[0]; // first 4 bytes
+ _Low = netValues[1]; // last 4 bytes
return true;
}
@@ -149,46 +145,46 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
}
else if (m_Mode == 1)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
}
else if (m_Mode == 2)
{
- _Low = (u8)(PadStatus.analogB); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
+ _Low = (u8)(PadStatus.analogB); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
}
else if (m_Mode == 3)
{
// Analog A/B are always 0
- _Low = (u8)PadStatus.triggerRight; // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low = (u8)PadStatus.triggerRight; // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
else if (m_Mode == 4)
{
- _Low = (u8)(PadStatus.analogB); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
+ _Low = (u8)(PadStatus.analogB); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
// Keep track of the special button combos (embedded in controller hardware... :( )
@@ -214,12 +210,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
ProcessorInterface::ResetButton_Tap();
else if (m_LastButtonCombo == COMBO_ORIGIN)
{
- m_Origin.uOriginStickX = PadStatus.stickX;
- m_Origin.uOriginStickY = PadStatus.stickY;
- m_Origin.uSubStickStickX = PadStatus.substickX;
- m_Origin.uSubStickStickY = PadStatus.substickY;
- m_Origin.uTrigger_L = PadStatus.triggerLeft;
- m_Origin.uTrigger_R = PadStatus.triggerRight;
+ m_Origin.uOriginStickX = PadStatus.stickX;
+ m_Origin.uOriginStickY = PadStatus.stickY;
+ m_Origin.uSubStickStickX = PadStatus.substickX;
+ m_Origin.uSubStickStickY = PadStatus.substickY;
+ m_Origin.uTrigger_L = PadStatus.triggerLeft;
+ m_Origin.uTrigger_R = PadStatus.triggerRight;
}
m_LastButtonCombo = COMBO_NONE;
}
diff --git a/Source/Core/Core/HW/SI_DeviceGCController.h b/Source/Core/Core/HW/SI_DeviceGCController.h
index e5b1405..9c00822 100644
--- a/Source/Core/Core/HW/SI_DeviceGCController.h
+++ b/Source/Core/Core/HW/SI_DeviceGCController.h
@@ -4,8 +4,8 @@
#pragma once
-#include "SI_Device.h"
-#include "GCPadStatus.h"
+#include "Core/HW/SI_Device.h"
+#include "InputCommon/GCPadStatus.h"
// standard gamecube controller
diff --git a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp
index 322b0bc..3eb4308 100644
--- a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp
+++ b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp
@@ -2,21 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SI.h"
-#include "SI_Device.h"
-#include "SI_DeviceGCSteeringWheel.h"
-#include "EXI_Device.h"
-#include "EXI_DeviceMic.h"
-
-#include "GCPad.h"
-
-#include "../Movie.h"
-
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-#include "ProcessorInterface.h"
-#include "../Core.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/EXI_DeviceMic.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_Device.h"
+#include "Core/HW/SI_DeviceGCSteeringWheel.h"
+#include "Core/HW/SystemTimers.h"
// --- standard gamecube controller ---
CSIDevice_GCSteeringWheel::CSIDevice_GCSteeringWheel(SIDevices device, int _iDeviceNumber)
@@ -26,16 +23,16 @@ CSIDevice_GCSteeringWheel::CSIDevice_GCSteeringWheel(SIDevices device, int _iDev
, m_LastButtonCombo(COMBO_NONE)
{
memset(&m_Origin, 0, sizeof(SOrigin));
- m_Origin.uCommand = CMD_ORIGIN;
- m_Origin.uOriginStickX = 0x80; // center
- m_Origin.uOriginStickY = 0x80;
- m_Origin.uSubStickStickX = 0x80;
- m_Origin.uSubStickStickY = 0x80;
- m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
- m_Origin.uTrigger_R = 0x1F;
+ m_Origin.uCommand = CMD_ORIGIN;
+ m_Origin.uOriginStickX = 0x80; // center
+ m_Origin.uOriginStickY = 0x80;
+ m_Origin.uSubStickStickX = 0x80;
+ m_Origin.uSubStickStickY = 0x80;
+ m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
+ m_Origin.uTrigger_R = 0x1F;
// Dunno if we need to do this, game/lib should set it?
- m_Mode = 0x03;
+ m_Mode = 0x03;
}
int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength)
@@ -109,8 +106,8 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{
- _Hi = netValues[0]; // first 4 bytes
- _Low = netValues[1]; // last 4 bytes
+ _Hi = netValues[0]; // first 4 bytes
+ _Low = netValues[1]; // last 4 bytes
return true;
}
@@ -139,51 +136,51 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 7)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
}
else if (m_Mode == 1)
{
- _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
+ _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
}
else if (m_Mode == 2)
{
- _Low = (u8)(PadStatus.analogB); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
- _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
- _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
+ _Low = (u8)(PadStatus.analogB); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
+ _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
}
else if (m_Mode == 3)
{
// Analog A/B are always 0
- _Low = (u8)PadStatus.triggerRight; // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low = (u8)PadStatus.triggerRight; // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
else if (m_Mode == 4)
{
- _Low = (u8)(PadStatus.analogB); // All 8 bits
- _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
+ _Low = (u8)(PadStatus.analogB); // All 8 bits
+ _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0
- _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
- _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
+ _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
}
else if (m_Mode == 6)
{
- _Low = (u8)PadStatus.triggerRight; // All 8 bits
- _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
+ _Low = (u8)PadStatus.triggerRight; // All 8 bits
+ _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
// The GC Steering Wheel appears to have combined pedals
// (both the Accelerate and Brake pedals are mapped to a single axis)
@@ -219,12 +216,12 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
}
else if (m_LastButtonCombo == COMBO_ORIGIN)
{
- m_Origin.uOriginStickX = PadStatus.stickX;
- m_Origin.uOriginStickY = PadStatus.stickY;
- m_Origin.uSubStickStickX = PadStatus.substickX;
- m_Origin.uSubStickStickY = PadStatus.substickY;
- m_Origin.uTrigger_L = PadStatus.triggerLeft;
- m_Origin.uTrigger_R = PadStatus.triggerRight;
+ m_Origin.uOriginStickX = PadStatus.stickX;
+ m_Origin.uOriginStickY = PadStatus.stickY;
+ m_Origin.uSubStickStickX = PadStatus.substickX;
+ m_Origin.uSubStickStickY = PadStatus.substickY;
+ m_Origin.uTrigger_L = PadStatus.triggerLeft;
+ m_Origin.uTrigger_R = PadStatus.triggerRight;
}
m_LastButtonCombo = COMBO_NONE;
}
diff --git a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.h b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.h
index 2a67728..78757d2 100644
--- a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.h
+++ b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.h
@@ -4,9 +4,8 @@
#pragma once
-#include "SI_Device.h"
-#include "GCPadStatus.h"
-
+#include "Core/HW/SI_Device.h"
+#include "InputCommon/GCPadStatus.h"
// standard gamecube controller
class CSIDevice_GCSteeringWheel : public ISIDevice
diff --git a/Source/Core/Core/HW/Sram.cpp b/Source/Core/Core/HW/Sram.cpp
index 8c13579..e1368be 100644
--- a/Source/Core/Core/HW/Sram.cpp
+++ b/Source/Core/Core/HW/Sram.cpp
@@ -2,8 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Sram.h"
-#include "../ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/Sram.h"
+
// english
SRAM sram_dump = {{
0x04, 0x6B,
@@ -41,7 +42,7 @@ SRAM sram_dump_german = {{
0x00,
0x01,
0x3C,
- 0x12, 0xD5, 0xEA, 0xD3, 0x00, 0xFA, 0x2D, 0x33, 0x13, 0x41, 0x26, 0x03,
+ 0x12, 0xD5, 0xEA, 0xD3, 0x00, 0xFA, 0x2D, 0x33, 0x13, 0x41, 0x26, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
diff --git a/Source/Core/Core/HW/Sram.h b/Source/Core/Core/HW/Sram.h
index f678cd8..da71b62 100644
--- a/Source/Core/Core/HW/Sram.h
+++ b/Source/Core/Core/HW/Sram.h
@@ -20,22 +20,22 @@ Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
-1. The origin of this software must not be misrepresented; you
+1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and
+2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source
+3. This notice may not be removed or altered from any source
distribution.
-------------------------------------------------------------*/
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
#pragma pack(push,1)
union SRAM
diff --git a/Source/Core/Core/HW/StreamADPCM.cpp b/Source/Core/Core/HW/StreamADPCM.cpp
index 4dc9109..e041267 100644
--- a/Source/Core/Core/HW/StreamADPCM.cpp
+++ b/Source/Core/Core/HW/StreamADPCM.cpp
@@ -4,8 +4,8 @@
// Adapted from in_cube by hcs & destop
-#include "StreamADPCM.h"
-#include "MathUtil.h"
+#include "Common/MathUtil.h"
+#include "Core/HW/StreamADPCM.h"
// STATE_TO_SAVE (not saved yet!)
static s32 histl1;
diff --git a/Source/Core/Core/HW/StreamADPCM.h b/Source/Core/Core/HW/StreamADPCM.h
index 5a1f836..14384b0 100644
--- a/Source/Core/Core/HW/StreamADPCM.h
+++ b/Source/Core/Core/HW/StreamADPCM.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
class NGCADPCM
{
diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp
index 12c2897..d6fe5e6 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -56,26 +56,27 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule:
CWII_IPC_HLE_WiiMote::Update()
*/
-
-#include "Common.h"
-#include "Atomic.h"
-#include "../PatchEngine.h"
-#include "SystemTimers.h"
-#include "DSP.h"
-#include "AudioInterface.h"
-#include "VideoInterface.h"
-#include "SI.h"
-#include "EXI_DeviceIPL.h"
-#include "../PowerPC/PowerPC.h"
-#include "../CoreTiming.h"
-#include "../ConfigManager.h"
-#include "../IPC_HLE/WII_IPC_HLE.h"
-#include "../DSPEmulator.h"
-#include "Thread.h"
-#include "Timer.h"
-#include "VideoBackendBase.h"
-#include "CommandProcessor.h"
-#include "Host.h"
+#include "Common/Atomic.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/CoreTiming.h"
+#include "Core/ConfigManager.h"
+#include "Core/DSPEmulator.h"
+#include "Core/Host.h"
+#include "Core/PatchEngine.h"
+#include "Core/HW/AudioInterface.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/EXI_DeviceIPL.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/VideoBackendBase.h"
namespace SystemTimers
@@ -84,18 +85,18 @@ namespace SystemTimers
u32 CPU_CORE_CLOCK = 486000000u; // 486 mhz (its not 485, stop bugging me!)
/*
-Gamecube MHz
-flipper <-> ARAM bus: 81 (DSP)
-gekko <-> flipper bus: 162
-flipper <-> 1T-SRAM bus: 324
-gekko: 486
+Gamecube MHz
+flipper <-> ARAM bus: 81 (DSP)
+gekko <-> flipper bus: 162
+flipper <-> 1T-SRAM bus: 324
+gekko: 486
These contain some guesses:
-Wii MHz
-hollywood <-> GDDR3 RAM bus: ??? no idea really
-broadway <-> hollywood bus: 243
-hollywood <-> 1T-SRAM bus: 486
-broadway: 729
+Wii MHz
+hollywood <-> GDDR3 RAM bus: ??? no idea really
+broadway <-> hollywood bus: 243
+hollywood <-> 1T-SRAM bus: 486
+broadway: 729
*/
// Ratio of TB and Decrementer to clock cycles.
// TB clk is 1/4 of BUS clk. And it seems BUS clk is really 1/3 of CPU clk.
@@ -115,7 +116,7 @@ int et_CP;
int et_AudioDMA;
int et_DSP;
int et_IPC_HLE;
-int et_PatchEngine; // PatchEngine updates every 1/60th of a second by default
+int et_PatchEngine; // PatchEngine updates every 1/60th of a second by default
int et_Throttle;
// These are badly educated guesses
@@ -246,7 +247,7 @@ void ThrottleCallback(u64 last_time, int cyclesLate)
const int max_fallback = 40; // 40 ms for one frame on 25 fps games
if (frame_limiter && abs(diff) > max_fallback)
{
- WARN_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
+ DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
last_time = time - max_fallback;
}
else if (frame_limiter && diff > 0)
diff --git a/Source/Core/Core/HW/SystemTimers.h b/Source/Core/Core/HW/SystemTimers.h
index ff7e59f..d4b2073 100644
--- a/Source/Core/Core/HW/SystemTimers.h
+++ b/Source/Core/Core/HW/SystemTimers.h
@@ -17,7 +17,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
namespace SystemTimers
{
diff --git a/Source/Core/Core/HW/VideoInterface.cpp b/Source/Core/Core/HW/VideoInterface.cpp
index d01d19d..d4807fc 100644
--- a/Source/Core/Core/HW/VideoInterface.cpp
+++ b/Source/Core/Core/HW/VideoInterface.cpp
@@ -2,50 +2,51 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "ChunkFile.h"
-
-#include "../PowerPC/PowerPC.h"
-#include "../Core.h"
-#include "ProcessorInterface.h"
-#include "VideoInterface.h"
-#include "Memmap.h"
-#include "../CoreTiming.h"
-#include "SystemTimers.h"
-#include "StringUtil.h"
-
-#include "VideoBackendBase.h"
-#include "State.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/State.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace VideoInterface
{
// STATE_TO_SAVE
// Registers listed in order:
-static UVIVerticalTimingRegister m_VerticalTimingRegister;
-static UVIDisplayControlRegister m_DisplayControlRegister;
-static UVIHorizontalTiming0 m_HTiming0;
-static UVIHorizontalTiming1 m_HTiming1;
-static UVIVBlankTimingRegister m_VBlankTimingOdd;
-static UVIVBlankTimingRegister m_VBlankTimingEven;
-static UVIBurstBlankingRegister m_BurstBlankingOdd;
-static UVIBurstBlankingRegister m_BurstBlankingEven;
-static UVIFBInfoRegister m_XFBInfoTop;
-static UVIFBInfoRegister m_XFBInfoBottom;
-static UVIFBInfoRegister m_3DFBInfoTop; // Start making your stereoscopic demos! :p
-static UVIFBInfoRegister m_3DFBInfoBottom;
-static u16 m_VBeamPos = 0; // 0: Inactive
-static u16 m_HBeamPos = 0; // 0: Inactive
-static UVIInterruptRegister m_InterruptRegister[4];
-static UVILatchRegister m_LatchRegister[2];
-static UVIHorizontalStepping m_HorizontalStepping;
-static UVIHorizontalScaling m_HorizontalScaling;
-static SVIFilterCoefTables m_FilterCoefTables;
-static u32 m_UnkAARegister = 0;// ??? 0x00FF0000
-static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz
-static UVIDTVStatus m_DTVStatus;
-static u16 m_FBWidth = 0; // Only correct when scaling is enabled?
-static UVIBorderBlankRegister m_BorderHBlank;
+static UVIVerticalTimingRegister m_VerticalTimingRegister;
+static UVIDisplayControlRegister m_DisplayControlRegister;
+static UVIHorizontalTiming0 m_HTiming0;
+static UVIHorizontalTiming1 m_HTiming1;
+static UVIVBlankTimingRegister m_VBlankTimingOdd;
+static UVIVBlankTimingRegister m_VBlankTimingEven;
+static UVIBurstBlankingRegister m_BurstBlankingOdd;
+static UVIBurstBlankingRegister m_BurstBlankingEven;
+static UVIFBInfoRegister m_XFBInfoTop;
+static UVIFBInfoRegister m_XFBInfoBottom;
+static UVIFBInfoRegister m_3DFBInfoTop; // Start making your stereoscopic demos! :p
+static UVIFBInfoRegister m_3DFBInfoBottom;
+static u16 m_VBeamPos = 0; // 0: Inactive
+static u16 m_HBeamPos = 0; // 0: Inactive
+static UVIInterruptRegister m_InterruptRegister[4];
+static UVILatchRegister m_LatchRegister[2];
+static UVIHorizontalStepping m_HorizontalStepping;
+static UVIHorizontalScaling m_HorizontalScaling;
+static SVIFilterCoefTables m_FilterCoefTables;
+static u32 m_UnkAARegister = 0;// ??? 0x00FF0000
+static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz
+static UVIDTVStatus m_DTVStatus;
+static u16 m_FBWidth = 0; // Only correct when scaling is enabled?
+static UVIBorderBlankRegister m_BorderHBlank;
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
// 0xcc002080 - 0xcc002100 even more unknown
@@ -182,268 +183,171 @@ void Init()
UpdateParameters();
}
-void SetRegionReg(char region)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- if (!Core::g_CoreStartupParameter.bForceNTSCJ)
- m_DTVStatus.ntsc_j = region == 'J';
-}
-
-void Read8(u8& _uReturnValue, const u32 _iAddress)
-{
- // Just like 32bit VI transfers, this is technically not allowed,
- // but the hardware accepts it. Action Replay uses this.
- u16 val = 0;
-
- if ((_iAddress & 1) == 0)
- {
- Read16(val, _iAddress);
- _uReturnValue = (u8)(val >> 8);
- }
- else
+ struct {
+ u32 addr;
+ u16* ptr;
+ } directly_mapped_vars[] = {
+ { VI_VERTICAL_TIMING, &m_VerticalTimingRegister.Hex },
+ { VI_HORIZONTAL_TIMING_0_HI, &m_HTiming0.Hi },
+ { VI_HORIZONTAL_TIMING_0_LO, &m_HTiming0.Lo },
+ { VI_HORIZONTAL_TIMING_1_HI, &m_HTiming1.Hi },
+ { VI_HORIZONTAL_TIMING_1_LO, &m_HTiming1.Lo },
+ { VI_VBLANK_TIMING_ODD_HI, &m_VBlankTimingOdd.Hi },
+ { VI_VBLANK_TIMING_ODD_LO, &m_VBlankTimingOdd.Lo },
+ { VI_VBLANK_TIMING_EVEN_HI, &m_VBlankTimingEven.Hi },
+ { VI_VBLANK_TIMING_EVEN_LO, &m_VBlankTimingEven.Lo },
+ { VI_BURST_BLANKING_ODD_HI, &m_BurstBlankingOdd.Hi },
+ { VI_BURST_BLANKING_ODD_LO, &m_BurstBlankingOdd.Lo },
+ { VI_BURST_BLANKING_EVEN_HI, &m_BurstBlankingEven.Hi },
+ { VI_BURST_BLANKING_EVEN_LO, &m_BurstBlankingEven.Lo },
+ { VI_FB_LEFT_TOP_LO, &m_XFBInfoTop.Lo },
+ { VI_FB_RIGHT_TOP_LO, &m_3DFBInfoTop.Lo },
+ { VI_FB_LEFT_BOTTOM_LO, &m_XFBInfoBottom.Lo },
+ { VI_FB_RIGHT_BOTTOM_LO, &m_3DFBInfoBottom.Lo },
+ { VI_PRERETRACE_LO, &m_InterruptRegister[0].Lo },
+ { VI_POSTRETRACE_LO, &m_InterruptRegister[1].Lo },
+ { VI_DISPLAY_INTERRUPT_2_LO, &m_InterruptRegister[2].Lo },
+ { VI_DISPLAY_INTERRUPT_3_LO, &m_InterruptRegister[3].Lo },
+ { VI_DISPLAY_LATCH_0_HI, &m_LatchRegister[0].Hi },
+ { VI_DISPLAY_LATCH_0_LO, &m_LatchRegister[0].Lo },
+ { VI_DISPLAY_LATCH_1_HI, &m_LatchRegister[1].Hi },
+ { VI_DISPLAY_LATCH_1_LO, &m_LatchRegister[1].Lo },
+ { VI_HSCALEW, &m_HorizontalStepping.Hex },
+ { VI_HSCALER, &m_HorizontalScaling.Hex },
+ { VI_FILTER_COEF_0_HI, &m_FilterCoefTables.Tables02[0].Hi },
+ { VI_FILTER_COEF_0_LO, &m_FilterCoefTables.Tables02[0].Lo },
+ { VI_FILTER_COEF_1_HI, &m_FilterCoefTables.Tables02[1].Hi },
+ { VI_FILTER_COEF_1_LO, &m_FilterCoefTables.Tables02[1].Lo },
+ { VI_FILTER_COEF_2_HI, &m_FilterCoefTables.Tables02[2].Hi },
+ { VI_FILTER_COEF_2_LO, &m_FilterCoefTables.Tables02[2].Lo },
+ { VI_FILTER_COEF_3_HI, &m_FilterCoefTables.Tables36[0].Hi },
+ { VI_FILTER_COEF_3_LO, &m_FilterCoefTables.Tables36[0].Lo },
+ { VI_FILTER_COEF_4_HI, &m_FilterCoefTables.Tables36[1].Hi },
+ { VI_FILTER_COEF_4_LO, &m_FilterCoefTables.Tables36[1].Lo },
+ { VI_FILTER_COEF_5_HI, &m_FilterCoefTables.Tables36[2].Hi },
+ { VI_FILTER_COEF_5_LO, &m_FilterCoefTables.Tables36[2].Lo },
+ { VI_FILTER_COEF_6_HI, &m_FilterCoefTables.Tables36[3].Hi },
+ { VI_FILTER_COEF_6_LO, &m_FilterCoefTables.Tables36[3].Lo },
+ { VI_CLOCK, &m_Clock },
+ { VI_DTV_STATUS, &m_DTVStatus.Hex },
+ { VI_FBWIDTH, &m_FBWidth },
+ { VI_BORDER_BLANK_END, &m_BorderHBlank.Lo },
+ { VI_BORDER_BLANK_START, &m_BorderHBlank.Hi },
+ };
+
+ // Declare all the boilerplate direct MMIOs.
+ for (auto& mapped_var : directly_mapped_vars)
{
- Read16(val, _iAddress - 1);
- _uReturnValue = (u8)val;
+ mmio->Register(base | mapped_var.addr,
+ MMIO::DirectRead<u16>(mapped_var.ptr),
+ MMIO::DirectWrite<u16>(mapped_var.ptr)
+ );
}
- INFO_LOG(VIDEOINTERFACE, "(r 8): 0x%02x, 0x%08x", _uReturnValue, _iAddress);
-}
-
-void Read16(u16& _uReturnValue, const u32 _iAddress)
-{
- switch (_iAddress & 0xFFF)
- {
- case VI_VERTICAL_TIMING:
- _uReturnValue = m_VerticalTimingRegister.Hex;
- return;
-
- case VI_CONTROL_REGISTER:
- _uReturnValue = m_DisplayControlRegister.Hex;
- return;
-
- case VI_HORIZONTAL_TIMING_0_HI:
- _uReturnValue = m_HTiming0.Hi;
- break;
- case VI_HORIZONTAL_TIMING_0_LO:
- _uReturnValue = m_HTiming0.Lo;
- break;
-
- case VI_HORIZONTAL_TIMING_1_HI:
- _uReturnValue = m_HTiming1.Hi;
- break;
- case VI_HORIZONTAL_TIMING_1_LO:
- _uReturnValue = m_HTiming1.Lo;
- break;
-
- case VI_VBLANK_TIMING_ODD_HI:
- _uReturnValue = m_VBlankTimingOdd.Hi;
- break;
- case VI_VBLANK_TIMING_ODD_LO:
- _uReturnValue = m_VBlankTimingOdd.Lo;
- break;
-
- case VI_VBLANK_TIMING_EVEN_HI:
- _uReturnValue = m_VBlankTimingEven.Hi;
- break;
- case VI_VBLANK_TIMING_EVEN_LO:
- _uReturnValue = m_VBlankTimingEven.Lo;
- break;
-
- case VI_BURST_BLANKING_ODD_HI:
- _uReturnValue = m_BurstBlankingOdd.Hi;
- break;
- case VI_BURST_BLANKING_ODD_LO:
- _uReturnValue = m_BurstBlankingOdd.Lo;
- break;
-
- case VI_BURST_BLANKING_EVEN_HI:
- _uReturnValue = m_BurstBlankingEven.Hi;
- break;
- case VI_BURST_BLANKING_EVEN_LO:
- _uReturnValue = m_BurstBlankingEven.Lo;
- break;
-
- case VI_FB_LEFT_TOP_HI:
- _uReturnValue = m_XFBInfoTop.Hi;
- break;
- case VI_FB_LEFT_TOP_LO:
- _uReturnValue = m_XFBInfoTop.Lo;
- break;
-
- case VI_FB_RIGHT_TOP_HI:
- _uReturnValue = m_3DFBInfoTop.Hi;
- break;
- case VI_FB_RIGHT_TOP_LO:
- _uReturnValue = m_3DFBInfoTop.Lo;
- break;
-
- case VI_FB_LEFT_BOTTOM_HI:
- _uReturnValue = m_XFBInfoBottom.Hi;
- break;
- case VI_FB_LEFT_BOTTOM_LO:
- _uReturnValue = m_XFBInfoBottom.Lo;
- break;
-
- case VI_FB_RIGHT_BOTTOM_HI:
- _uReturnValue = m_3DFBInfoBottom.Hi;
- break;
- case VI_FB_RIGHT_BOTTOM_LO:
- _uReturnValue = m_3DFBInfoBottom.Lo;
- break;
-
- case VI_VERTICAL_BEAM_POSITION:
- _uReturnValue = m_VBeamPos;
- return;
-
- case VI_HORIZONTAL_BEAM_POSITION:
- _uReturnValue = m_HBeamPos;
- return;
-
- // RETRACE STUFF ...
- case VI_PRERETRACE_HI:
- _uReturnValue = m_InterruptRegister[0].Hi;
- return;
- case VI_PRERETRACE_LO:
- _uReturnValue = m_InterruptRegister[0].Lo;
- return;
-
- case VI_POSTRETRACE_HI:
- _uReturnValue = m_InterruptRegister[1].Hi;
- return;
- case VI_POSTRETRACE_LO:
- _uReturnValue = m_InterruptRegister[1].Lo;
- return;
-
- case VI_DISPLAY_INTERRUPT_2_HI:
- _uReturnValue = m_InterruptRegister[2].Hi;
- return;
- case VI_DISPLAY_INTERRUPT_2_LO:
- _uReturnValue = m_InterruptRegister[2].Lo;
- return;
-
- case VI_DISPLAY_INTERRUPT_3_HI:
- _uReturnValue = m_InterruptRegister[3].Hi;
- return;
- case VI_DISPLAY_INTERRUPT_3_LO:
- _uReturnValue = m_InterruptRegister[3].Lo;
- return;
-
- case VI_DISPLAY_LATCH_0_HI:
- _uReturnValue = m_LatchRegister[0].Hi;
- break;
- case VI_DISPLAY_LATCH_0_LO:
- _uReturnValue = m_LatchRegister[0].Lo;
- break;
-
- case VI_DISPLAY_LATCH_1_HI:
- _uReturnValue = m_LatchRegister[1].Hi;
- break;
- case VI_DISPLAY_LATCH_1_LO:
- _uReturnValue = m_LatchRegister[1].Lo;
- break;
-
- case VI_HSCALEW:
- _uReturnValue = m_HorizontalStepping.Hex;
- break;
-
- case VI_HSCALER:
- _uReturnValue = m_HorizontalScaling.Hex;
- break;
-
- case VI_FILTER_COEF_0_HI:
- _uReturnValue = m_FilterCoefTables.Tables02[0].Hi;
- break;
- case VI_FILTER_COEF_0_LO:
- _uReturnValue = m_FilterCoefTables.Tables02[0].Lo;
- break;
- case VI_FILTER_COEF_1_HI:
- _uReturnValue = m_FilterCoefTables.Tables02[1].Hi;
- break;
- case VI_FILTER_COEF_1_LO:
- _uReturnValue = m_FilterCoefTables.Tables02[1].Lo;
- break;
- case VI_FILTER_COEF_2_HI:
- _uReturnValue = m_FilterCoefTables.Tables02[2].Hi;
- break;
- case VI_FILTER_COEF_2_LO:
- _uReturnValue = m_FilterCoefTables.Tables02[2].Lo;
- break;
- case VI_FILTER_COEF_3_HI:
- _uReturnValue = m_FilterCoefTables.Tables36[0].Hi;
- break;
- case VI_FILTER_COEF_3_LO:
- _uReturnValue = m_FilterCoefTables.Tables36[0].Lo;
- break;
- case VI_FILTER_COEF_4_HI:
- _uReturnValue = m_FilterCoefTables.Tables36[1].Hi;
- break;
- case VI_FILTER_COEF_4_LO:
- _uReturnValue = m_FilterCoefTables.Tables36[1].Lo;
- break;
- case VI_FILTER_COEF_5_HI:
- _uReturnValue = m_FilterCoefTables.Tables36[2].Hi;
- break;
- case VI_FILTER_COEF_5_LO:
- _uReturnValue = m_FilterCoefTables.Tables36[2].Lo;
- break;
- case VI_FILTER_COEF_6_HI:
- _uReturnValue = m_FilterCoefTables.Tables36[3].Hi;
- break;
- case VI_FILTER_COEF_6_LO:
- _uReturnValue = m_FilterCoefTables.Tables36[3].Lo;
- break;
-
- case VI_UNK_AA_REG_HI:
- _uReturnValue = (m_UnkAARegister & 0xffff0000) >> 16;
- WARN_LOG(VIDEOINTERFACE, "(r16) unknown AA register, not sure what it does :)");
- break;
- case VI_UNK_AA_REG_LO:
- _uReturnValue = m_UnkAARegister & 0x0000ffff;
- WARN_LOG(VIDEOINTERFACE, "(r16) unknown AA register, not sure what it does :)");
- break;
-
- case VI_CLOCK:
- _uReturnValue = m_Clock;
- break;
-
- case VI_DTV_STATUS:
- _uReturnValue = m_DTVStatus.Hex;
- break;
-
- case VI_FBWIDTH:
- _uReturnValue = m_FBWidth;
- break;
-
- case VI_BORDER_BLANK_END:
- _uReturnValue = m_BorderHBlank.Lo;
- break;
- case VI_BORDER_BLANK_START:
- _uReturnValue = m_BorderHBlank.Hi;
- break;
-
- default:
- ERROR_LOG(VIDEOINTERFACE, "(r16) unknown reg %x", _iAddress & 0xfff);
- _uReturnValue = 0x0;
- break;
- }
-
- DEBUG_LOG(VIDEOINTERFACE, "(r16): 0x%04x, 0x%08x", _uReturnValue, _iAddress);
-}
-
-void Write16(const u16 _iValue, const u32 _iAddress)
-{
- DEBUG_LOG(VIDEOINTERFACE, "(w16): 0x%04x, 0x%08x",_iValue,_iAddress);
-
- //Somewhere it sets screen width.. we need to communicate this to the gfx backend...
-
- switch (_iAddress & 0xFFF)
- {
- case VI_VERTICAL_TIMING:
- m_VerticalTimingRegister.Hex = _iValue;
- break;
-
- case VI_CONTROL_REGISTER:
- {
- UVIDisplayControlRegister tmpConfig(_iValue);
+ // XFB related MMIOs that require special handling on writes.
+ mmio->Register(base | VI_FB_LEFT_TOP_HI,
+ MMIO::DirectRead<u16>(&m_XFBInfoTop.Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_XFBInfoTop.Hi = val;
+ if (m_XFBInfoTop.CLRPOFF) m_XFBInfoTop.POFF = 0;
+ })
+ );
+ mmio->Register(base | VI_FB_LEFT_BOTTOM_HI,
+ MMIO::DirectRead<u16>(&m_XFBInfoBottom.Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_XFBInfoBottom.Hi = val;
+ if (m_XFBInfoBottom.CLRPOFF) m_XFBInfoBottom.POFF = 0;
+ })
+ );
+ mmio->Register(base | VI_FB_RIGHT_TOP_HI,
+ MMIO::DirectRead<u16>(&m_3DFBInfoTop.Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_3DFBInfoTop.Hi = val;
+ if (m_3DFBInfoTop.CLRPOFF) m_3DFBInfoTop.POFF = 0;
+ })
+ );
+ mmio->Register(base | VI_FB_RIGHT_BOTTOM_HI,
+ MMIO::DirectRead<u16>(&m_3DFBInfoBottom.Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_3DFBInfoBottom.Hi = val;
+ if (m_3DFBInfoBottom.CLRPOFF) m_3DFBInfoBottom.POFF = 0;
+ })
+ );
+
+ // MMIOs with unimplemented writes that trigger warnings.
+ mmio->Register(base | VI_VERTICAL_BEAM_POSITION,
+ MMIO::DirectRead<u16>(&m_VBeamPos),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ WARN_LOG(VIDEOINTERFACE, "Changing vertical beam position to 0x%04x - not documented or implemented yet", val);
+ })
+ );
+ mmio->Register(base | VI_HORIZONTAL_BEAM_POSITION,
+ MMIO::DirectRead<u16>(&m_HBeamPos),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ WARN_LOG(VIDEOINTERFACE, "Changing horizontal beam position to 0x%04x - not documented or implemented yet", val);
+ })
+ );
+
+ // The following MMIOs are interrupts related and update interrupt status
+ // on writes.
+ mmio->Register(base | VI_PRERETRACE_HI,
+ MMIO::DirectRead<u16>(&m_InterruptRegister[0].Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_InterruptRegister[0].Hi = val;
+ UpdateInterrupts();
+ })
+ );
+ mmio->Register(base | VI_POSTRETRACE_HI,
+ MMIO::DirectRead<u16>(&m_InterruptRegister[1].Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_InterruptRegister[1].Hi = val;
+ UpdateInterrupts();
+ })
+ );
+ mmio->Register(base | VI_DISPLAY_INTERRUPT_2_HI,
+ MMIO::DirectRead<u16>(&m_InterruptRegister[2].Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_InterruptRegister[2].Hi = val;
+ UpdateInterrupts();
+ })
+ );
+ mmio->Register(base | VI_DISPLAY_INTERRUPT_3_HI,
+ MMIO::DirectRead<u16>(&m_InterruptRegister[3].Hi),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_InterruptRegister[3].Hi = val;
+ UpdateInterrupts();
+ })
+ );
+
+ // Unknown anti-aliasing related MMIO register: puts a warning on log and
+ // needs to shift/mask when reading/writing.
+ mmio->Register(base | VI_UNK_AA_REG_HI,
+ MMIO::ComplexRead<u16>([](u32) {
+ return m_UnkAARegister >> 16;
+ }),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_UnkAARegister = (m_UnkAARegister & 0x0000FFFF) | ((u32)val << 16);
+ WARN_LOG(VIDEOINTERFACE, "Writing to the unknown AA register (hi)");
+ })
+ );
+ mmio->Register(base | VI_UNK_AA_REG_LO,
+ MMIO::ComplexRead<u16>([](u32) {
+ return m_UnkAARegister & 0xFFFF;
+ }),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ m_UnkAARegister = (m_UnkAARegister & 0xFFFF0000) | val;
+ WARN_LOG(VIDEOINTERFACE, "Writing to the unknown AA register (lo)");
+ })
+ );
+
+ // Control register writes only updates some select bits, and additional
+ // processing needs to be done if a reset is requested.
+ mmio->Register(base | VI_CONTROL_REGISTER,
+ MMIO::DirectRead<u16>(&m_DisplayControlRegister.Hex),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UVIDisplayControlRegister tmpConfig(val);
m_DisplayControlRegister.ENB = tmpConfig.ENB;
m_DisplayControlRegister.NIN = tmpConfig.NIN;
m_DisplayControlRegister.DLR = tmpConfig.DLR;
@@ -461,242 +365,36 @@ void Write16(const u16 _iValue, const u32 _iAddress)
}
UpdateParameters();
- }
- break;
-
- case VI_HORIZONTAL_TIMING_0_HI:
- m_HTiming0.Hi = _iValue;
- break;
- case VI_HORIZONTAL_TIMING_0_LO:
- m_HTiming0.Lo = _iValue;
- break;
-
- case VI_HORIZONTAL_TIMING_1_HI:
- m_HTiming1.Hi = _iValue;
- break;
- case VI_HORIZONTAL_TIMING_1_LO:
- m_HTiming1.Lo = _iValue;
- break;
-
- case VI_VBLANK_TIMING_ODD_HI:
- m_VBlankTimingOdd.Hi = _iValue;
- break;
- case VI_VBLANK_TIMING_ODD_LO:
- m_VBlankTimingOdd.Lo = _iValue;
- break;
-
- case VI_VBLANK_TIMING_EVEN_HI:
- m_VBlankTimingEven.Hi = _iValue;
- break;
- case VI_VBLANK_TIMING_EVEN_LO:
- m_VBlankTimingEven.Lo = _iValue;
- break;
-
- case VI_BURST_BLANKING_ODD_HI:
- m_BurstBlankingOdd.Hi = _iValue;
- break;
- case VI_BURST_BLANKING_ODD_LO:
- m_BurstBlankingOdd.Lo = _iValue;
- break;
-
- case VI_BURST_BLANKING_EVEN_HI:
- m_BurstBlankingEven.Hi = _iValue;
- break;
- case VI_BURST_BLANKING_EVEN_LO:
- m_BurstBlankingEven.Lo = _iValue;
- break;
-
- case VI_FB_LEFT_TOP_HI:
- m_XFBInfoTop.Hi = _iValue;
- if (m_XFBInfoTop.CLRPOFF) m_XFBInfoTop.POFF = 0;
- break;
- case VI_FB_LEFT_TOP_LO:
- m_XFBInfoTop.Lo = _iValue;
- break;
-
- case VI_FB_RIGHT_TOP_HI:
- m_3DFBInfoTop.Hi = _iValue;
- if (m_3DFBInfoTop.CLRPOFF) m_3DFBInfoTop.POFF = 0;
- break;
- case VI_FB_RIGHT_TOP_LO:
- m_3DFBInfoTop.Lo = _iValue;
- break;
-
- case VI_FB_LEFT_BOTTOM_HI:
- m_XFBInfoBottom.Hi = _iValue;
- if (m_XFBInfoBottom.CLRPOFF) m_XFBInfoBottom.POFF = 0;
- break;
- case VI_FB_LEFT_BOTTOM_LO:
- m_XFBInfoBottom.Lo = _iValue;
- break;
-
- case VI_FB_RIGHT_BOTTOM_HI:
- m_3DFBInfoBottom.Hi = _iValue;
- if (m_3DFBInfoBottom.CLRPOFF) m_3DFBInfoBottom.POFF = 0;
- break;
- case VI_FB_RIGHT_BOTTOM_LO:
- m_3DFBInfoBottom.Lo = _iValue;
- break;
-
- case VI_VERTICAL_BEAM_POSITION:
- WARN_LOG(VIDEOINTERFACE, "Change Vertical Beam Position to 0x%04x - Not documented or implemented", _iValue);
- break;
-
- case VI_HORIZONTAL_BEAM_POSITION:
- WARN_LOG(VIDEOINTERFACE, "Change Horizontal Beam Position to 0x%04x - Not documented or implemented", _iValue);
- break;
-
- // RETRACE STUFF ...
- case VI_PRERETRACE_HI:
- m_InterruptRegister[0].Hi = _iValue;
- UpdateInterrupts();
- break;
- case VI_PRERETRACE_LO:
- m_InterruptRegister[0].Lo = _iValue;
- break;
-
- case VI_POSTRETRACE_HI:
- m_InterruptRegister[1].Hi = _iValue;
- UpdateInterrupts();
- break;
- case VI_POSTRETRACE_LO:
- m_InterruptRegister[1].Lo = _iValue;
- break;
-
- case VI_DISPLAY_INTERRUPT_2_HI:
- m_InterruptRegister[2].Hi = _iValue;
- UpdateInterrupts();
- break;
- case VI_DISPLAY_INTERRUPT_2_LO:
- m_InterruptRegister[2].Lo = _iValue;
- break;
-
- case VI_DISPLAY_INTERRUPT_3_HI:
- m_InterruptRegister[3].Hi = _iValue;
- UpdateInterrupts();
- break;
- case VI_DISPLAY_INTERRUPT_3_LO:
- m_InterruptRegister[3].Lo = _iValue;
- break;
-
- case VI_DISPLAY_LATCH_0_HI:
- m_LatchRegister[0].Hi = _iValue;
- break;
- case VI_DISPLAY_LATCH_0_LO:
- m_LatchRegister[0].Lo = _iValue;
- break;
-
- case VI_DISPLAY_LATCH_1_HI:
- m_LatchRegister[1].Hi = _iValue;
- break;
- case VI_DISPLAY_LATCH_1_LO:
- m_LatchRegister[1].Lo = _iValue;
- break;
-
- case VI_HSCALEW:
- m_HorizontalStepping.Hex = _iValue;
- break;
-
- case VI_HSCALER:
- m_HorizontalScaling.Hex = _iValue;
- break;
-
- case VI_FILTER_COEF_0_HI:
- m_FilterCoefTables.Tables02[0].Hi = _iValue;
- break;
- case VI_FILTER_COEF_0_LO:
- m_FilterCoefTables.Tables02[0].Lo = _iValue;
- break;
- case VI_FILTER_COEF_1_HI:
- m_FilterCoefTables.Tables02[1].Hi = _iValue;
- break;
- case VI_FILTER_COEF_1_LO:
- m_FilterCoefTables.Tables02[1].Lo = _iValue;
- break;
- case VI_FILTER_COEF_2_HI:
- m_FilterCoefTables.Tables02[2].Hi = _iValue;
- break;
- case VI_FILTER_COEF_2_LO:
- m_FilterCoefTables.Tables02[2].Lo = _iValue;
- break;
- case VI_FILTER_COEF_3_HI:
- m_FilterCoefTables.Tables36[0].Hi = _iValue;
- break;
- case VI_FILTER_COEF_3_LO:
- m_FilterCoefTables.Tables36[0].Lo = _iValue;
- break;
- case VI_FILTER_COEF_4_HI:
- m_FilterCoefTables.Tables36[1].Hi = _iValue;
- break;
- case VI_FILTER_COEF_4_LO:
- m_FilterCoefTables.Tables36[1].Lo = _iValue;
- break;
- case VI_FILTER_COEF_5_HI:
- m_FilterCoefTables.Tables36[2].Hi = _iValue;
- break;
- case VI_FILTER_COEF_5_LO:
- m_FilterCoefTables.Tables36[2].Lo = _iValue;
- break;
- case VI_FILTER_COEF_6_HI:
- m_FilterCoefTables.Tables36[3].Hi = _iValue;
- break;
- case VI_FILTER_COEF_6_LO:
- m_FilterCoefTables.Tables36[3].Lo = _iValue;
- break;
-
- case VI_UNK_AA_REG_HI:
- m_UnkAARegister = (m_UnkAARegister & 0x0000ffff) | (u32)(_iValue << 16);
- WARN_LOG(VIDEOINTERFACE, "(w16) to unknown AA register, not sure what it does :)");
- break;
- case VI_UNK_AA_REG_LO:
- m_UnkAARegister = (m_UnkAARegister & 0xffff0000) | _iValue;
- WARN_LOG(VIDEOINTERFACE, "(w16) to unknown AA register, not sure what it does :)");
- break;
-
- case VI_CLOCK:
- m_Clock = _iValue;
- break;
-
- case VI_DTV_STATUS:
- m_DTVStatus.Hex = _iValue;
- break;
-
- case VI_FBWIDTH:
- m_FBWidth = _iValue;
- break;
-
- case VI_BORDER_BLANK_END:
- m_BorderHBlank.Lo = _iValue;
- break;
- case VI_BORDER_BLANK_START:
- m_BorderHBlank.Hi = _iValue;
- break;
+ })
+ );
- default:
- ERROR_LOG(VIDEOINTERFACE, "(w16) %04x to unknown register %x", _iValue, _iAddress & 0xfff);
- break;
+ // Map 8 bit reads (not writes) to 16 bit reads.
+ for (int i = 0; i < 0x1000; i += 2)
+ {
+ mmio->Register(base | i,
+ MMIO::ReadToLarger<u8>(mmio, base | i, 8),
+ MMIO::InvalidWrite<u8>()
+ );
+ mmio->Register(base | (i + 1),
+ MMIO::ReadToLarger<u8>(mmio, base | i, 0),
+ MMIO::InvalidWrite<u8>()
+ );
}
-}
-void Read32(u32& _uReturnValue, const u32 _iAddress)
-{
- u16 Hi = 0, Lo = 0;
- Read16(Hi, _iAddress);
- Read16(Lo, _iAddress + 2);
- _uReturnValue = (Hi << 16) | Lo;
-
- INFO_LOG(VIDEOINTERFACE, "(r32): 0x%08x, 0x%08x", _uReturnValue, _iAddress);
+ // Map 32 bit reads and writes to 16 bit reads and writes.
+ for (int i = 0; i < 0x1000; i += 4)
+ {
+ mmio->Register(base | i,
+ MMIO::ReadToSmaller<u32>(mmio, base | i, base | (i + 2)),
+ MMIO::WriteToSmaller<u32>(mmio, base | i, base | (i + 2))
+ );
+ }
}
-void Write32(const u32 _iValue, const u32 _iAddress)
+void SetRegionReg(char region)
{
- INFO_LOG(VIDEOINTERFACE, "(w32): 0x%08x, 0x%08x", _iValue, _iAddress);
-
- // Allow 32-bit writes to the VI: although this is officially not
- // allowed, the hardware seems to accept it (for example, DesktopMan GC
- // Tetris uses it).
- Write16(_iValue >> 16, _iAddress);
- Write16(_iValue & 0xFFFF, _iAddress + 2);
+ if (!Core::g_CoreStartupParameter.bForceNTSCJ)
+ m_DTVStatus.ntsc_j = region == 'J';
}
void UpdateInterrupts()
diff --git a/Source/Core/Core/HW/VideoInterface.h b/Source/Core/Core/HW/VideoInterface.h
index b7e5f62..ff4a5c2 100644
--- a/Source/Core/Core/HW/VideoInterface.h
+++ b/Source/Core/Core/HW/VideoInterface.h
@@ -4,8 +4,10 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
+
class PointerWrap;
+namespace MMIO { class Mapping; }
namespace VideoInterface
{
@@ -14,22 +16,22 @@ namespace VideoInterface
// the field rate from 60 FPS when they added color to the standard.
// This was done to prevent analog interference between the video and
// audio signals. PAL has no similar reduction; it is exactly 50 FPS.
-//#define NTSC_FIELD_RATE (60.0f / 1.001f)
-#define NTSC_FIELD_RATE 60
-#define NTSC_LINE_COUNT 525
+//#define NTSC_FIELD_RATE (60.0f / 1.001f)
+#define NTSC_FIELD_RATE 60
+#define NTSC_LINE_COUNT 525
// These line numbers indicate the beginning of the "active video" in a frame.
// An NTSC frame has the lower field first followed by the upper field.
// TODO: Is this true for PAL-M? Is this true for EURGB60?
-#define NTSC_LOWER_BEGIN 21
-#define NTSC_UPPER_BEGIN 283
+#define NTSC_LOWER_BEGIN 21
+#define NTSC_UPPER_BEGIN 283
-//#define PAL_FIELD_RATE 50.0f
-#define PAL_FIELD_RATE 50
-#define PAL_LINE_COUNT 625
+//#define PAL_FIELD_RATE 50.0f
+#define PAL_FIELD_RATE 50
+#define PAL_LINE_COUNT 625
// These line numbers indicate the beginning of the "active video" in a frame.
// A PAL frame has the upper field first followed by the lower field.
-#define PAL_UPPER_BEGIN 23
-#define PAL_LOWER_BEGIN 336
+#define PAL_UPPER_BEGIN 23
+#define PAL_LOWER_BEGIN 336
// VI Internal Hardware Addresses
enum
@@ -324,12 +326,7 @@ union UVIDTVStatus
void SetRegionReg(char region);
void DoState(PointerWrap &p);
- void Read8(u8& _uReturnValue, const u32 _uAddress);
- void Read16(u16& _uReturnValue, const u32 _uAddress);
- void Read32(u32& _uReturnValue, const u32 _uAddress);
-
- void Write16(const u16 _uValue, const u32 _uAddress);
- void Write32(const u32 _uValue, const u32 _uAddress);
+ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// returns a pointer to the current visible xfb
u32 GetXFBAddressTop();
diff --git a/Source/Core/Core/HW/WII_IOB.cpp b/Source/Core/Core/HW/WII_IOB.cpp
deleted file mode 100644
index bfcf102..0000000
--- a/Source/Core/Core/HW/WII_IOB.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include "Common.h"
-#include "ChunkFile.h"
-#include "WII_IOB.h"
-
-namespace WII_IOBridge
-{
-
-void Read8(u8& _rReturnValue, const u32 _Address)
-{
- _dbg_assert_(WII_IOB, 0);
-}
-
-void Read16(u16& _rReturnValue, const u32 _Address)
-{
- _dbg_assert_(WII_IOB, 0);
-}
-
-void Read32(u32& _rReturnValue, const u32 _Address)
-{
- switch (_Address & 0xFFFF)
- {
- // NAND Loader ... no idea
- case 0x018:
- ERROR_LOG(WII_IOB, "IOP: Read32 from 0x18 = 0x%08x (NANDLoader)", _Address);
- break;
- // WiiMenu... no idea
- case 0x24:
- ERROR_LOG(WII_IOB, "IOP: Read32 from 0x24 = 0x%08x (WiiMenu)", _Address);
- break;
-
-
- case 0xc0: // __VISendI2CData
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0xc0 = 0x%08x (__VISendI2CData)", _rReturnValue);
- break;
-
- case 0xc4: // __VISendI2CData
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0xc4 = 0x%08x (__VISendI2CData)", _rReturnValue);
- break;
-
- case 0xc8: // __VISendI2CData
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0xc8 = 0x%08x (__VISendI2CData)", _rReturnValue);
- break;
-
- case 0x180: // __AIClockInit
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0x180 = 0x%08x (__AIClockInit)", _rReturnValue);
- return;
-
- case 0x1CC: // __AIClockInit
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0x1CC = 0x%08x (__AIClockInit)", _rReturnValue);
- return;
-
- case 0x1D0: // __AIClockInit
- _rReturnValue = 0;
- INFO_LOG(WII_IOB, "IOP: Read32 from 0x1D0 = 0x%08x (__AIClockInit)", _rReturnValue);
- return;
-
- default:
- _dbg_assert_msg_(WII_IOB, 0, "IOP: Read32 from 0x%08x", _Address);
- break;
- }
-}
-
-void Read64(u64& _rReturnValue, const u32 _Address)
-{
- _dbg_assert_(WII_IOB, 0);
-}
-
-void Write8(const u8 _Value, const u32 _Address)
-{
- _dbg_assert_(WII_IOB, 0);
-}
-
-void Write16(const u16 _Value, const u32 _Address)
-{
- _dbg_assert_(WII_IOB, 0);
-}
-
-void Write32(const u32 _Value, const u32 _Address)
-{
- switch(_Address & 0xFFFF)
- {
- // NANDLoader ... no idea
- case 0x18:
- ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (NANDLoader)", _Value, _Address);
- break;
- // WiiMenu... no idea
- case 0x24:
- ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (WiiMenu)", _Value, _Address);
- break;
-
- case 0xc0: // __VISendI2CData
- INFO_LOG(WII_IOB, "IOP: Write32 to 0xc0 = 0x%08x (__VISendI2CData)", _Value);
- break;
-
- case 0xc4: // __VISendI2CData
- INFO_LOG(WII_IOB, "IOP: Write32 to 0xc4 = 0x%08x (__VISendI2CData)", _Value);
- break;
-
- case 0xc8: // __VISendI2CData
- INFO_LOG(WII_IOB, "IOP: Write32 to 0xc8 = 0x%08x (__VISendI2CData)", _Value);
- break;
-
- case 0x180: // __AIClockInit
- INFO_LOG(WII_IOB, "IOP: Write32 to 0x180 = 0x%08x (__AIClockInit)", _Value);
- return;
-
- case 0x1CC: // __AIClockInit
- INFO_LOG(WII_IOB, "IOP: Write32 to 0x1D0 = 0x%08x (__AIClockInit)", _Value);
- return;
-
- case 0x1D0: // __AIClockInit
- INFO_LOG(WII_IOB, "IOP: Write32 to 0x1D0 = 0x%08x (__AIClockInit)", _Value);
- return;
-
- default:
- _dbg_assert_msg_(WII_IOB, 0, "IOP: Write32 to 0x%08x", _Address);
- break;
- }
-}
-
-void Write64(const u64 _Value, const u32 _Address)
-{
- //switch(_Address)
- //{
- //default:
- _dbg_assert_msg_(WII_IOB, 0, "IOP: Write32 to 0x%08x", _Address);
- //break;
- //}
-}
-
-} // end of namespace AudioInterfac
diff --git a/Source/Core/Core/HW/WII_IOB.h b/Source/Core/Core/HW/WII_IOB.h
deleted file mode 100644
index ccfd29c..0000000
--- a/Source/Core/Core/HW/WII_IOB.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "Common.h"
-class PointerWrap;
-
-namespace WII_IOBridge
-{
-
-void Init();
-void Shutdown();
-void DoState(PointerWrap &p);
-
-void Update();
-
-void Read8(u8& _rReturnValue, const u32 _Address);
-void Read16(u16& _rReturnValue, const u32 _Address);
-void Read32(u32& _rReturnValue, const u32 _Address);
-void Read64(u64& _rReturnValue, const u32 _Address);
-
-void Write8(const u8 _Value, const u32 _Address);
-void Write16(const u16 _Value, const u32 _Address);
-void Write32(const u32 _Value, const u32 _Address);
-void Write64(const u64 _Value, const u32 _Address);
-
-} // end of namespace AudioInterface
diff --git a/Source/Core/Core/HW/WII_IPC.cpp b/Source/Core/Core/HW/WII_IPC.cpp
index 912bb8a..93ff9bb 100644
--- a/Source/Core/Core/HW/WII_IPC.cpp
+++ b/Source/Core/Core/HW/WII_IPC.cpp
@@ -6,16 +6,16 @@
#include <queue>
#include <vector>
-#include "Common.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include "CPU.h"
-#include "Memmap.h"
-#include "ProcessorInterface.h"
-
-#include "../IPC_HLE/WII_IPC_HLE.h"
-#include "WII_IPC.h"
-#include "CoreTiming.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/WII_IPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
// This is the intercommunication between ARM and PPC. Currently only PPC actually uses it, because of the IOS HLE
@@ -37,12 +37,21 @@ enum
IPC_ARMMSG = 0x08,
IPC_ARMCTRL = 0x0c,
+ PPCSPEED = 0x18,
+ VISOLID = 0x24,
+
PPC_IRQFLAG = 0x30,
PPC_IRQMASK = 0x34,
ARM_IRQFLAG = 0x38,
ARM_IRQMASK = 0x3c,
- GPIOB_OUT = 0xc0 // sensor bar power flag??
+ GPIOB_OUT = 0xc0,
+ GPIOB_DIR = 0xc4,
+ GPIOB_IN = 0xc8,
+
+ UNK_180 = 0x180,
+ UNK_1CC = 0x1cc,
+ UNK_1D0 = 0x1d0,
};
struct CtrlRegister
@@ -109,13 +118,13 @@ void DoState(PointerWrap &p)
void Init()
{
ctrl = CtrlRegister();
- ppc_msg =
- arm_msg =
+ ppc_msg = 0;
+ arm_msg = 0;
- ppc_irq_flags =
- ppc_irq_masks =
- arm_irq_flags =
- arm_irq_masks =
+ ppc_irq_flags = 0;
+ ppc_irq_masks = 0;
+ arm_irq_flags = 0;
+ arm_irq_masks = 0;
sensorbar_power = 0;
@@ -135,86 +144,64 @@ void Shutdown()
{
}
-void Read32(u32& _rReturnValue, const u32 _Address)
-{
- switch(_Address & 0xFFFF)
- {
- case IPC_PPCCTRL:
- _rReturnValue = ctrl.ppc();
- DEBUG_LOG(WII_IPC, "r32 IPC_PPCCTRL %03x [R:%i A:%i E:%i]",
- ctrl.ppc(), ctrl.Y1, ctrl.Y2, ctrl.X1);
-
- // if ((REASON_REG & 0x14) == 0x14) CALL IPCReplayHandler
- // if ((REASON_REG & 0x22) != 0x22) Jumps to the end
- break;
-
- case IPC_ARMMSG: // looks a little bit like a callback function
- _rReturnValue = arm_msg;
- DEBUG_LOG(WII_IPC, "r32 IPC_ARMMSG %08x ", _rReturnValue);
- break;
-
- case GPIOB_OUT:
- _rReturnValue = sensorbar_power;
- break;
-
- default:
- _dbg_assert_msg_(WII_IPC, 0, "r32 from %08x", _Address);
- break;
- }
-}
-
-void Write32(const u32 _Value, const u32 _Address)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- switch(_Address & 0xFFFF)
- {
- case IPC_PPCMSG: // __ios_Ipc2 ... a value from __responses is loaded
- {
- ppc_msg = _Value;
- DEBUG_LOG(WII_IPC, "IPC_PPCMSG = %08x", ppc_msg);
- }
- break;
-
- case IPC_PPCCTRL:
- {
- ctrl.ppc(_Value);
- DEBUG_LOG(WII_IPC, "w32 %08x IPC_PPCCTRL = %03x [R:%i A:%i E:%i]",
- _Value, ctrl.ppc(), ctrl.Y1, ctrl.Y2, ctrl.X1);
+ mmio->Register(base | IPC_PPCMSG,
+ MMIO::InvalidRead<u32>(),
+ MMIO::DirectWrite<u32>(&ppc_msg)
+ );
+
+ mmio->Register(base | IPC_PPCCTRL,
+ MMIO::ComplexRead<u32>([](u32) {
+ return ctrl.ppc();
+ }),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ ctrl.ppc(val);
if (ctrl.X1)
- {
- INFO_LOG(WII_IPC, "New pointer available: %08x", ppc_msg);
- // Let the HLE handle the request on it's own time
WII_IPC_HLE_Interface::EnqRequest(ppc_msg);
- }
- }
- break;
-
- case PPC_IRQFLAG: // ACR REGISTER IT IS CALLED IN DEBUG
- {
- ppc_irq_flags &= ~_Value;
- DEBUG_LOG(WII_IPC, "w32 PPC_IRQFLAG %08x (%08x)", _Value, ppc_irq_flags);
- }
- break;
-
- case PPC_IRQMASK: // __OSInterruptInit (0x40000000)
- {
- ppc_irq_masks = _Value;
+ WII_IPC_HLE_Interface::Update();
+ CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
+ })
+ );
+
+ mmio->Register(base | IPC_ARMMSG,
+ MMIO::DirectRead<u32>(&arm_msg),
+ MMIO::InvalidWrite<u32>()
+ );
+
+ mmio->Register(base | PPC_IRQFLAG,
+ MMIO::InvalidRead<u32>(),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ ppc_irq_flags &= ~val;
+ WII_IPC_HLE_Interface::Update();
+ CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
+ })
+ );
+
+ mmio->Register(base | PPC_IRQMASK,
+ MMIO::InvalidRead<u32>(),
+ MMIO::ComplexWrite<u32>([](u32, u32 val) {
+ ppc_irq_masks = val;
if (ppc_irq_masks & INT_CAUSE_IPC_BROADWAY) // wtf?
Reset();
- DEBUG_LOG(WII_IPC, "w32 PPC_IRQMASK %08x", ppc_irq_masks);
- }
- break;
-
- case GPIOB_OUT:
- sensorbar_power = _Value;
- break;
-
- default:
- _dbg_assert_msg_(WII_IPC, 0, "w32 %08x @ %08x", _Value, _Address);
- break;
- }
-
- WII_IPC_HLE_Interface::Update();
- CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
+ WII_IPC_HLE_Interface::Update();
+ CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
+ })
+ );
+
+ mmio->Register(base | GPIOB_OUT,
+ MMIO::Constant<u32>(0),
+ MMIO::DirectWrite<u32>(&sensorbar_power)
+ );
+
+ // Register some stubbed/unknown MMIOs required to make Wii games work.
+ mmio->Register(base | PPCSPEED, MMIO::InvalidRead<u32>(), MMIO::Nop<u32>());
+ mmio->Register(base | VISOLID, MMIO::InvalidRead<u32>(), MMIO::Nop<u32>());
+ mmio->Register(base | GPIOB_DIR, MMIO::Constant<u32>(0), MMIO::Nop<u32>());
+ mmio->Register(base | GPIOB_IN, MMIO::Constant<u32>(0), MMIO::Nop<u32>());
+ mmio->Register(base | UNK_180, MMIO::Constant<u32>(0), MMIO::Nop<u32>());
+ mmio->Register(base | UNK_1CC, MMIO::Constant<u32>(0), MMIO::Nop<u32>());
+ mmio->Register(base | UNK_1D0, MMIO::Constant<u32>(0), MMIO::Nop<u32>());
}
void UpdateInterrupts(u64 userdata, int cyclesLate)
diff --git a/Source/Core/Core/HW/WII_IPC.h b/Source/Core/Core/HW/WII_IPC.h
index 1f59841..7cb578b 100644
--- a/Source/Core/Core/HW/WII_IPC.h
+++ b/Source/Core/Core/HW/WII_IPC.h
@@ -4,8 +4,10 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
+
class PointerWrap;
+namespace MMIO { class Mapping; }
namespace WII_IPCInterface
{
@@ -36,8 +38,7 @@ void Reset();
void Shutdown();
void DoState(PointerWrap &p);
-void Read32(u32& _rReturnValue, const u32 _Address);
-void Write32(const u32 _Value, const u32 _Address);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void UpdateInterrupts(u64 userdata = 0, int cyclesLate = 0);
void GenerateAck(u32 _Address);
diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp
index 5efd075..94a359a 100644
--- a/Source/Core/Core/HW/Wiimote.cpp
+++ b/Source/Core/Core/HW/Wiimote.cpp
@@ -2,17 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "Wiimote.h"
-#include "WiimoteReal/WiimoteReal.h"
-#include "WiimoteEmu/WiimoteEmu.h"
-#include "Movie.h"
-#include "../ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Movie.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
-#include "ControllerInterface/ControllerInterface.h"
-
-#include "../InputCommon/InputConfig.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
+#include "InputCommon/InputConfig.h"
namespace Wiimote
{
diff --git a/Source/Core/Core/HW/Wiimote.h b/Source/Core/Core/HW/Wiimote.h
index 434a3be..2a99603 100644
--- a/Source/Core/Core/HW/Wiimote.h
+++ b/Source/Core/Core/HW/Wiimote.h
@@ -4,10 +4,11 @@
#pragma once
-#include "../InputCommon/InputConfig.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "InputCommon/InputConfig.h"
-enum {
+enum
+{
WIIMOTE_CHAN_0 = 0,
WIIMOTE_CHAN_1,
WIIMOTE_CHAN_2,
@@ -18,14 +19,14 @@ enum {
};
-#define WIIMOTE_INI_NAME "WiimoteNew"
+#define WIIMOTE_INI_NAME "WiimoteNew"
enum
{
- WIIMOTE_SRC_NONE = 0,
- WIIMOTE_SRC_EMU = 1,
- WIIMOTE_SRC_REAL = 2,
- WIIMOTE_SRC_HYBRID = 3, // emu + real
+ WIIMOTE_SRC_NONE = 0,
+ WIIMOTE_SRC_EMU = 1,
+ WIIMOTE_SRC_REAL = 2,
+ WIIMOTE_SRC_HYBRID = 3, // emu + real
};
extern unsigned int g_wiimote_sources[MAX_BBMOTES];
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp
index 4648eea..cb7faaf 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp
@@ -2,16 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
// Extension device IDs to be written to the last bytes of the extension reg
// The id for nothing inserted
-static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e };
+static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e };
// The id for a partially inserted extension
-static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
+static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
Attachment::Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg )
: name( _name ), reg( _reg )
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h
index ba49885..01b7836 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.h
@@ -4,8 +4,8 @@
#pragma once
-#include "ControllerEmu.h"
-#include "../WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "InputCommon/ControllerEmu.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp
index efa4b4a..915d051 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp
@@ -2,8 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Classic.h"
-
+#include "Core/HW/WiimoteEmu/Attachment/Classic.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h
index edcd57c..6094ecb 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.cpp
index 7a4b2db..35a1fe8 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.cpp
@@ -2,8 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Drums.h"
-
+#include "Core/HW/WiimoteEmu/Attachment/Drums.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h
index 1228a98..8c2bbc1 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Drums.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.cpp
index b00fae4..51c3224 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.cpp
@@ -2,13 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Guitar.h"
-
+#include "Core/HW/WiimoteEmu/Attachment/Guitar.h"
namespace WiimoteEmu
{
-static const u8 guitar_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x03 };
+static const u8 guitar_id[] = { 0x00, 0x00, 0xa4, 0x20, 0x01, 0x03 };
static const u16 guitar_fret_bitmasks[] =
{
@@ -82,7 +81,7 @@ void Guitar::GetState(u8* const data, const bool focus)
}
// TODO: touch bar, probably not
- gdata->tb = 0x0F; // not touched
+ gdata->tb = 0x0F; // not touched
// whammy bar
u8 whammy;
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h
index 3ab4fae..379096c 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Guitar.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp
index 89c8d09..6f57548 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Nunchuk.h"
+#include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h"
-#include "UDPWrapper.h"
-#include "UDPWiimote.h"
+#include "InputCommon/UDPWrapper.h"
+#include "InputCommon/UDPWiimote.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h
index beb6594..83a7540 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
class UDPWrapper;
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.cpp
index 39a0f8d..650d5b6 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.cpp
@@ -2,8 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Turntable.h"
-
+#include "Core/HW/WiimoteEmu/Attachment/Turntable.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h
index 8275961..48b3658 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Turntable.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Attachment.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
index f30d812..255833e 100644
--- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
@@ -16,18 +16,17 @@
0x10 - 0x1a leads to a 0x22 Input report
0x30 - 0x3f Input This file: Update() */
-#include <vector>
-#include <string>
#include <fstream>
+#include <string>
+#include <vector>
-#include "Common.h"
-#include "FileUtil.h"
-
-#include "WiimoteEmu.h"
-#include "WiimoteHid.h"
-#include "../WiimoteReal/WiimoteReal.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
-#include "Attachment/Attachment.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteHid.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
namespace WiimoteEmu
{
@@ -358,27 +357,27 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
//if(((((u8*)&wm->m_reg_ext)[0xf0] == 0xaa) || ((u8*)&wm->m_reg_motion_plus)[0xf0] == 0xaa) && rdr->address>>8 < 0xf0) {
//if(!wm->GetMotionPlusActive() && ((u8*)&wm->m_reg_ext)[0xf0] == 0xaa && rdr->address>>8 < 0xf0) {
-
+
//if(!wm->GetMotionPlusActive() && ((u8*)&wm->m_reg_ext)[0xf0] == 0xaa) {
-
- // SWARN_LOG(CONSOLE, "key %s", ArrayToString(((u8*)&wm->m_ext_key), sizeof(wm->m_ext_key), 0, 30).c_str());
- // SWARN_LOG(CONSOLE, "decrypt %s", ArrayToString(rdr->data, rdr->size+1, 0, 30).c_str());
- // wiimote_decrypt(&wm->m_ext_key, rdr->data, dataReply[2]&0xffff, rdr->size+1);
- // SWARN_LOG(CONSOLE, "decrypt %s", ArrayToString(rdr->data, rdr->size+1, 0, 30).c_str());
- // decrypted = true;
+
+ // SWARN_LOG(CONSOLE, "key %s", ArrayToString(((u8*)&wm->m_ext_key), sizeof(wm->m_ext_key), 0, 30).c_str());
+ // SWARN_LOG(CONSOLE, "decrypt %s", ArrayToString(rdr->data, rdr->size+1, 0, 30).c_str());
+ // wiimote_decrypt(&wm->m_ext_key, rdr->data, dataReply[2]&0xffff, rdr->size+1);
+ // SWARN_LOG(CONSOLE, "decrypt %s", ArrayToString(rdr->data, rdr->size+1, 0, 30).c_str());
+ // decrypted = true;
//}
// save data
if (!emu && !rdr->error)
{
//if (dataReply[1] == 0xa4 && wm->GetMotionPlusActive())
- //memcpy(&((u8*)&wm->m_reg_motion_plus)[rdr->address>>8], rdr->data, rdr->size+1);
+ // memcpy(&((u8*)&wm->m_reg_motion_plus)[rdr->address>>8], rdr->data, rdr->size+1);
//if (dataReply[1] == 0xa4 && !wm->GetMotionPlusActive())
//if (dataReply[1] == 0xa4)
- // memcpy(&((u8*)&wm->m_reg_ext)[rdr->address>>8], rdr->data, rdr->size+1);
+ // memcpy(&((u8*)&wm->m_reg_ext)[rdr->address>>8], rdr->data, rdr->size+1);
//if (!wm->GetMotionPlusActive() && wm->GetMotionPlusAttached())
//if (dataReply[1] == 0xa6)
- // memcpy(&((u8*)&wm->m_reg_motion_plus)[rdr->address>>8], rdr->data, rdr->size+1);
+ // memcpy(&((u8*)&wm->m_reg_motion_plus)[rdr->address>>8], rdr->data, rdr->size+1);
//INFO_LOG(CONSOLE, "Saving[0x%2x:0x%2x]: %s", dataReply[1], rdr->address>>8, ArrayToString(rdr->data, rdr->size+1).c_str());
}
@@ -395,39 +394,41 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
// decrypt
//if(((u8*)&wm->m_reg_ext)[0xf0] == 0xaa) {
- // wiimote_decrypt(&wm->m_ext_key, &data[0x07], 0x00, (data[4] >> 0x04) + 1);
-
- //if (wm->m_extension->name == "NUNCHUCK") {
- // INFO_LOG(CONSOLE, "\nGame got the Nunchuck calibration:\n");
- // INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]);
- // INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 1]);
- // INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 2]);
- // INFO_LOG(CONSOLE, "Cal_g.x: %i\n", data[7 + 4]);
- // INFO_LOG(CONSOLE, "Cal_g.y: %i\n", data[7 + 5]);
- // INFO_LOG(CONSOLE, "Cal_g.z: %i\n", data[7 + 6]);
- // INFO_LOG(CONSOLE, "Js.Max.x: %i\n", data[7 + 8]);
- // INFO_LOG(CONSOLE, "Js.Min.x: %i\n", data[7 + 9]);
- // INFO_LOG(CONSOLE, "Js.Center.x: %i\n", data[7 + 10]);
- // INFO_LOG(CONSOLE, "Js.Max.y: %i\n", data[7 + 11]);
- // INFO_LOG(CONSOLE, "Js.Min.y: %i\n", data[7 + 12]);
- // INFO_LOG(CONSOLE, "JS.Center.y: %i\n\n", data[7 + 13]);
+ // wiimote_decrypt(&wm->m_ext_key, &data[0x07], 0x00, (data[4] >> 0x04) + 1);
+
+ //if (wm->m_extension->name == "NUNCHUCK")
+ //{
+ // INFO_LOG(CONSOLE, "\nGame got the Nunchuck calibration:\n");
+ // INFO_LOG(CONSOLE, "Cal_zero.x: %i\n", data[7 + 0]);
+ // INFO_LOG(CONSOLE, "Cal_zero.y: %i\n", data[7 + 1]);
+ // INFO_LOG(CONSOLE, "Cal_zero.z: %i\n", data[7 + 2]);
+ // INFO_LOG(CONSOLE, "Cal_g.x: %i\n", data[7 + 4]);
+ // INFO_LOG(CONSOLE, "Cal_g.y: %i\n", data[7 + 5]);
+ // INFO_LOG(CONSOLE, "Cal_g.z: %i\n", data[7 + 6]);
+ // INFO_LOG(CONSOLE, "Js.Max.x: %i\n", data[7 + 8]);
+ // INFO_LOG(CONSOLE, "Js.Min.x: %i\n", data[7 + 9]);
+ // INFO_LOG(CONSOLE, "Js.Center.x: %i\n", data[7 + 10]);
+ // INFO_LOG(CONSOLE, "Js.Max.y: %i\n", data[7 + 11]);
+ // INFO_LOG(CONSOLE, "Js.Min.y: %i\n", data[7 + 12]);
+ // INFO_LOG(CONSOLE, "JS.Center.y: %i\n\n", data[7 + 13]);
//}
- //else // g_Config.bClassicControllerConnected {
- // INFO_LOG(CONSOLE, "\nGame got the Classic Controller calibration:\n");
- // INFO_LOG(CONSOLE, "Lx.Max: %i\n", data[7 + 0]);
- // INFO_LOG(CONSOLE, "Lx.Min: %i\n", data[7 + 1]);
- // INFO_LOG(CONSOLE, "Lx.Center: %i\n", data[7 + 2]);
- // INFO_LOG(CONSOLE, "Ly.Max: %i\n", data[7 + 3]);
- // INFO_LOG(CONSOLE, "Ly.Min: %i\n", data[7 + 4]);
- // INFO_LOG(CONSOLE, "Ly.Center: %i\n", data[7 + 5]);
- // INFO_LOG(CONSOLE, "Rx.Max.x: %i\n", data[7 + 6]);
- // INFO_LOG(CONSOLE, "Rx.Min.x: %i\n", data[7 + 7]);
- // INFO_LOG(CONSOLE, "Rx.Center.x: %i\n", data[7 + 8]);
- // INFO_LOG(CONSOLE, "Ry.Max.y: %i\n", data[7 + 9]);
- // INFO_LOG(CONSOLE, "Ry.Min: %i\n", data[7 + 10]);
- // INFO_LOG(CONSOLE, "Ry.Center: %i\n\n", data[7 + 11]);
- // INFO_LOG(CONSOLE, "Lt.Neutral: %i\n", data[7 + 12]);
- // INFO_LOG(CONSOLE, "Rt.Neutral %i\n\n", data[7 + 13]);
+ //else // g_Config.bClassicControllerConnected
+ //{
+ // INFO_LOG(CONSOLE, "\nGame got the Classic Controller calibration:\n");
+ // INFO_LOG(CONSOLE, "Lx.Max: %i\n", data[7 + 0]);
+ // INFO_LOG(CONSOLE, "Lx.Min: %i\n", data[7 + 1]);
+ // INFO_LOG(CONSOLE, "Lx.Center: %i\n", data[7 + 2]);
+ // INFO_LOG(CONSOLE, "Ly.Max: %i\n", data[7 + 3]);
+ // INFO_LOG(CONSOLE, "Ly.Min: %i\n", data[7 + 4]);
+ // INFO_LOG(CONSOLE, "Ly.Center: %i\n", data[7 + 5]);
+ // INFO_LOG(CONSOLE, "Rx.Max.x: %i\n", data[7 + 6]);
+ // INFO_LOG(CONSOLE, "Rx.Min.x: %i\n", data[7 + 7]);
+ // INFO_LOG(CONSOLE, "Rx.Center.x: %i\n", data[7 + 8]);
+ // INFO_LOG(CONSOLE, "Ry.Max.y: %i\n", data[7 + 9]);
+ // INFO_LOG(CONSOLE, "Ry.Min: %i\n", data[7 + 10]);
+ // INFO_LOG(CONSOLE, "Ry.Center: %i\n\n", data[7 + 11]);
+ // INFO_LOG(CONSOLE, "Lt.Neutral: %i\n", data[7 + 12]);
+ // INFO_LOG(CONSOLE, "Rt.Neutral %i\n\n", data[7 + 13]);
//}
// save values
diff --git a/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp b/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp
index 3c0c111..8d2efd0 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp
@@ -5,8 +5,8 @@
// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com)
-#include "Common.h"
-#include "Encryption.h"
+#include "Common/Common.h"
+#include "Core/HW/WiimoteEmu/Encryption.h"
static const u8 ans_tbl[7][6] = {
diff --git a/Source/Core/Core/HW/WiimoteEmu/MatrixMath.h b/Source/Core/Core/HW/WiimoteEmu/MatrixMath.h
index 42944cd..fce9d97 100644
--- a/Source/Core/Core/HW/WiimoteEmu/MatrixMath.h
+++ b/Source/Core/Core/HW/WiimoteEmu/MatrixMath.h
@@ -4,10 +4,10 @@
#pragma once
-#include <math.h>
+#include <cmath>
#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846
#endif
typedef double Matrix[4][4];
@@ -26,10 +26,10 @@ inline void MatrixIdentity(Matrix & m)
inline void MatrixFrustum(Matrix &m, double l, double r, double b, double t, double n, double f)
{
- m[0][0]=2*n/(r-l); m[0][1]=0; m[0][2]=0; m[0][3]=0;
- m[1][0]=0; m[1][1]=2*n/(t-b); m[1][2]=0; m[1][3]=0;
- m[2][0]=(r+l)/(r-l); m[2][1]=(t+b)/(t-b); m[2][2]=(f+n)/(f-n); m[2][3]=-1;
- m[3][0]=0; m[3][1]=0; m[3][2]=2*f*n/(f-n); m[3][3]=0;
+ m[0][0]=2*n/(r-l); m[0][1]=0; m[0][2]=0; m[0][3]=0;
+ m[1][0]=0; m[1][1]=2*n/(t-b); m[1][2]=0; m[1][3]=0;
+ m[2][0]=(r+l)/(r-l); m[2][1]=(t+b)/(t-b); m[2][2]=(f+n)/(f-n); m[2][3]=-1;
+ m[3][0]=0; m[3][1]=0; m[3][2]=2*f*n/(f-n); m[3][3]=0;
}
inline void MatrixPerspective(Matrix & m, double fovy, double aspect, double nplane, double fplane)
@@ -47,23 +47,24 @@ inline void MatrixPerspective(Matrix & m, double fovy, double aspect, double npl
inline void MatrixRotationByZ(Matrix &m, double sin, double cos)
{
m[0][0]=cos; m[0][1]=-sin; m[0][2]=0; m[0][3]=0;
- m[1][0]=sin; m[1][1]=cos; m[1][2]=0; m[1][3]=0;
- m[2][0]=0; m[2][1]=0; m[2][2]=1; m[2][3]=0;
- m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
+ m[1][0]=sin; m[1][1]=cos; m[1][2]=0; m[1][3]=0;
+ m[2][0]=0; m[2][1]=0; m[2][2]=1; m[2][3]=0;
+ m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
}
inline void MatrixScale(Matrix &m, double xfact, double yfact, double zfact)
{
- m[0][0]=xfact; m[0][1]=0; m[0][2]=0; m[0][3]=0;
- m[1][0]=0; m[1][1]=yfact; m[1][2]=0; m[1][3]=0;
- m[2][0]=0; m[2][1]=0; m[2][2]=zfact; m[2][3]=0;
- m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
+ m[0][0]=xfact; m[0][1]=0; m[0][2]=0; m[0][3]=0;
+ m[1][0]=0; m[1][1]=yfact; m[1][2]=0; m[1][3]=0;
+ m[2][0]=0; m[2][1]=0; m[2][2]=zfact; m[2][3]=0;
+ m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
}
inline void MatrixMultiply(Matrix &r, const Matrix &a, const Matrix &b)
{
for (int i=0; i<16; i++)
r[i>>2][i&3]=0.0f;
+
for (int i=0; i<4; i++)
for (int j=0; j<4; j++)
for (int k=0; k<4; k++)
diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
index fdf3af9..1a9e3c7 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
//#define WIIMOTE_SPEAKER_DUMP
#ifdef WIIMOTE_SPEAKER_DUMP
+#include <cstdlib>
#include <fstream>
-#include "WaveFile.h"
-#include <stdlib.h>
-#include "FileUtil.h"
+#include "AudioCommon/WaveFile.h"
+#include "Common/FileUtil.h"
#endif
namespace WiimoteEmu
diff --git a/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h b/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h
index 8e9ac25..7a827d4 100644
--- a/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h
+++ b/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "UDPWiimote.h"
-#include "WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "InputCommon/UDPWiimote.h"
namespace UDPTLayer
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
index edebc2f..efe5274 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -4,31 +4,28 @@
#include <cmath>
-#include "Attachment/Classic.h"
-#include "Attachment/Nunchuk.h"
-#include "Attachment/Guitar.h"
-#include "Attachment/Drums.h"
-#include "Attachment/Turntable.h"
-
-#include "WiimoteEmu.h"
-#include "WiimoteHid.h"
-
-#include "../WiimoteReal/WiimoteReal.h"
-
-#include "Timer.h"
-#include "Common.h"
-#include "../../Host.h"
-#include "../../ConfigManager.h"
-
-#include "UDPTLayer.h"
+#include "Common/Common.h"
+#include "Common/Timer.h"
+
+#include "Core/Host.h"
+#include "Core/ConfigManager.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayClient.h"
+
+#include "Core/HW/WiimoteEmu/Attachment/Classic.h"
+#include "Core/HW/WiimoteEmu/Attachment/Drums.h"
+#include "Core/HW/WiimoteEmu/Attachment/Guitar.h"
+#include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h"
+#include "Core/HW/WiimoteEmu/Attachment/Turntable.h"
+
+#include "Core/HW/WiimoteEmu/MatrixMath.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteHid.h"
+#include "Core/HW/WiimoteEmu/UDPTLayer.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } //because damn MSVSC doesen't comply to C99
-#include "MatrixMath.h"
-
-#include "../../Movie.h"
-#include "NetPlayClient.h"
-
namespace
{
// :)
@@ -44,7 +41,7 @@ namespace WiimoteEmu
static const u8 eeprom_data_0[] = {
// IR, maybe more
// assuming last 2 bytes are checksum
- 0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, 0xA7, /*0x74, 0xD3,*/ 0x00, 0x00, // messing up the checksum on purpose
+ 0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, 0xA7, /*0x74, 0xD3,*/ 0x00, 0x00, // messing up the checksum on purpose
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, 0xA7, /*0x74, 0xD3,*/ 0x00, 0x00,
// Accelerometer
// 0g x,y,z, 1g x,y,z, idk, last byte is a checksum
@@ -131,7 +128,7 @@ void EmulateTilt(AccelData* const accel
// 180 degrees
tilt_group->GetState(&roll, &pitch, 0, focus ? PI : 0);
- unsigned int ud = 0, lr = 0, fb = 0;
+ unsigned int ud = 0, lr = 0, fb = 0;
// some notes that no one will understand but me :p
// left, forward, up
@@ -156,7 +153,7 @@ void EmulateTilt(AccelData* const accel
(&accel->x)[fb] = sin(pitch)*sgn[fb];
}
-#define SWING_INTENSITY 2.5f//-uncalibrated(aprox) 0x40-calibrated
+#define SWING_INTENSITY 2.5f//-uncalibrated(aprox) 0x40-calibrated
void EmulateSwing(AccelData* const accel
, ControllerEmu::Force* const swing_group
@@ -169,9 +166,9 @@ void EmulateSwing(AccelData* const accel
u8 axis_map[3];
// determine which axis is which direction
- axis_map[0] = upright ? (sideways ? 0 : 1) : 2; // up/down
- axis_map[1] = sideways; // left|right
- axis_map[2] = upright ? 2 : (sideways ? 0 : 1); // forward/backward
+ axis_map[0] = upright ? (sideways ? 0 : 1) : 2; // up/down
+ axis_map[1] = sideways; // left|right
+ axis_map[2] = upright ? 2 : (sideways ? 0 : 1); // forward/backward
// some orientations have up as positive, some as negative
// same with forward
@@ -263,7 +260,7 @@ Wiimote::Wiimote( const unsigned int index )
: m_index(index)
, ir_sin(0)
, ir_cos(1)
-// , m_sound_stream( NULL )
+// , m_sound_stream( NULL )
{
// ---- set up all the controls ----
@@ -329,7 +326,7 @@ std::string Wiimote::GetName() const
}
// if windows is focused or background input is enabled
-#define HAS_FOCUS (Host_RendererHasFocus() || (m_options->settings[0]->value != 0))
+#define HAS_FOCUS (Host_RendererHasFocus() || (m_options->settings[0]->value != 0))
bool Wiimote::Step()
{
@@ -469,9 +466,8 @@ void Wiimote::GetIRData(u8* const data, bool use_accel)
nsin=0;
ncos=1;
}
- // PanicAlert("%d %d %d\nx:%f\nz:%f\nsin:%f\ncos:%f",accel->x,accel->y,accel->z,ax,az,sin,cos);
- //PanicAlert("%d %d %d\n%d %d %d\n%d %d %d",accel->x,accel->y,accel->z,calib->zero_g.x,calib->zero_g.y,calib->zero_g.z,
- // calib->one_g.x,calib->one_g.y,calib->one_g.z);
+ // PanicAlert("%d %d %d\nx:%f\nz:%f\nsin:%f\ncos:%f",accel->x,accel->y,accel->z,ax,az,sin,cos);
+ // PanicAlert("%d %d %d\n%d %d %d\n%d %d %d",accel->x,accel->y,accel->z,calib->zero_g.x,calib->zero_g.y,calib->zero_g.z, calib->one_g.x,calib->one_g.y,calib->one_g.z);
}
else
{
@@ -530,9 +526,9 @@ void Wiimote::GetIRData(u8* const data, bool use_accel)
x[i]=(u16)round((v[i].x+1)/2*(camWidth-1));
y[i]=(u16)round((v[i].y+1)/2*(camHeight-1));
}
- // PanicAlert("%f %f\n%f %f\n%f %f\n%f %f\n%d %d\n%d %d\n%d %d\n%d %d",
- // v[0].x,v[0].y,v[1].x,v[1].y,v[2].x,v[2].y,v[3].x,v[3].y,
- // x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[38]);
+ // PanicAlert("%f %f\n%f %f\n%f %f\n%f %f\n%d %d\n%d %d\n%d %d\n%d %d",
+ // v[0].x,v[0].y,v[1].x,v[1].y,v[2].x,v[2].y,v[3].x,v[3].y,
+ // x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[38]);
}
// Fill report with valid data when full handshake was done
if (m_reg_ir.data[0x30])
@@ -895,25 +891,25 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
{
ControllerEmu::LoadDefaults(ciface);
- #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
+ #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
// Buttons
#if defined HAVE_X11 && HAVE_X11
- set_control(m_buttons, 0, "Click 1"); // A
- set_control(m_buttons, 1, "Click 3"); // B
+ set_control(m_buttons, 0, "Click 1"); // A
+ set_control(m_buttons, 1, "Click 3"); // B
#else
- set_control(m_buttons, 0, "Click 0"); // A
- set_control(m_buttons, 1, "Click 1"); // B
+ set_control(m_buttons, 0, "Click 0"); // A
+ set_control(m_buttons, 1, "Click 1"); // B
#endif
- set_control(m_buttons, 2, "1"); // 1
- set_control(m_buttons, 3, "2"); // 2
- set_control(m_buttons, 4, "Q"); // -
- set_control(m_buttons, 5, "E"); // +
+ set_control(m_buttons, 2, "1"); // 1
+ set_control(m_buttons, 3, "2"); // 2
+ set_control(m_buttons, 4, "Q"); // -
+ set_control(m_buttons, 5, "E"); // +
#ifdef _WIN32
- set_control(m_buttons, 6, "RETURN"); // Home
+ set_control(m_buttons, 6, "RETURN"); // Home
#else
- set_control(m_buttons, 6, "Return"); // Home
+ set_control(m_buttons, 6, "Return"); // Home
#endif
// Shake
@@ -928,20 +924,20 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
// DPad
#ifdef _WIN32
- set_control(m_dpad, 0, "UP"); // Up
- set_control(m_dpad, 1, "DOWN"); // Down
- set_control(m_dpad, 2, "LEFT"); // Left
- set_control(m_dpad, 3, "RIGHT"); // Right
+ set_control(m_dpad, 0, "UP"); // Up
+ set_control(m_dpad, 1, "DOWN"); // Down
+ set_control(m_dpad, 2, "LEFT"); // Left
+ set_control(m_dpad, 3, "RIGHT"); // Right
#elif __APPLE__
- set_control(m_dpad, 0, "Up Arrow"); // Up
- set_control(m_dpad, 1, "Down Arrow"); // Down
- set_control(m_dpad, 2, "Left Arrow"); // Left
- set_control(m_dpad, 3, "Right Arrow"); // Right
+ set_control(m_dpad, 0, "Up Arrow"); // Up
+ set_control(m_dpad, 1, "Down Arrow"); // Down
+ set_control(m_dpad, 2, "Left Arrow"); // Left
+ set_control(m_dpad, 3, "Right Arrow"); // Right
#else
- set_control(m_dpad, 0, "Up"); // Up
- set_control(m_dpad, 1, "Down"); // Down
- set_control(m_dpad, 2, "Left"); // Left
- set_control(m_dpad, 3, "Right"); // Right
+ set_control(m_dpad, 0, "Up"); // Up
+ set_control(m_dpad, 1, "Down"); // Down
+ set_control(m_dpad, 2, "Left"); // Left
+ set_control(m_dpad, 3, "Right"); // Right
#endif
// ugly stuff
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
index 8b24fcf..49714cb 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h
@@ -4,17 +4,18 @@
#pragma once
-#include "../../Core.h"
+#include <queue>
+#include <vector>
-#include "ControllerEmu.h"
-#include "ChunkFile.h"
+#include "Core/Core.h"
-#include "WiimoteHid.h"
-#include "Encryption.h"
-#include "UDPWrapper.h"
+#include "Common/ChunkFile.h"
-#include <vector>
-#include <queue>
+#include "Core/HW/WiimoteEmu/Encryption.h"
+#include "Core/HW/WiimoteEmu/WiimoteHid.h"
+
+#include "InputCommon/ControllerEmu.h"
+#include "InputCommon/UDPWrapper.h"
// Registry sizes
#define WIIMOTE_EEPROM_SIZE (16*1024)
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h
index 01b4018..9befb27 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
// what is this ?
#ifdef _MSC_VER
@@ -175,10 +175,10 @@ struct wm_report
u8 data[0];
struct
{
- u8 rumble : 1; // enable/disable rumble
+ u8 rumble : 1; // enable/disable rumble
// only valid for certain reports
- u8 ack : 1; // respond with an ack
- u8 enable : 1; // enable/disable certain features
+ u8 ack : 1; // respond with an ack
+ u8 enable : 1; // enable/disable certain features
};
};
};
@@ -232,7 +232,7 @@ struct wm_status_report
struct wm_write_data
{
u8 rumble : 1;
- u8 space : 2; //see WM_SPACE_*
+ u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u8 size;
@@ -251,7 +251,7 @@ struct wm_acknowledge
struct wm_read_data
{
u8 rumble : 1;
- u8 space : 2; //see WM_SPACE_*
+ u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u16 size;
@@ -266,7 +266,7 @@ struct wm_read_data
struct wm_read_data_reply
{
wm_core buttons;
- u8 error : 4; //see WM_RDERR_*
+ u8 error : 4; //see WM_RDERR_*
u8 size : 4;
u16 address;
u8 data[16];
@@ -347,8 +347,8 @@ struct wm_speaker_data
// Custom structs
/**
- * @struct accel_t
- * @brief Accelerometer struct. For any device with an accelerometer.
+ * @struct accel_t
+ * @brief Accelerometer struct. For any device with an accelerometer.
*/
struct accel_cal
{
diff --git a/Source/Core/Core/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/HW/WiimoteReal/IODummy.cpp
index 57034ff..f410a04 100644
--- a/Source/Core/Core/HW/WiimoteReal/IODummy.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/IODummy.cpp
@@ -1,22 +1,9 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-#include "WiimoteReal.h"
+#include "Common/Common.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
namespace WiimoteReal
{
diff --git a/Source/Core/Core/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/HW/WiimoteReal/IONix.cpp
index 0f4fe5e..4684aee 100644
--- a/Source/Core/Core/HW/WiimoteReal/IONix.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/IONix.cpp
@@ -1,27 +1,14 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/l2cap.h>
-#include "Common.h"
-#include "WiimoteReal.h"
+#include "Common/Common.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
namespace WiimoteReal
{
diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
index 13728a9..e924428 100644
--- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
@@ -2,24 +2,25 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
-#include <stdlib.h>
#include <algorithm>
-#include <unordered_map>
+#include <cstdio>
+#include <cstdlib>
#include <ctime>
+#include <unordered_map>
#include <unordered_set>
#include <windows.h>
#include <dbt.h>
#include <setupapi.h>
-#include "Common.h"
-#include "WiimoteReal.h"
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
// Used for pair up
#undef NTDDI_VERSION
-#define NTDDI_VERSION NTDDI_WINXPSP2
+#define NTDDI_VERSION NTDDI_WINXPSP2
#include <bthdef.h>
#include <BluetoothAPIs.h>
@@ -49,7 +50,7 @@ typedef DWORD (__stdcall *PBth_BluetoothGetRadioInfo)(HANDLE, PBLUETOOTH_RADIO_I
typedef DWORD (__stdcall *PBth_BluetoothRemoveDevice)(const BLUETOOTH_ADDRESS*);
typedef DWORD (__stdcall *PBth_BluetoothSetServiceState)(HANDLE, const BLUETOOTH_DEVICE_INFO*, const GUID*, DWORD);
typedef DWORD (__stdcall *PBth_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG);
-typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*);
+typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*);
PHidD_GetHidGuid HidD_GetHidGuid = NULL;
PHidD_GetAttributes HidD_GetAttributes = NULL;
@@ -244,7 +245,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
// Don't mind me, just a random sleep to fix stuff on Windows
//if (!wiimotes.empty())
- // SLEEP(2000);
+ // SLEEP(2000);
}
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
diff --git a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
index c094c97..8ac433a 100644
--- a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
+++ b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm
@@ -1,7 +1,7 @@
#define BLUETOOTH_VERSION_USE_CURRENT
-#include "Common.h"
-#include "WiimoteReal.h"
+#include "Common/Common.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
@interface SearchBT: NSObject {
@public
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
index 94724e3..99db68b 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
@@ -2,24 +2,23 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <queue>
#include <algorithm>
-#include <stdlib.h>
-
-#include "Common.h"
-#include "IniFile.h"
-#include "StringUtil.h"
-#include "Timer.h"
-#include "Host.h"
-#include "ConfigManager.h"
-#include "SFML/Network.hpp"
+#include <cstdlib>
+#include <queue>
+#include "SFML/Network.hpp"
-#include "WiimoteReal.h"
+#include "Common/Common.h"
+#include "Common/IniFile.h"
+#include "Common/StringUtil.h"
+#include "Common/Timer.h"
-#include "../WiimoteEmu/WiimoteHid.h"
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "Core/HW/WiimoteEmu/WiimoteHid.h"
-unsigned int g_wiimote_sources[MAX_BBMOTES];
+unsigned int g_wiimote_sources[MAX_BBMOTES];
namespace WiimoteReal
{
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
index 90b1247..d84dc9d 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h
@@ -7,16 +7,16 @@
#include <functional>
#include <vector>
-#include "WiimoteRealBase.h"
-#include "ChunkFile.h"
-#include "Thread.h"
-#include "FifoQueue.h"
-#include "Timer.h"
+#include "Common/ChunkFile.h"
+#include "Common/FifoQueue.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
-#include "../Wiimote.h"
-#include "../WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/WiimoteReal/WiimoteRealBase.h"
-#include "../InputCommon/InputConfig.h"
+#include "InputCommon/InputConfig.h"
typedef std::vector<u8> Report;
@@ -82,22 +82,22 @@ public:
bool m_connected;
CFRunLoopRef m_wiimote_thread_run_loop;
#elif defined(__linux__) && HAVE_BLUEZ
- bdaddr_t bdaddr; // Bluetooth address
- int cmd_sock; // Command socket
- int int_sock; // Interrupt socket
+ bdaddr_t bdaddr; // Bluetooth address
+ int cmd_sock; // Command socket
+ int int_sock; // Interrupt socket
int wakeup_pipe_w, wakeup_pipe_r;
#elif defined(_WIN32)
- std::basic_string<TCHAR> devicepath; // Unique wiimote reference
- //ULONGLONG btaddr; // Bluetooth address
- HANDLE dev_handle; // HID handle
- OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle
- enum win_bt_stack_t stack; // Type of bluetooth stack to use
+ std::basic_string<TCHAR> devicepath; // Unique wiimote reference
+ //ULONGLONG btaddr; // Bluetooth address
+ HANDLE dev_handle; // HID handle
+ OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle
+ enum win_bt_stack_t stack; // Type of bluetooth stack to use
#endif
protected:
Report m_last_input_report;
- u16 m_channel;
+ u16 m_channel;
private:
void ClearReadQueue();
@@ -123,8 +123,8 @@ private:
std::mutex m_thread_ready_mutex;
std::condition_variable m_thread_ready_cond;
- Common::FifoQueue<Report> m_read_reports;
- Common::FifoQueue<Report> m_write_reports;
+ Common::FifoQueue<Report> m_read_reports;
+ Common::FifoQueue<Report> m_write_reports;
Common::Timer m_last_audio_report;
};
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteRealBase.h b/Source/Core/Core/HW/WiimoteReal/WiimoteRealBase.h
index f9997a3..4d1f6a2 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteRealBase.h
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteRealBase.h
@@ -22,33 +22,33 @@
// Wiimote internal codes
// Communication channels
-#define WM_OUTPUT_CHANNEL 0x11
-#define WM_INPUT_CHANNEL 0x13
+#define WM_OUTPUT_CHANNEL 0x11
+#define WM_INPUT_CHANNEL 0x13
// The 4 most significant bits of the first byte of an outgoing command must be
// 0x50 if sending on the command channel and 0xA0 if sending on the interrupt
// channel. On Mac and Linux we use interrupt channel; on Windows, command.
#ifdef _WIN32
-#define WM_SET_REPORT 0x50
+#define WM_SET_REPORT 0x50
#else
-#define WM_SET_REPORT 0xA0
+#define WM_SET_REPORT 0xA0
#endif
-#define WM_BT_INPUT 0x01
-#define WM_BT_OUTPUT 0x02
+#define WM_BT_INPUT 0x01
+#define WM_BT_OUTPUT 0x02
// LED bit masks
-#define WIIMOTE_LED_NONE 0x00
-#define WIIMOTE_LED_1 0x10
-#define WIIMOTE_LED_2 0x20
-#define WIIMOTE_LED_3 0x40
-#define WIIMOTE_LED_4 0x80
+#define WIIMOTE_LED_NONE 0x00
+#define WIIMOTE_LED_1 0x10
+#define WIIMOTE_LED_2 0x20
+#define WIIMOTE_LED_3 0x40
+#define WIIMOTE_LED_4 0x80
// End Wiimote internal codes
// It's 23. NOT 32!
-#define MAX_PAYLOAD 23
-#define WIIMOTE_DEFAULT_TIMEOUT 1000
+#define MAX_PAYLOAD 23
+#define WIIMOTE_DEFAULT_TIMEOUT 1000
#ifdef _WIN32
// Available bluetooth stacks for Windows.
diff --git a/Source/Core/Core/IPC_HLE/ICMP.h b/Source/Core/Core/IPC_HLE/ICMP.h
index de7e929..2b3b49b 100644
--- a/Source/Core/Core/IPC_HLE/ICMP.h
+++ b/Source/Core/Core/IPC_HLE/ICMP.h
@@ -6,7 +6,7 @@
#include <netinet/in.h>
#endif
-#include "Common.h"
+#include "Common/Common.h"
int icmp_echo_req(const u32 s, const sockaddr_in *addr, const u8 *data, const u32 data_length);
int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 data_length);
diff --git a/Source/Core/Core/IPC_HLE/ICMPWin.cpp b/Source/Core/Core/IPC_HLE/ICMPWin.cpp
index 55ccb9e..0761067 100644
--- a/Source/Core/Core/IPC_HLE/ICMPWin.cpp
+++ b/Source/Core/Core/IPC_HLE/ICMPWin.cpp
@@ -1,4 +1,4 @@
-#include "ICMP.h"
+#include "Core/IPC_HLE/ICMP.h"
enum
{
@@ -53,10 +53,10 @@ u16 cksum(const u16 *buffer, int length)
int icmp_echo_req(const u32 s, const sockaddr_in *addr, const u8 *data, const u32 data_length)
{
memset(workspace, 0, sizeof(workspace));
- icmp_hdr *header = (icmp_hdr *)workspace;
- header->type = ICMP_ECHOREQ;
- header->code = 0;
- header->checksum = 0;
+ icmp_hdr *header = (icmp_hdr *)workspace;
+ header->type = ICMP_ECHOREQ;
+ header->code = 0;
+ header->checksum = 0;
memcpy(&header->id, data, data_length);
header->checksum = cksum((u16 *)header, ICMP_HDR_LEN + data_length);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
index ba6cf79..a26ebfc 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
@@ -21,38 +21,40 @@ They will also generate a true or false return for UpdateInterrupts() in WII_IPC
*/
#include <map>
-#include <string>
#include <list>
+#include <string>
-#include "Common.h"
-#include "CommonPaths.h"
-#include "Thread.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device.h"
-#include "WII_IPC_HLE_Device_DI.h"
-#include "WII_IPC_HLE_Device_FileIO.h"
-#include "WII_IPC_HLE_Device_stm.h"
-#include "WII_IPC_HLE_Device_fs.h"
-#include "WII_IPC_HLE_Device_net.h"
-#include "WII_IPC_HLE_Device_net_ssl.h"
-#include "WII_IPC_HLE_Device_es.h"
-#include "WII_IPC_HLE_Device_usb.h"
-#include "WII_IPC_HLE_Device_usb_kbd.h"
-#include "WII_IPC_HLE_Device_sdio_slot0.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h" // For Copy
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/WII_IPC.h"
+
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
#if defined(__LIBUSB__) || defined (_WIN32)
- #include "WII_IPC_HLE_Device_hid.h"
+ #include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
#endif
-#include "FileUtil.h" // For Copy
-#include "../ConfigManager.h"
-#include "../HW/CPU.h"
-#include "../HW/Memmap.h"
-#include "../HW/WII_IPC.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-#include "../PowerPC/PowerPC.h"
-#include "../HW/SystemTimers.h"
-#include "CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
namespace WII_IPC_HLE_Interface
@@ -72,8 +74,8 @@ IWII_IPC_HLE_Device* es_handles[ES_MAX_COUNT];
typedef std::deque<u32> ipc_msg_queue;
-static ipc_msg_queue request_queue; // ppc -> arm
-static ipc_msg_queue reply_queue; // arm -> ppc
+static ipc_msg_queue request_queue; // ppc -> arm
+static ipc_msg_queue reply_queue; // arm -> ppc
static std::mutex s_reply_queue;
static int enque_reply;
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.h
index 7d18cb4..2bd3983 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.h
@@ -4,15 +4,15 @@
#pragma once
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
class IWII_IPC_HLE_Device;
namespace WII_IPC_HLE_Interface
{
-#define IPC_FIRST_ID 0x00 // first IPC device ID
-#define IPC_MAX_FILES 0x10 // first IPC file ID
+#define IPC_FIRST_ID 0x00 // First IPC device ID
+#define IPC_MAX_FILES 0x10 // First IPC file ID
void EnqueReplyCallback(u64 userdata, int =0);
@@ -54,13 +54,13 @@ void EnqReply(u32 _Address, int cycles_in_future = 0);
enum ECommandType
{
- COMMAND_OPEN_DEVICE = 1,
- COMMAND_CLOSE_DEVICE = 2,
- COMMAND_READ = 3,
- COMMAND_WRITE = 4,
- COMMAND_SEEK = 5,
- COMMAND_IOCTL = 6,
- COMMAND_IOCTLV = 7,
+ COMMAND_OPEN_DEVICE = 1,
+ COMMAND_CLOSE_DEVICE = 2,
+ COMMAND_READ = 3,
+ COMMAND_WRITE = 4,
+ COMMAND_SEEK = 5,
+ COMMAND_IOCTL = 6,
+ COMMAND_IOCTLV = 7,
};
} // end of namespace WII_IPC_HLE_Interface
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device.h
index 37c1474..d5888e9 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device.h
@@ -4,11 +4,12 @@
#pragma once
-#include <string>
#include <queue>
-#include "../HW/Memmap.h"
+#include <string>
+
+#include "Common/ChunkFile.h"
-#include "ChunkFile.h"
+#include "Core/HW/Memmap.h"
#define FS_SUCCESS (u32)0 // Success
#define FS_EACCES (u32)-1 // Permission denied
@@ -16,8 +17,8 @@
#define FS_EINVAL (u32)-4 // Invalid argument Invalid FD
#define FS_ENOENT (u32)-6 // File not found
#define FS_EBUSY (u32)-8 // Resource busy
-#define FS_EIO (u32)-12 // Returned on ECC error
-#define FS_ENOMEM (u32)-22 // Alloc failed during request
+#define FS_EIO (u32)-12 // Returned on ECC error
+#define FS_ENOMEM (u32)-22 // Alloc failed during request
#define FS_EFATAL (u32)-101 // Fatal error
#define FS_EACCESS (u32)-102 // Permission denied
#define FS_ECORRUPT (u32)-103 // returned for "corrupted" NAND
@@ -33,7 +34,7 @@
#define FS_EDIRDEPTH (u32)-116 // Max directory depth exceeded
#define FS_EBUSY2 (u32)-118 // Resource busy
//#define FS_EFATAL (u32)-119 // Fatal error not used by IOS as fatal ERROR
-#define FS_EESEXHAUSTED (u32)-1016 // Max of 2 ES handles at a time
+#define FS_EESEXHAUSTED (u32)-1016 // Max of 2 ES handles at a time
// A struct for IOS ioctlv calls
struct SIOCtlVBuffer
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
index 551cb1c..3b6f19a 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
@@ -2,30 +2,30 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include <cinttypes>
-#include "WII_IPC_HLE_Device_DI.h"
-#include "WII_IPC_HLE.h"
+#include "Common/Common.h"
+#include "Common/LogManager.h"
-#include "../HW/DVDInterface.h"
-#include "../HW/CPU.h"
-#include "../HW/Memmap.h"
-#include "../Core.h"
-#include "../VolumeHandler.h"
-#include "VolumeCreator.h"
-#include "Filesystem.h"
-#include "LogManager.h"
-#include "../HW/SystemTimers.h"
+#include "Core/Core.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/SystemTimers.h"
-#include "../../DiscIO/FileMonitor.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
-#include <cinttypes>
+#include "DiscIO/FileMonitor.h"
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/VolumeCreator.h"
using namespace DVDInterface;
-#define DI_COVER_REG_INITIALIZED 0 // Should be 4, but doesn't work correctly...
-#define DI_COVER_REG_NO_DISC 1
+#define DI_COVER_REG_INITIALIZED 0 // Should be 4, but doesn't work correctly...
+#define DI_COVER_REG_NO_DISC 1
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName )
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
@@ -72,11 +72,11 @@ bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce)
bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress)
{
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
- u32 Command = Memory::Read_U32(BufferIn) >> 24;
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Command = Memory::Read_U32(BufferIn) >> 24;
DEBUG_LOG(WII_IPC_DVD, "IOCtl Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)",
Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
@@ -453,8 +453,8 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
{
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 Command = Memory::Read_U32(BufferIn) >> 24;
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 Command = Memory::Read_U32(BufferIn) >> 24;
// Hacks below
@@ -477,14 +477,14 @@ int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
return SystemTimers::GetTicksPerSecond() / 146;
break;
-// case DVDLowAudioBufferConfig:
-// case DVDLowInquiry:
-// case DVDLowReadDiskID:
-// case DVDLowWaitForCoverClose:
-// case DVDLowGetCoverReg:
-// case DVDLowGetCoverStatus:
-// case DVDLowReset:
-// case DVDLowClosePartition:
+ // case DVDLowAudioBufferConfig:
+ // case DVDLowInquiry:
+ // case DVDLowReadDiskID:
+ // case DVDLowWaitForCoverClose:
+ // case DVDLowGetCoverReg:
+ // case DVDLowGetCoverStatus:
+ // case DVDLowReset:
+ // case DVDLowClosePartition:
default:
// random numbers here!
// More than ~1/2000th of a second hangs DKCR with DSP HLE, maybe.
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.h
index fb9b466..0d8b6f2 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.h
@@ -4,7 +4,7 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
namespace DiscIO
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
index 1a8febe..3a6d328 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "ChunkFile.h"
-
-#include "WII_IPC_HLE_Device_fs.h"
-#include "WII_IPC_HLE_Device_FileIO.h"
-#include "NandPaths.h"
#include <algorithm>
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+#include "Common/StringUtil.h"
+
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
+
static Common::replace_v replacements;
@@ -66,7 +67,7 @@ void HLE_IPC_CreateVirtualFATFilesystem()
}
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName)
- : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
+ : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
, m_Mode(0)
, m_SeekPos(0)
{
@@ -148,7 +149,7 @@ File::IOFile CWII_IPC_HLE_Device_FileIO::OpenFile()
bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
{
- u32 ReturnValue = FS_RESULT_FATAL;
+ u32 ReturnValue = FS_RESULT_FATAL;
const s32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
const s32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
@@ -210,8 +211,8 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress)
{
u32 ReturnValue = FS_EACCESS;
- const u32 Address = Memory::Read_U32(_CommandAddress + 0xC); // Read to this memory address
- const u32 Size = Memory::Read_U32(_CommandAddress + 0x10);
+ const u32 Address = Memory::Read_U32(_CommandAddress + 0xC); // Read to this memory address
+ const u32 Size = Memory::Read_U32(_CommandAddress + 0x10);
if (auto file = OpenFile())
@@ -249,9 +250,8 @@ bool CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_FileIO::Write(u32 _CommandAddress)
{
u32 ReturnValue = FS_EACCESS;
- const u32 Address = Memory::Read_U32(_CommandAddress + 0xC); // Write data from this memory address
- const u32 Size = Memory::Read_U32(_CommandAddress + 0x10);
-
+ const u32 Address = Memory::Read_U32(_CommandAddress + 0xC); // Write data from this memory address
+ const u32 Size = Memory::Read_U32(_CommandAddress + 0x10);
if (auto file = OpenFile())
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
index 0b7ac92..93bfe97 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h
@@ -4,8 +4,8 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
std::string HLE_IPC_BuildFilename(std::string _pFilename, int _size);
void HLE_IPC_CreateVirtualFATFilesystem();
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp
index ea4230f..ebeb0cf 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp
@@ -33,26 +33,26 @@
*/
// =============
-#include "WII_IPC_HLE_Device_es.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
// need to include this before polarssl/aes.h,
// otherwise we may not get __STDC_FORMAT_MACROS
#include <cinttypes>
-#include "../PowerPC/PowerPC.h"
-#include "../VolumeHandler.h"
-#include "FileUtil.h"
#include <polarssl/aes.h>
-#include "ConfigManager.h"
-#include "../Boot/Boot_DOL.h"
-#include "NandPaths.h"
-#include "CommonPaths.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-#include "../Movie.h"
-#include "StringUtil.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+#include "Common/StringUtil.h"
-#include "ec_wii.h"
+#include "Core/ConfigManager.h"
+#include "Core/Movie.h"
+#include "Core/VolumeHandler.h"
+#include "Core/Boot/Boot_DOL.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/ec_wii.h"
#ifdef _WIN32
#include <Windows.h>
@@ -68,23 +68,23 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string&
{
}
-static u8 key_sd [0x10] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d};
-static u8 key_ecc [0x1e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
-static u8 key_empty[0x10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static u8 key_sd [0x10] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d};
+static u8 key_ecc [0x1e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
+static u8 key_empty[0x10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
// default key table
u8* CWII_IPC_HLE_Device_es::keyTable[11] = {
- key_ecc, // ECC Private Key
- key_empty, // Console ID
- key_empty, // NAND AES Key
- key_empty, // NAND HMAC
- key_empty, // Common Key
- key_empty, // PRNG seed
- key_sd, // SD Key
- key_empty, // Unknown
- key_empty, // Unknown
- key_empty, // Unknown
- key_empty, // Unknown
+ key_ecc, // ECC Private Key
+ key_empty, // Console ID
+ key_empty, // NAND AES Key
+ key_empty, // NAND HMAC
+ key_empty, // Common Key
+ key_empty, // PRNG seed
+ key_sd, // SD Key
+ key_empty, // Unknown
+ key_empty, // Unknown
+ key_empty, // Unknown
+ key_empty, // Unknown
};
CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es()
@@ -857,12 +857,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
case IOCTL_ES_ENCRYPT:
{
- u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
- u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address);
- u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address);
- u32 size = Buffer.InBuffer[2].m_Size;
- u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
- u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
+ u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
+ u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address);
+ u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address);
+ u32 size = Buffer.InBuffer[2].m_Size;
+ u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
+ u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
aes_context AES_ctx;
aes_setkey_enc(&AES_ctx, keyTable[keyIndex], 128);
@@ -875,12 +875,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
case IOCTL_ES_DECRYPT:
{
- u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
- u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address);
- u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address);
- u32 size = Buffer.InBuffer[2].m_Size;
- u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
- u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
+ u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
+ u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address);
+ u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address);
+ u32 size = Buffer.InBuffer[2].m_Size;
+ u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
+ u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
aes_context AES_ctx;
aes_setkey_dec(&AES_ctx, keyTable[keyIndex], 128);
@@ -898,12 +898,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
bool bSuccess = false;
u16 IOSv = 0xffff;
- u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
- u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
- u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
- u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
- u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
- u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24);
+ u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
+ u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
+ u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
+ u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
+ u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
+ u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24);
if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU)
@@ -988,7 +988,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
Memory::Write_U32(0, _CommandAddress + 0x4);
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x", TitleID,view,ticketid,devicetype,titleid,access);
- // IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff
+ // IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff
// This is necessary because Reset(true) above deleted this object. Ew.
@@ -1016,7 +1016,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT");
_dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1);
- u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
+ u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
EcWii &ec = EcWii::GetInstance();
get_ng_cert(destination, ec.getNgId(), ec.getNgKeyId(), ec.getNgPriv(), ec.getNgSig());
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.h
index 2dd22df..8f4d198 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.h
@@ -5,10 +5,11 @@
#pragma once
#include <map>
-#include "WII_IPC_HLE_Device.h"
-#include "NANDContentLoader.h"
#include <memory>
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+#include "DiscIO/NANDContentLoader.h"
+
class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device
{
public:
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
index 31c5c6f..fbc213c 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
@@ -2,22 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileSearch.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+#include "Common/StringUtil.h"
-#include "WII_IPC_HLE_Device_fs.h"
-#include "WII_IPC_HLE_Device_FileIO.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
-#include "StringUtil.h"
-#include "FileSearch.h"
-#include "FileUtil.h"
-#include "NandPaths.h"
-#include "ChunkFile.h"
-#include "../HW/SystemTimers.h"
-
-#include "../VolumeHandler.h"
-
-#define MAX_NAME (12)
+#define MAX_NAME 12
static Common::replace_v replacements;
@@ -267,13 +265,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
NANDStat fs;
//TODO: scrape the real amounts from somewhere...
- fs.BlockSize = 0x4000;
- fs.FreeUserBlocks = 0x5DEC;
- fs.UsedUserBlocks = 0x1DD4;
- fs.FreeSysBlocks = 0x10;
- fs.UsedSysBlocks = 0x02F0;
- fs.Free_INodes = 0x146B;
- fs.Used_Inodes = 0x0394;
+ fs.BlockSize = 0x4000;
+ fs.FreeUserBlocks = 0x5DEC;
+ fs.UsedUserBlocks = 0x1DD4;
+ fs.FreeSysBlocks = 0x10;
+ fs.UsedSysBlocks = 0x02F0;
+ fs.Free_INodes = 0x146B;
+ fs.Used_Inodes = 0x0394;
*(NANDStat*)Memory::GetPointer(_BufferOut) = fs;
@@ -335,10 +333,10 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
u32 OwnerID = 0;
u16 GroupID = 0x3031; // this is also known as makercd, 01 (0x3031) for nintendo and 08 (0x3038) for MH3 etc
std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn), 64);
- u8 OwnerPerm = 0x3; // read/write
- u8 GroupPerm = 0x3; // read/write
- u8 OtherPerm = 0x3; // read/write
- u8 Attributes = 0x00; // no attributes
+ u8 OwnerPerm = 0x3; // read/write
+ u8 GroupPerm = 0x3; // read/write
+ u8 OtherPerm = 0x3; // read/write
+ u8 Attributes = 0x00; // no attributes
if (File::IsDirectory(Filename))
{
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str());
@@ -360,13 +358,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
if (_BufferOutSize == 76)
{
u32 Addr = _BufferOut;
- Memory::Write_U32(OwnerID, Addr); Addr += 4;
- Memory::Write_U16(GroupID, Addr); Addr += 2;
- memcpy(Memory::GetPointer(Addr), Memory::GetPointer(_BufferIn), 64); Addr += 64;
- Memory::Write_U8(OwnerPerm, Addr); Addr += 1;
- Memory::Write_U8(GroupPerm, Addr); Addr += 1;
- Memory::Write_U8(OtherPerm, Addr); Addr += 1;
- Memory::Write_U8(Attributes, Addr); Addr += 1;
+ Memory::Write_U32(OwnerID, Addr); Addr += 4;
+ Memory::Write_U16(GroupID, Addr); Addr += 2;
+ memcpy(Memory::GetPointer(Addr), Memory::GetPointer(_BufferIn), 64); Addr += 64;
+ Memory::Write_U8(OwnerPerm, Addr); Addr += 1;
+ Memory::Write_U8(GroupPerm, Addr); Addr += 1;
+ Memory::Write_U8(OtherPerm, Addr); Addr += 1;
+ Memory::Write_U8(Attributes, Addr); Addr += 1;
}
return FS_RESULT_OK;
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.h
index 05c6569..f8c7c96 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.h
@@ -4,7 +4,7 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
struct NANDStat
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
index 636c883..64958bc 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
@@ -2,12 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../Core.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-#include "../HW/WII_IPC.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device_hid.h"
-#include "errno.h"
+#include <errno.h>
+
+#include "Core/Core.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/WII_IPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
#define MAX_DEVICE_DEVNUM 256
static u64 hidDeviceAliases[MAX_DEVICE_DEVNUM];
@@ -130,11 +131,11 @@ u32 CWII_IPC_HLE_Device_hid::Update()
bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
{
- u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0;
switch (Parameter)
@@ -205,7 +206,7 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
libusb_submit_transfer(transfer);
//DEBUG_LOG(WII_IPC_HID, "HID::IOCtl(Control)(%02X, %02X) (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
- // bmRequestType, bRequest, BufferIn, BufferInSize, BufferOut, BufferOutSize);
+ // bmRequestType, bRequest, BufferIn, BufferInSize, BufferOut, BufferOutSize);
// It's the async way!
return false;
@@ -237,7 +238,7 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
libusb_submit_transfer(transfer);
//DEBUG_LOG(WII_IPC_HID, "HID::IOCtl(Interrupt %s)(%d,%d,%X) (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
- // Parameter == IOCTL_HID_INTERRUPT_IN ? "In" : "Out", endpoint, length, data, BufferIn, BufferInSize, BufferOut, BufferOutSize);
+ // Parameter == IOCTL_HID_INTERRUPT_IN ? "In" : "Out", endpoint, length, data, BufferIn, BufferInSize, BufferOut, BufferOutSize);
// It's the async way!
return false;
@@ -536,7 +537,8 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
static bool has_warned_about_drivers = false;
#endif
- for (ssize_t i = 0; i < cnt; i++) {
+ for (ssize_t i = 0; i < cnt; i++)
+ {
libusb_device *device = list[i];
struct libusb_device_descriptor desc;
int dRet = libusb_get_device_descriptor (device, &desc);
@@ -610,10 +612,10 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check)
{
- int i;
int pos = -1;
u64 unique_id = ((u64)idVendor << 32) | ((u64)idProduct << 16) | ((u64)bus << 8) | (u64)port;
- for (i=0; i<MAX_DEVICE_DEVNUM; i++)
+
+ for (int i=0; i<MAX_DEVICE_DEVNUM; i++)
{
u64 id = hidDeviceAliases[i] & HID_ID_MASK;
if(id == 0 && pos == -1)
@@ -626,10 +628,12 @@ int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 b
return i;
}
}
+
if(pos != -1)
{
hidDeviceAliases[pos] = unique_id | ((u64)check << 48);
return pos;
}
+
return -1;
}
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h
index a334592..89fb6c8 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.h
@@ -4,12 +4,14 @@
#pragma once
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device.h"
-#include <libusb.h>
-#include "Thread.h"
#include <list>
+#include <libusb.h>
+
+#include "Common/Thread.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
#define MAX_HID_INTERFACES 1
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp
index 0b11154..4bcccd8 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp
@@ -2,24 +2,27 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "WII_IPC_HLE_Device_es.h"
-#include "WII_IPC_HLE_Device_net.h"
-#include "../ConfigManager.h"
-#include "FileUtil.h"
-#include <stdio.h>
+#include <cstdio>
#include <string>
-#include "ICMP.h"
-#include "CommonPaths.h"
-#include "SettingsHandler.h"
-#include "ec_wii.h"
-#include "WII_Socket.h"
+
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/SettingsHandler.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/ec_wii.h"
+#include "Core/IPC_HLE/ICMP.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
+#include "Core/IPC_HLE/WII_Socket.h"
#ifdef _WIN32
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <iphlpapi.h>
-#include "fakepoll.h"
+#include "Core/IPC_HLE/fakepoll.h"
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
@@ -77,11 +80,11 @@ bool CWII_IPC_HLE_Device_net_kd_request::Close(u32 _CommandAddress, bool _bForce
bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
{
- u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0;
switch (Parameter)
@@ -455,7 +458,6 @@ bool CWII_IPC_HLE_Device_net_wd_command::Close(u32 CommandAddress, bool Force)
// This is just for debugging / playing around.
// There really is no reason to implement wd unless we can bend it such that
// we can talk to the DS.
-#include "StringUtil.h"
bool CWII_IPC_HLE_Device_net_wd_command::IOCtlV(u32 CommandAddress)
{
u32 return_value = 0;
@@ -628,11 +630,11 @@ static unsigned int opt_name_mapping[][2] = {
bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
{
- u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0;
switch (Command)
@@ -646,9 +648,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
}
case IOCTL_SO_SOCKET:
{
- u32 af = Memory::Read_U32(BufferIn);
- u32 type = Memory::Read_U32(BufferIn + 0x04);
- u32 prot = Memory::Read_U32(BufferIn + 0x08);
+ u32 af = Memory::Read_U32(BufferIn);
+ u32 type = Memory::Read_U32(BufferIn + 0x04);
+ u32 prot = Memory::Read_U32(BufferIn + 0x08);
WiiSockMan &sm = WiiSockMan::getInstance();
ReturnValue = sm.newSocket(af, type, prot);
@@ -912,9 +914,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
for (int i = 0; i < nfds; i++)
{
- ufds[i].fd = Memory::Read_U32(BufferOut + 0xc*i); //fd
- int events = Memory::Read_U32(BufferOut + 0xc*i + 4); //events
- ufds[i].revents = Memory::Read_U32(BufferOut + 0xc*i + 8); //revents
+ ufds[i].fd = Memory::Read_U32(BufferOut + 0xc*i); //fd
+ int events = Memory::Read_U32(BufferOut + 0xc*i + 4); //events
+ ufds[i].revents = Memory::Read_U32(BufferOut + 0xc*i + 8); //revents
// Translate Wii to native events
int unhandled_events = events;
@@ -951,9 +953,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
}
// No need to change fd or events as they are input only.
- //Memory::Write_U32(ufds[i].fd, BufferOut + 0xc*i); //fd
- //Memory::Write_U32(events, BufferOut + 0xc*i + 4); //events
- Memory::Write_U32(revents, BufferOut + 0xc*i + 8); //revents
+ //Memory::Write_U32(ufds[i].fd, BufferOut + 0xc*i); //fd
+ //Memory::Write_U32(events, BufferOut + 0xc*i + 4); //events
+ Memory::Write_U32(revents, BufferOut + 0xc*i + 8); //revents
DEBUG_LOG(WII_IPC_NET, "IOCTL_SO_POLL socket %d revents %08X events %08X", i, revents, ufds[i].events);
}
@@ -1030,7 +1032,7 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
}
//ERROR_LOG(WII_IPC_NET, "\n%s",
- // ArrayToString(Memory::GetPointer(BufferOut), BufferOutSize, 16).c_str());
+ // ArrayToString(Memory::GetPointer(BufferOut), BufferOutSize, 16).c_str());
ReturnValue = 0;
}
else
@@ -1246,14 +1248,14 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
if (BufferInSize3)
{
- hints.ai_flags = Memory::Read_U32(_BufferIn3);
- hints.ai_family = Memory::Read_U32(_BufferIn3 + 0x4);
- hints.ai_socktype = Memory::Read_U32(_BufferIn3 + 0x8);
- hints.ai_protocol = Memory::Read_U32(_BufferIn3 + 0xC);
- hints.ai_addrlen = Memory::Read_U32(_BufferIn3 + 0x10);
- hints.ai_canonname = NULL;
- hints.ai_addr = NULL;
- hints.ai_next = NULL;
+ hints.ai_flags = Memory::Read_U32(_BufferIn3);
+ hints.ai_family = Memory::Read_U32(_BufferIn3 + 0x4);
+ hints.ai_socktype = Memory::Read_U32(_BufferIn3 + 0x8);
+ hints.ai_protocol = Memory::Read_U32(_BufferIn3 + 0xC);
+ hints.ai_addrlen = Memory::Read_U32(_BufferIn3 + 0x10);
+ hints.ai_canonname = NULL;
+ hints.ai_addr = NULL;
+ hints.ai_next = NULL;
}
char* pNodeName = NULL;
@@ -1336,10 +1338,10 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING %i IPs", num_ip);
}
- ip_info.length = Memory::Read_U8(_BufferIn + 16);
- ip_info.addr_family = Memory::Read_U8(_BufferIn + 17);
- ip_info.icmp_id = Memory::Read_U16(_BufferIn + 18);
- ip_info.ip = Memory::Read_U32(_BufferIn + 20);
+ ip_info.length = Memory::Read_U8(_BufferIn + 16);
+ ip_info.addr_family = Memory::Read_U8(_BufferIn + 17);
+ ip_info.icmp_id = Memory::Read_U16(_BufferIn + 18);
+ ip_info.ip = Memory::Read_U32(_BufferIn + 20);
if (ip_info.length != 8 || ip_info.addr_family != AF_INET)
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
index 38d4728..4c2f112 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.h
@@ -4,13 +4,14 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
+#include "Common/FileUtil.h"
+#include "Common/Timer.h"
+
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
#ifdef _WIN32
#include <ws2tcpip.h>
#endif
-#include "Timer.h"
-#include "FileUtil.h"
// data layout of the network configuration file (/shared2/sys/net/02/config.dat)
// needed for /dev/net/ncd/manage
@@ -22,7 +23,7 @@ struct netcfg_proxy_t
u8 padding_1[2];
u8 proxy_name[255];
u8 padding_2;
- u16 proxy_port; // 0-34463
+ u16 proxy_port; // 0-34463
u8 proxy_username[32];
u8 padding_3;
u8 proxy_password[32];
@@ -91,8 +92,8 @@ struct netcfg_connection_t
u8 padding_7[3];
u8 encryption;
u8 padding_8[3];
- u8 key_length; // length of key in bytes. 0x00 for WEP64 and WEP128.
- u8 unknown; // 0x00 or 0x01 toggled with a WPA-PSK (TKIP) and with a WEP entered with hex instead of ascii.
+ u8 key_length; // length of key in bytes. 0x00 for WEP64 and WEP128.
+ u8 unknown; // 0x00 or 0x01 toggled with a WPA-PSK (TKIP) and with a WEP entered with hex instead of ascii.
u8 padding_9;
u8 key[64]; // encryption key; for WEP, key is stored 4 times (20 bytes for WEP64 and 52 bytes for WEP128) then padded with 0x00
u8 padding_10[236];
@@ -143,11 +144,11 @@ struct nwc24_config_t
MAX_PASSWORD_LENGTH = 0x20,
};
- u32 magic; /* 'WcCf' 0x57634366 */
- u32 _unk_04; /* must be 8 */
+ u32 magic; /* 'WcCf' 0x57634366 */
+ u32 _unk_04; /* must be 8 */
u64 nwc24_id;
u32 id_generation;
- u32 creation_stage; /* 0==not_generated;1==generated;2==registered; */
+ u32 creation_stage; /* 0==not_generated;1==generated;2==registered; */
char email[MAX_EMAIL_LENGTH];
char paswd[MAX_PASSWORD_LENGTH];
char mlchkid[0x24];
@@ -254,7 +255,7 @@ public:
s32 CheckNwc24Config(void)
{
- if (Magic() != 0x57634366) /* 'WcCf' magic */
+ if (Magic() != 0x57634366) /* 'WcCf' magic */
{
ERROR_LOG(WII_IPC_WC24, "Magic mismatch");
return -14;
@@ -472,9 +473,9 @@ public:
virtual bool IOCtl(u32 _CommandAddress)
{
- u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 result = 0;
u32 common_result = 0;
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
index 36d4b2d..ba92259 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileUtil.h"
-#include "WII_IPC_HLE_Device_net_ssl.h"
-#include "WII_Socket.h"
+#include "Common/FileUtil.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
+#include "Core/IPC_HLE/WII_Socket.h"
WII_SSL CWII_IPC_HLE_Device_net_ssl::_SSL[NET_SSL_MAXINSTANCES];
@@ -72,11 +72,11 @@ bool CWII_IPC_HLE_Device_net_ssl::Close(u32 _CommandAddress, bool _bForce)
bool CWII_IPC_HLE_Device_net_ssl::IOCtl(u32 _CommandAddress)
{
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
- u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
INFO_LOG(WII_IPC_SSL, "%s unknown %i "
"(BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
index 25b1abd..6b8f224 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h
@@ -4,12 +4,12 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
-
#include <polarssl/net.h>
#include <polarssl/ssl.h>
#include <polarssl/havege.h>
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+
#define NET_SSL_MAX_HOSTNAME_LEN 256
#define NET_SSL_MAXINSTANCES 4
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
index 0b8e8bb..985927a 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
@@ -2,17 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "../ConfigManager.h"
+#include "Common/Common.h"
+#include "Common/SDCardUtil.h"
-#include "SDCardUtil.h"
+#include "Core/Core.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device_sdio_slot0.h"
-
-#include "../HW/CPU.h"
-#include "../HW/Memmap.h"
-#include "../Core.h"
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
@@ -97,17 +96,18 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
{
u32 Cmd = Memory::Read_U32(_CommandAddress + 0xC);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// As a safety precaution we fill the out buffer with zeros to avoid
// returning nonsense values
Memory::Memset(BufferOut, 0, BufferOutSize);
u32 ReturnValue = 0;
- switch (Cmd) {
+ switch (Cmd)
+ {
case IOCTL_WRITEHCR:
{
u32 reg = Memory::Read_U32(BufferIn);
@@ -203,10 +203,10 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
break;
}
-// INFO_LOG(WII_IPC_SD, "InBuffer");
-// DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
-// INFO_LOG(WII_IPC_SD, "OutBuffer");
-// DumpCommands(BufferOut, BufferOutSize/4, LogTypes::WII_IPC_SD);
+ // INFO_LOG(WII_IPC_SD, "InBuffer");
+ // DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
+ // INFO_LOG(WII_IPC_SD, "OutBuffer");
+ // DumpCommands(BufferOut, BufferOutSize/4, LogTypes::WII_IPC_SD);
if (ReturnValue == RET_EVENT_REGISTER)
{
@@ -273,8 +273,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
}
u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize,
- u32 _rwBuffer, u32 _rwBufferSize,
- u32 _BufferOut, u32 _BufferOutSize)
+ u32 _rwBuffer, u32 _rwBufferSize,
+ u32 _BufferOut, u32 _BufferOutSize)
{
// The game will send us a SendCMD with this information. To be able to read and write
// to a file we need to prepare a 0x10 byte output buffer as response.
@@ -291,14 +291,14 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
} req;
req.command = Memory::Read_U32(_BufferIn + 0);
- req.type = Memory::Read_U32(_BufferIn + 4);
- req.resp = Memory::Read_U32(_BufferIn + 8);
- req.arg = Memory::Read_U32(_BufferIn + 12);
- req.blocks = Memory::Read_U32(_BufferIn + 16);
- req.bsize = Memory::Read_U32(_BufferIn + 20);
- req.addr = Memory::Read_U32(_BufferIn + 24);
- req.isDMA = Memory::Read_U32(_BufferIn + 28);
- req.pad0 = Memory::Read_U32(_BufferIn + 32);
+ req.type = Memory::Read_U32(_BufferIn + 4);
+ req.resp = Memory::Read_U32(_BufferIn + 8);
+ req.arg = Memory::Read_U32(_BufferIn + 12);
+ req.blocks = Memory::Read_U32(_BufferIn + 16);
+ req.bsize = Memory::Read_U32(_BufferIn + 20);
+ req.addr = Memory::Read_U32(_BufferIn + 24);
+ req.isDMA = Memory::Read_U32(_BufferIn + 28);
+ req.pad0 = Memory::Read_U32(_BufferIn + 32);
// Note: req.addr is the virtual address of _rwBuffer
@@ -332,7 +332,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
case SEND_CSD:
DEBUG_LOG(WII_IPC_SD, "SEND_CSD");
// <WntrMute> shuffle2_, OCR: 0x80ff8000 CID: 0x38a00000 0x480032d5 0x3c608030 0x8803d420
- // CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600
+ // CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600
// Values used currently are from lpfaint99
Memory::Write_U32(0x80168000, _BufferOut);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
index 6987fdf..b237c67 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
@@ -6,7 +6,7 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.h
index 7af9a5a..10b5ef5 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_stm.h
@@ -4,24 +4,24 @@
#pragma once
-#include "WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
enum
{
- IOCTL_STM_EVENTHOOK = 0x1000,
- IOCTL_STM_GET_IDLEMODE = 0x3001,
- IOCTL_STM_RELEASE_EH = 0x3002,
- IOCTL_STM_HOTRESET = 0x2001,
- IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
- IOCTL_STM_SHUTDOWN = 0x2003,
- IOCTL_STM_IDLE = 0x2004,
- IOCTL_STM_WAKEUP = 0x2005,
- IOCTL_STM_VIDIMMING = 0x5001,
- IOCTL_STM_LEDFLASH = 0x6001,
- IOCTL_STM_LEDMODE = 0x6002,
- IOCTL_STM_READVER = 0x7001,
- IOCTL_STM_READDDRREG = 0x4001,
- IOCTL_STM_READDDRREG2 = 0x4002,
+ IOCTL_STM_EVENTHOOK = 0x1000,
+ IOCTL_STM_GET_IDLEMODE = 0x3001,
+ IOCTL_STM_RELEASE_EH = 0x3002,
+ IOCTL_STM_HOTRESET = 0x2001,
+ IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
+ IOCTL_STM_SHUTDOWN = 0x2003,
+ IOCTL_STM_IDLE = 0x2004,
+ IOCTL_STM_WAKEUP = 0x2005,
+ IOCTL_STM_VIDIMMING = 0x5001,
+ IOCTL_STM_LEDFLASH = 0x6001,
+ IOCTL_STM_LEDMODE = 0x6002,
+ IOCTL_STM_READVER = 0x7001,
+ IOCTL_STM_READDDRREG = 0x4001,
+ IOCTL_STM_READDDRREG2 = 0x4002,
};
// The /dev/stm/immediate
@@ -55,11 +55,11 @@ public:
virtual bool IOCtl(u32 _CommandAddress)
{
- u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values
@@ -145,11 +145,11 @@ public:
virtual bool IOCtl(u32 _CommandAddress)
{
- u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
- u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
- u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
- u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// Prepare the out buffer(s) with zeros as a safety precaution
// to avoid returning bad values
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
index aa7d84d..22e1838 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
@@ -2,17 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../Core.h"
-#include "../Debugger/Debugger_SymbolMap.h"
-#include "../Host.h"
-#include "../HW/SystemTimers.h"
-#include "../HW/Wiimote.h"
-#include "../HW/WII_IPC.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device_usb.h"
-#include "../ConfigManager.h"
-#include "../Movie.h"
-#include "CoreTiming.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Host.h"
+#include "Core/Movie.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WII_IPC.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
// The device class
CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName)
@@ -150,7 +150,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Close(u32 _CommandAddress, bool _bForc
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress)
{
//ERROR_LOG(WII_IPC_WIIMOTE, "Passing ioctl to ioctlv");
- return IOCtlV(_CommandAddress); //hack
+ return IOCtlV(_CommandAddress); // FIXME: Hack
}
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
@@ -177,14 +177,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
case USBV0_IOCTL_CTRLMSG: // HCI command is received from the stack
{
// This is the HCI datapath from CPU to Wiimote, the USB stuff is little endian..
- m_CtrlSetup.bRequestType = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
- m_CtrlSetup.bRequest = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
- m_CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address);
- m_CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address);
- m_CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address);
- m_CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address;
- m_CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
- m_CtrlSetup.m_Address = CommandBuffer.m_Address;
+ m_CtrlSetup.bRequestType = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
+ m_CtrlSetup.bRequest = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
+ m_CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address);
+ m_CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address);
+ m_CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address);
+ m_CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address;
+ m_CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
+ m_CtrlSetup.m_Address = CommandBuffer.m_Address;
// check termination
_dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0,
@@ -333,8 +333,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLPacket(u16 _ConnectionHandle, u
DEBUG_LOG(WII_IPC_WIIMOTE, "ACL endpoint valid, sending packet to %08x", m_ACLEndpoint.m_address);
hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(m_ACLEndpoint.m_buffer);
- pHeader->con_handle = HCI_MK_CON_HANDLE(_ConnectionHandle, HCI_PACKET_START, HCI_POINT2POINT);
- pHeader->length = _Size;
+ pHeader->con_handle = HCI_MK_CON_HANDLE(_ConnectionHandle, HCI_PACKET_START, HCI_POINT2POINT);
+ pHeader->length = _Size;
// Write the packet to the buffer
memcpy((u8*)pHeader + sizeof(hci_acldata_hdr_t), _pData, pHeader->length);
@@ -470,7 +470,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
m_last_ticks = now;
}
- SendEventNumberOfCompletedPackets();
+ SendEventNumberOfCompletedPackets();
return packet_transferred;
}
@@ -507,8 +507,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::WriteToEndpoint(CtrlBuffer& e
"queue to %08x", endpoint.m_address);
hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(endpoint.m_buffer);
- pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT);
- pHeader->length = size;
+ pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT);
+ pHeader->length = size;
// Write the packet to the buffer
std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t));
@@ -607,9 +607,9 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdad
static char s_szLinkType[][128] =
{
- { "HCI_LINK_SCO 0x00 - Voice"},
- { "HCI_LINK_ACL 0x01 - Data"},
- { "HCI_LINK_eSCO 0x02 - eSCO"},
+ { "HCI_LINK_SCO 0x00 - Voice"},
+ { "HCI_LINK_ACL 0x01 - Data"},
+ { "HCI_LINK_eSCO 0x02 - eSCO"},
};
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventConnectionComplete");
@@ -642,9 +642,9 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL
static char LinkType[][128] =
{
- { "HCI_LINK_SCO 0x00 - Voice"},
- { "HCI_LINK_ACL 0x01 - Data" },
- { "HCI_LINK_eSCO 0x02 - eSCO" },
+ { "HCI_LINK_SCO 0x00 - Voice"},
+ { "HCI_LINK_ACL 0x01 - Data" },
+ { "HCI_LINK_eSCO 0x02 - eSCO" },
};
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventRequestConnection");
@@ -870,12 +870,12 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
- hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
- hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
- hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
+ hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
+ hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
+ hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
- event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS;
- event_hdr->length = sizeof(hci_num_compl_pkts_ep);
+ event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS;
+ event_hdr->length = sizeof(hci_num_compl_pkts_ep);
event->num_con_handles = 0;
u32 acc = 0;
@@ -941,10 +941,10 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const u8
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventLinkKeyNotification");
// event header
- pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS;
- pEventLinkKey->PayloadLength = payload_length;
+ pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS;
+ pEventLinkKey->PayloadLength = payload_length;
// this is really hci_return_link_keys_ep.num_keys
- pEventLinkKey->numKeys = num_to_send;
+ pEventLinkKey->numKeys = num_to_send;
// copy infos - this only works correctly if we're meant to start at first device and read all keys
for (int i = 0; i < num_to_send; i++)
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h
index 396d5db..0cdcea9 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb.h
@@ -5,14 +5,14 @@
#pragma once
#include <algorithm>
-#include <vector>
#include <queue>
+#include <vector>
-#include "hci.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device.h"
-#include "WII_IPC_HLE_WiiMote.h"
-#include "../HW/Wiimote.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/IPC_HLE/hci.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
struct SQueuedEvent
{
@@ -112,8 +112,8 @@ private:
{
if (m_address)
{
- u32 InBufferNum = Memory::Read_U32(m_address + 0x10);
- u32 BufferVector = Memory::Read_U32(m_address + 0x18);
+ u32 InBufferNum = Memory::Read_U32(m_address + 0x10);
+ u32 BufferVector = Memory::Read_U32(m_address + 0x18);
m_buffer = Memory::Read_U32(
BufferVector + InBufferNum * sizeof(SIOCtlVBuffer::SBuffer));
}
@@ -218,7 +218,7 @@ private:
// Execute HCI Message
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
- // OGF 0x01 Link control commands and return parameters
+ // OGF 0x01 - Link control commands and return parameters
void CommandWriteInquiryMode(u8* _Input);
void CommandWritePageScanType(u8* _Input);
void CommandHostBufferSize(u8* _Input);
@@ -237,11 +237,11 @@ private:
void CommandDeleteStoredLinkKey(u8* _Input);
void CommandChangeConPacketType(u8* _Input);
- // OGF 0x02 Link policy commands and return parameters
+ // OGF 0x02 - Link policy commands and return parameters
void CommandWriteLinkPolicy(u8* _Input);
void CommandSniffMode(u8* _Input);
- // OGF 0x03 Host Controller and Baseband commands and return parameters
+ // OGF 0x03 - Host Controller and Baseband commands and return parameters
void CommandReset(u8* _Input);
void CommandWriteLocalName(u8* _Input);
void CommandWritePageTimeOut(u8* _Input);
@@ -253,13 +253,13 @@ private:
void CommandWriteInquiryScanType(u8* _Input);
void CommandWriteLinkSupervisionTimeout(u8* _Input);
- // OGF 0x04 Informational commands and return parameters
+ // OGF 0x04 - Informational commands and return parameters
void CommandReadBufferSize(u8* _Input);
void CommandReadLocalVer(u8* _Input);
void CommandReadLocalFeatures(u8* _Input);
void CommandReadBDAdrr(u8* _Input);
- // OGF 0x3F Vendor specific
+ // OGF 0x3F - Vendor specific
void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size);
void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
index 4300ecc..a50a47c 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../ConfigManager.h"
-#include "../Core.h" // Local core functions
-#include "WII_IPC_HLE_Device_usb.h"
-#include "WII_IPC_HLE_Device_usb_kbd.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h" // Local core functions
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
#ifdef _WIN32
#include <windows.h>
@@ -59,7 +60,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Write(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_usb_kbd::IOCtl(u32 _CommandAddress)
{
- u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
if (SConfig::GetInstance().m_WiiKeyboard && !m_MessageQueue.empty())
{
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp
index d873914..da50bc3 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp
@@ -2,17 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h" // Common
-#include "StringUtil.h"
-
-#include "WII_IPC_HLE_WiiMote.h" // Core
-#include "WII_IPC_HLE_Device_usb.h"
-#include "../ConfigManager.h"
-#include "../Host.h"
-#include "../Core.h"
-#include "../HW/Wiimote.h"
-#include "l2cap.h" // Local
-#include "WiiMote_HID_Attr.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
+#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
+
+#include "Core/IPC_HLE/l2cap.h" // Local
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = NULL;
@@ -404,7 +405,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConnectionResponse");
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", rsp->dcid);
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
- DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
+ DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
DEBUG_LOG(WII_IPC_WIIMOTE, " Status: 0x%04x", rsp->status);
_dbg_assert_(WII_IPC_WIIMOTE, rsp->result == L2CAP_SUCCESS);
@@ -503,7 +504,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConfigurationResponse");
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", rsp->flags);
- DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
+ DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
_dbg_assert_(WII_IPC_WIIMOTE, rsp->result == L2CAP_SUCCESS);
@@ -591,7 +592,8 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
l2cap_cfg_req_cp* cr = (l2cap_cfg_req_cp*)&Buffer[Offset];
cr->dcid = rChannel.DCID;
- cr->flags = 0; Offset += sizeof(l2cap_cfg_req_cp);
+ cr->flags = 0;
+ Offset += sizeof(l2cap_cfg_req_cp);
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationRequest");
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr->dcid);
@@ -607,10 +609,10 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
{
if (MTU == 0)
MTU = rChannel.MTU;
- pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
- pOptions->type = L2CAP_OPT_MTU;
- pOptions->length = L2CAP_OPT_MTU_SIZE;
- *(u16*)&Buffer[Offset] = MTU; Offset += L2CAP_OPT_MTU_SIZE;
+ pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
+ pOptions->type = L2CAP_OPT_MTU;
+ pOptions->length = L2CAP_OPT_MTU_SIZE;
+ *(u16*)&Buffer[Offset] = MTU; Offset += L2CAP_OPT_MTU_SIZE;
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", MTU);
}
@@ -618,10 +620,10 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
{
if (FlushTimeOut == 0)
FlushTimeOut = rChannel.FlushTimeOut;
- pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
- pOptions->type = L2CAP_OPT_FLUSH_TIMO;
- pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE;
- *(u16*)&Buffer[Offset] = FlushTimeOut; Offset += L2CAP_OPT_FLUSH_TIMO_SIZE;
+ pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
+ pOptions->type = L2CAP_OPT_FLUSH_TIMO;
+ pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE;
+ *(u16*)&Buffer[Offset] = FlushTimeOut; Offset += L2CAP_OPT_FLUSH_TIMO_SIZE;
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut);
}
@@ -640,11 +642,11 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
//
//
-#define SDP_UINT8 0x08
-#define SDP_UINT16 0x09
-#define SDP_UINT32 0x0A
-#define SDP_SEQ8 0x35
-#define SDP_SEQ16 0x36
+#define SDP_UINT8 0x08
+#define SDP_UINT16 0x09
+#define SDP_UINT32 0x0A
+#define SDP_SEQ8 0x35
+#define SDP_SEQ16 0x36
void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID, u8* pServiceSearchPattern, u16 MaximumServiceRecordCount)
{
@@ -666,13 +668,13 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
pHeader->dcid = cid;
- buffer.Write8 (Offset, 0x03); Offset++;
- buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID
- buffer.Write16(Offset, 0x0009); Offset += 2; // param length
- buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount
- buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount
- buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4]
- buffer.Write8(Offset, 0x00); Offset++; // no continuation state;
+ buffer.Write8 (Offset, 0x03); Offset++;
+ buffer.Write16(Offset, TransactionID); Offset += 2; // Transaction ID
+ buffer.Write16(Offset, 0x0009); Offset += 2; // Param length
+ buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount
+ buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount
+ buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4]
+ buffer.Write8(Offset, 0x00); Offset++; // No continuation state;
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
@@ -683,7 +685,7 @@ static u32 ParseCont(u8* pCont)
{
u32 attribOffset = 0;
CBigEndianBuffer attribList(pCont);
- u8 typeID = attribList.Read8(attribOffset); attribOffset++;
+ u8 typeID = attribList.Read8(attribOffset); attribOffset++;
if (typeID == 0x02)
{
@@ -704,9 +706,9 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
u32 attribOffset = 0;
CBigEndianBuffer attribList(pAttribIDList);
- u8 sequence = attribList.Read8(attribOffset); attribOffset++;
- u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
- u8 typeID = attribList.Read8(attribOffset); attribOffset++;
+ u8 sequence = attribList.Read8(attribOffset); attribOffset++;
+ u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
+ u8 typeID = attribList.Read8(attribOffset); attribOffset++;
#if MAX_LOGLEVEL >= DEBUG_LEVEL
_dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
@@ -717,12 +719,12 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
if (typeID == SDP_UINT32)
{
- _startID = attribList.Read16(attribOffset); attribOffset += 2;
- _endID = attribList.Read16(attribOffset); attribOffset += 2;
+ _startID = attribList.Read16(attribOffset); attribOffset += 2;
+ _endID = attribList.Read16(attribOffset); attribOffset += 2;
}
else
{
- _startID = attribList.Read16(attribOffset); attribOffset += 2;
+ _startID = attribList.Read16(attribOffset); attribOffset += 2;
_endID = _startID;
DEBUG_LOG(WII_IPC_WIIMOTE, "Read just a single attrib - not tested");
PanicAlert("Read just a single attrib - not tested");
@@ -733,8 +735,8 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle,
- u16 startAttrID, u16 endAttrID,
- u16 MaximumAttributeByteCount, u8* pContinuationState)
+ u16 startAttrID, u16 endAttrID,
+ u16 MaximumAttributeByteCount, u8* pContinuationState)
{
if (ServiceHandle != 0x10000)
{
@@ -743,7 +745,7 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
}
-// _dbg_assert_(WII_IPC_WIIMOTE, ServiceHandle == 0x10000);
+ // _dbg_assert_(WII_IPC_WIIMOTE, ServiceHandle == 0x10000);
u32 contState = ParseCont(pContinuationState);
@@ -755,23 +757,23 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
CBigEndianBuffer buffer(DataFrame);
int Offset = 0;
- l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
+ l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
pHeader->dcid = cid;
- buffer.Write8 (Offset, 0x05); Offset++;
- buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID
+ buffer.Write8 (Offset, 0x05); Offset++;
+ buffer.Write16(Offset, TransactionID); Offset += 2; // Transaction ID
- memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize;
+ memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize;
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
- // Debugger::PrintDataBuffer(LogTypes::WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "test response: ");
+ // Debugger::PrintDataBuffer(LogTypes::WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "test response: ");
}
void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
{
- // Debugger::PrintDataBuffer(LogTypes::WIIMOTE, _pData, _Size, "HandleSDP: ");
+ // Debugger::PrintDataBuffer(LogTypes::WIIMOTE, _pData, _Size, "HandleSDP: ");
CBigEndianBuffer buffer(_pData);
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.h
index 5e4bd85..afa78d7 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.h
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.h
@@ -6,8 +6,9 @@
#include <map>
#include <string>
-#include "hci.h"
-#include "ChunkFile.h"
+
+#include "Common/ChunkFile.h"
+#include "Core/IPC_HLE/hci.h"
class CWII_IPC_HLE_Device_usb_oh1_57e_305;
@@ -19,15 +20,15 @@ class CBigEndianBuffer
public:
CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
- u8 Read8(u32 offset) { return m_pBuffer[offset]; }
- u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
- u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
+ u8 Read8(u32 offset) { return m_pBuffer[offset]; }
+ u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
+ u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
- void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
- void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
- void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
+ void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
+ void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
+ void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
- u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; }
+ u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; }
private:
u8* m_pBuffer;
@@ -51,8 +52,8 @@ public:
bool LinkChannel();
void ResetChannels();
void Activate(bool ready);
- void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
- void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote
+ void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
+ void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote
int NetPlay_GetWiimoteNum(int _number);
@@ -73,7 +74,7 @@ public:
private:
enum ConnectionState
{
- CONN_INACTIVE = -1,
+ CONN_INACTIVE = -1,
CONN_READY,
CONN_LINKING,
CONN_COMPLETE
diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/IPC_HLE/WII_Socket.cpp
index 3565577..d036a88 100644
--- a/Source/Core/Core/IPC_HLE/WII_Socket.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_Socket.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "WII_Socket.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device.h"
-// No Wii socket support while using NetPlay or TAS
-#include "NetPlayProto.h"
-#include "Movie.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
+#include "Core/IPC_HLE/WII_Socket.h" // No Wii socket support while using NetPlay or TAS
+
using WII_IPC_HLE_Interface::ECommandType;
using WII_IPC_HLE_Interface::COMMAND_IOCTL;
@@ -150,9 +150,9 @@ s32 WiiSocket::closeFd()
s32 WiiSocket::_fcntl(u32 cmd, u32 arg)
{
-#define F_GETFL 3
-#define F_SETFL 4
-#define F_NONBLOCK 4
+#define F_GETFL 3
+#define F_SETFL 4
+#define F_NONBLOCK 4
s32 ret = 0;
if (cmd == F_GETFL)
{
@@ -192,8 +192,8 @@ void WiiSocket::update(bool read, bool write, bool except)
{
case IOCTL_SO_FCNTL:
{
- u32 cmd = Memory::Read_U32(BufferIn + 4);
- u32 arg = Memory::Read_U32(BufferIn + 8);
+ u32 cmd = Memory::Read_U32(BufferIn + 4);
+ u32 arg = Memory::Read_U32(BufferIn + 8);
ReturnValue = _fcntl(cmd, arg);
break;
}
@@ -490,7 +490,6 @@ void WiiSocket::update(bool read, bool write, bool except)
BufferOutSize2 ? &addrlen : 0);
ReturnValue = WiiSockMan::getNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true);
-
INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
@@ -510,7 +509,6 @@ void WiiSocket::update(bool read, bool write, bool except)
break;
}
}
-
}
if ( nonBlock || forceNonBlock
diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.h b/Source/Core/Core/IPC_HLE/WII_Socket.h
index 5bfaa5a..cb0a9db 100644
--- a/Source/Core/Core/IPC_HLE/WII_Socket.h
+++ b/Source/Core/Core/IPC_HLE/WII_Socket.h
@@ -39,16 +39,16 @@ typedef struct pollfd pollfd_t;
#include <errno.h>
#endif
-#include <algorithm> // std::for_each
-#include <unordered_map>
-#include <stdio.h>
-#include <string>
+#include <algorithm>
+#include <cstdio>
#include <list>
+#include <string>
+#include <unordered_map>
-#include "FileUtil.h"
-#include "WII_IPC_HLE.h"
-#include "WII_IPC_HLE_Device_net.h"
-#include "WII_IPC_HLE_Device_net_ssl.h"
+#include "Common/FileUtil.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
enum {
SO_MSG_OOB = 0x01,
@@ -187,7 +187,7 @@ private:
public:
WiiSocket() : fd(-1), nonBlock(false) {}
~WiiSocket();
- void operator=(WiiSocket const&); // Don't implement
+ void operator=(WiiSocket const&); // Don't implement
};
@@ -200,7 +200,7 @@ public:
static WiiSockMan& getInstance()
{
static WiiSockMan instance; // Guaranteed to be destroyed.
- return instance; // Instantiated on first use.
+ return instance; // Instantiated on first use.
}
void Update();
static void EnqueueReply(u32 CommandAddress, s32 ReturnValue);
diff --git a/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp b/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp
index f919b4d..00cc60b 100644
--- a/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp
+++ b/Source/Core/Core/IPC_HLE/WiiMote_HID_Attr.cpp
@@ -2,44 +2,64 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
#include <vector>
-#include "WiiMote_HID_Attr.h"
+
+#include "Common/Common.h"
+#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
#if 0
// 0x00 (checked)
u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 };
+
// 0x01 (checked)
-u8 SrvClassIDList[] = { 0x35, 0x03,
- 0x19, 0x11, 0x24 };
+u8 SrvClassIDList[] = {
+ 0x35, 0x03,
+ 0x19, 0x11, 0x24
+};
+
// 0x04 (checked)
-u8 ProtocolDescriptorList[] = { 0x35, 0x0D,
- 0x35, 0x06,
- 0x19, 0x01, 0x00, // Element 0
- 0x09, 0x00, 0x11, // Element 1
- 0x35, 0x03,
- 0x19, 0x00, 0x11}; // Element 0
+u8 ProtocolDescriptorList[] = {
+ 0x35, 0x0D,
+ 0x35, 0x06,
+ 0x19, 0x01, 0x00, // Element 0
+ 0x09, 0x00, 0x11, // Element 1
+ 0x35, 0x03,
+ 0x19, 0x00, 0x11 // Element 0
+};
+
// 0x5 (checked)
-u8 BrowseGroupList[] = { 0x35, 0x03,
- 0x19, 0x10, 0x02 };
+u8 BrowseGroupList[] = {
+ 0x35, 0x03,
+ 0x19, 0x10, 0x02
+};
+
// 0x6 (checked)
-u8 LanguageBaseAttributeIDList[] = { 0x35, 0x09,
- 0x09, 0x65, 0x6e,
- 0x09, 0x00, 0x6a,
- 0x09, 0x01, 0x00 };
+u8 LanguageBaseAttributeIDList[] = {
+ 0x35, 0x09,
+ 0x09, 0x65, 0x6e,
+ 0x09, 0x00, 0x6a,
+ 0x09, 0x01, 0x00
+};
+
// 0x09 (checked)
-u8 BluetoothProfileDescriptorList[] = { 0x35, 0x08,
- 0x35, 0x06,
- 0x19, 0x11, 0x24,
- 0x09, 0x01, 0x00 };
+u8 BluetoothProfileDescriptorList[] = {
+ 0x35, 0x08,
+ 0x35, 0x06,
+ 0x19, 0x11, 0x24,
+ 0x09, 0x01, 0x00
+};
+
// 0x0D (checked)
-u8 AdditionalProtocolDescriptorLists[] = { 0x35, 0x0F,
- 0x35, 0x0D,
- 0x35, 0x06,
- 0x19, 0x01, 0x00,
- 0x09, 0x00, 0x13,
- 0x35, 0x03,
- 0x19, 0x00, 0x11 };
+u8 AdditionalProtocolDescriptorLists[] = {
+ 0x35, 0x0F,
+ 0x35, 0x0D,
+ 0x35, 0x06,
+ 0x19, 0x01, 0x00,
+ 0x09, 0x00, 0x13,
+ 0x35, 0x03,
+ 0x19, 0x00, 0x11
+};
+
// 0x100
u8 ServiceName[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' };
// 0x101
@@ -61,47 +81,50 @@ u8 HIDVirtualCable[] = { 0x09, 0x00, 0x00 };
u8 HIDReconnectInitiate[] = { 0x09, 0x00, 0x01 };
// 0x206
-u8 HIDDescriptorList[] = { 0x35, 0xDF,
- 0x35, 0xDD,
- 0x08, 0x22, // Element 0
- 0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data
-
- // 0xD9 Bytes - Element 1
- 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10,
- 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
- 0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
- 0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
- 0xc0 }; // end tag
+u8 HIDDescriptorList[] = {
+ 0x35, 0xDF,
+ 0x35, 0xDD,
+ 0x08, 0x22, // Element 0
+ 0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data
+ // 0xD9 Bytes - Element 1
+ 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10,
+ 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
+ 0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
+ 0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
+ 0xc0 // end tag
+};
// 0x207
-u8 HIDLANGIDBaseList[] = { 0x35, 0x08,
- 0x35, 0x06,
- 0x09, 0x04, 0x09,
- 0x09, 0x01, 0x00 };
+u8 HIDLANGIDBaseList[] = {
+ 0x35, 0x08,
+ 0x35, 0x06,
+ 0x09, 0x04, 0x09,
+ 0x09, 0x01, 0x00
+};
// 0x208
u8 HIDSDPDisable[] = { 0x28, 0x00 };
@@ -143,7 +166,6 @@ static u8 packet2[] = {
};
static u8 packet3[] = {
-
0x00, 0x7b, 0x00, 0x76, 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, 0x85,
diff --git a/Source/Core/Core/MemTools.h b/Source/Core/Core/MemTools.h
index 7dc7e20..276af3d 100644
--- a/Source/Core/Core/MemTools.h
+++ b/Source/Core/Core/MemTools.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
namespace EMM
diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp
index b02b74b..242ac4e 100644
--- a/Source/Core/Core/Movie.cpp
+++ b/Source/Core/Core/Movie.cpp
@@ -2,28 +2,30 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Movie.h"
-
-#include "Core.h"
-#include "ConfigManager.h"
-#include "Thread.h"
-#include "FileUtil.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/SI.h"
-#include "HW/Wiimote.h"
-#include "HW/WiimoteEmu/WiimoteEmu.h"
-#include "HW/WiimoteEmu/WiimoteHid.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-#include "State.h"
-#include "Timer.h"
-#include "VideoConfig.h"
-#include "HW/EXI.h"
-#include "HW/EXI_Device.h"
-#include "HW/EXI_Channel.h"
-#include "HW/DVDInterface.h"
-#include "../Common/NandPaths.h"
#include "polarssl/md5.h"
-#include "NetPlayProto.h"
+
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/State.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/EXI_Channel.h"
+#include "Core/HW/EXI_Device.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/HW/WiimoteEmu/WiimoteHid.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoConfig.h"
// The chunk to allocate movie data in multiples of.
#define DTM_BASE_LENGTH (1024)
@@ -605,14 +607,14 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
void CheckPadStatus(SPADStatus *PadStatus, int controllerID)
{
- g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
- g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
- g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0);
- g_padState.Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
- g_padState.Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
+ g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
+ g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
+ g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0);
+ g_padState.Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
+ g_padState.Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
g_padState.Start = ((PadStatus->button & PAD_BUTTON_START) != 0);
- g_padState.DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
+ g_padState.DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
g_padState.DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0);
g_padState.DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
g_padState.DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);
diff --git a/Source/Core/Core/Movie.h b/Source/Core/Core/Movie.h
index 912b8cb..d8709d5 100644
--- a/Source/Core/Core/Movie.h
+++ b/Source/Core/Core/Movie.h
@@ -4,12 +4,12 @@
#pragma once
-#include "Common.h"
-#include "../InputCommon/GCPadStatus.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include <string>
+#include "InputCommon/GCPadStatus.h"
-#include "ChunkFile.h"
+#include <string>
namespace WiimoteEmu
{
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index 02b71e4..a77c7f5 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -2,30 +2,30 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "NetPlayClient.h"
+#include "Core/NetPlayClient.h"
// for wiimote
-#include "HW/WiimoteReal/WiimoteReal.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-#include "IPC_HLE/WII_IPC_HLE_WiiMote.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
// for gcpad
-#include "HW/SI.h"
-#include "HW/SI_DeviceGCController.h"
-#include "HW/SI_DeviceGCSteeringWheel.h"
-#include "HW/SI_DeviceDanceMat.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/SI_DeviceDanceMat.h"
+#include "Core/HW/SI_DeviceGCController.h"
+#include "Core/HW/SI_DeviceGCSteeringWheel.h"
// for gctime
-#include "HW/EXI_DeviceIPL.h"
+#include "Core/HW/EXI_DeviceIPL.h"
// for wiimote/ OSD messages
-#include "Core.h"
-#include "ConfigManager.h"
-#include "Movie.h"
-#include "HW/WiimoteEmu/WiimoteEmu.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
std::mutex crit_netplay_client;
static NetPlayClient * netplay_client = NULL;
NetSettings g_NetPlaySettings;
-#define RPT_SIZE_HACK (1 << 16)
+#define RPT_SIZE_HACK (1 << 16)
NetPad::NetPad()
{
@@ -879,7 +879,7 @@ u32 CEXIIPL::NetPlay_GetGCTime()
std::lock_guard<std::mutex> lk(crit_netplay_client);
if (netplay_client)
- return NETPLAY_INITIAL_GCTIME; // watev
+ return NETPLAY_INITIAL_GCTIME; // watev
else
return 0;
}
diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h
index 933072c..81562de 100644
--- a/Source/Core/Core/NetPlayClient.h
+++ b/Source/Core/Core/NetPlayClient.h
@@ -4,22 +4,22 @@
#pragma once
-#include "Common.h"
-#include "CommonTypes.h"
-#include "Thread.h"
-#include "Timer.h"
-
-#include <SFML/Network.hpp>
-
-#include "NetPlayProto.h"
-#include "GCPadStatus.h"
-
#include <functional>
#include <map>
#include <queue>
#include <sstream>
-#include "FifoQueue.h"
+#include <SFML/Network.hpp>
+
+#include "Common/Common.h"
+#include "Common/CommonTypes.h"
+#include "Common/FifoQueue.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/NetPlayProto.h"
+
+#include "InputCommon/GCPadStatus.h"
class NetPad
{
@@ -51,10 +51,10 @@ public:
class Player
{
public:
- PlayerId pid;
- std::string name;
- std::string revision;
- u32 ping;
+ PlayerId pid;
+ std::string name;
+ std::string revision;
+ u32 ping;
};
class NetPlayClient
diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h
index be99a88..14eb998 100644
--- a/Source/Core/Core/NetPlayProto.h
+++ b/Source/Core/Core/NetPlayProto.h
@@ -4,9 +4,10 @@
#pragma once
-#include "Common.h"
-#include "CommonTypes.h"
-#include "HW/EXI_Device.h"
+#include "Common/Common.h"
+#include "Common/CommonTypes.h"
+
+#include "Core/HW/EXI_Device.h"
struct NetSettings
{
@@ -60,10 +61,10 @@ enum
NP_MSG_PLAYER_PING_DATA = 0xE2,
};
-typedef u8 MessageId;
-typedef u8 PlayerId;
-typedef s8 PadMapping;
-typedef u32 FrameNum;
+typedef u8 MessageId;
+typedef u8 PlayerId;
+typedef s8 PadMapping;
+typedef u32 FrameNum;
enum
{
@@ -72,6 +73,7 @@ enum
CON_ERR_VERSION_MISMATCH = 3
};
-namespace NetPlay {
+namespace NetPlay
+{
bool IsNetPlayRunning();
};
diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp
index 91fa402..f02b3c0 100644
--- a/Source/Core/Core/NetPlayServer.cpp
+++ b/Source/Core/Core/NetPlayServer.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "NetPlayServer.h"
+#include "Core/NetPlayServer.h"
NetPlayServer::~NetPlayServer()
{
@@ -211,7 +211,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
m_players[socket] = player;
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
- UpdatePadMapping(); // sync pad mappings with everyone
+ UpdatePadMapping(); // sync pad mappings with everyone
UpdateWiimoteMapping();
}
@@ -486,7 +486,7 @@ void NetPlayServer::SendChatMessage(const std::string& msg)
{
sf::Packet spac;
spac << (MessageId)NP_MSG_CHAT_MESSAGE;
- spac << (PlayerId)0; // server id always 0
+ spac << (PlayerId)0; // server id always 0
spac << msg;
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h
index b08ab98..ff81565 100644
--- a/Source/Core/Core/NetPlayServer.h
+++ b/Source/Core/Core/NetPlayServer.h
@@ -4,20 +4,20 @@
#pragma once
-#include "Common.h"
-#include "CommonTypes.h"
-#include "Thread.h"
-#include "Timer.h"
-
-#include <SFML/Network.hpp>
-
-#include "NetPlayProto.h"
-
#include <functional>
#include <map>
#include <queue>
#include <sstream>
+#include <SFML/Network.hpp>
+
+#include "Common/Common.h"
+#include "Common/CommonTypes.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/NetPlayProto.h"
+
class NetPlayServer
{
public:
@@ -51,11 +51,11 @@ private:
class Client
{
public:
- PlayerId pid;
- std::string name;
- std::string revision;
+ PlayerId pid;
+ std::string name;
+ std::string revision;
- sf::SocketTCP socket;
+ sf::SocketTCP socket;
u32 ping;
u32 current_game;
};
@@ -79,7 +79,7 @@ private:
PadMapping m_pad_map[4];
PadMapping m_wiimote_map[4];
- std::map<sf::SocketTCP, Client> m_players;
+ std::map<sf::SocketTCP, Client> m_players;
struct
{
diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp
index 2c2a4f3..8c14111 100644
--- a/Source/Core/Core/PatchEngine.cpp
+++ b/Source/Core/Core/PatchEngine.cpp
@@ -20,15 +20,16 @@
#include <map>
#include <algorithm>
-#include "CommonPaths.h"
-#include "StringUtil.h"
-#include "PatchEngine.h"
-#include "HW/Memmap.h"
-#include "ActionReplay.h"
-#include "GeckoCode.h"
-#include "GeckoCodeConfig.h"
-#include "FileUtil.h"
-#include "ConfigManager.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ActionReplay.h"
+#include "Core/ConfigManager.h"
+#include "Core/GeckoCode.h"
+#include "Core/GeckoCodeConfig.h"
+#include "Core/PatchEngine.h"
+#include "Core/HW/Memmap.h"
using namespace Common;
@@ -46,8 +47,8 @@ std::vector<Patch> onFrame;
std::map<u32, int> speedHacks;
std::vector<std::string> discList;
-void LoadPatchSection(const char *section, std::vector<Patch> &patches,
- IniFile &globalIni, IniFile &localIni)
+void LoadPatchSection(const char *section, std::vector<Patch>& patches,
+ IniFile& globalIni, IniFile& localIni)
{
// Load the name of all enabled patches
std::string enabledSectionName = std::string(section) + "_Enabled";
@@ -63,13 +64,13 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches,
}
}
- IniFile* inis[] = {&globalIni, &localIni};
+ const IniFile* inis[2] = {&globalIni, &localIni};
- for (size_t i = 0; i < ArraySize(inis); ++i)
+ for (const IniFile* ini : inis)
{
std::vector<std::string> lines;
Patch currentPatch;
- inis[i]->GetLines(section, lines);
+ ini->GetLines(section, lines);
for (std::string& line : lines)
{
@@ -86,7 +87,7 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches,
// Set active and name
currentPatch.name = line.substr(1, line.size() - 1);
currentPatch.active = enabledNames.find(currentPatch.name) != enabledNames.end();
- currentPatch.user_defined = (i == 1);
+ currentPatch.user_defined = (ini == &localIni);
}
else
{
diff --git a/Source/Core/Core/PatchEngine.h b/Source/Core/Core/PatchEngine.h
index e347a07..b601e41 100644
--- a/Source/Core/Core/PatchEngine.h
+++ b/Source/Core/Core/PatchEngine.h
@@ -4,7 +4,7 @@
#pragma once
-#include "IniFile.h"
+#include "Common/IniFile.h"
namespace PatchEngine
{
diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp
index 763aa24..06d40a1 100644
--- a/Source/Core/Core/PowerPC/GDBStub.cpp
+++ b/Source/Core/Core/PowerPC/GDBStub.cpp
@@ -1,23 +1,10 @@
-// Copyright (C) 2010 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
// Originally written by Sven Peter <sven@fail0verflow.com> for anergistic.
-#include "GDBStub.h"
+#include "Core/PowerPC/GDBStub.h"
#include <stdio.h>
#include <string.h>
@@ -36,13 +23,13 @@
#include "Host.h"
-#define GDB_BFR_MAX 10000
-#define GDB_MAX_BP 10
+#define GDB_BFR_MAX 10000
+#define GDB_MAX_BP 10
-#define GDB_STUB_START '$'
-#define GDB_STUB_END '#'
-#define GDB_STUB_ACK '+'
-#define GDB_STUB_NAK '-'
+#define GDB_STUB_START '$'
+#define GDB_STUB_END '#'
+#define GDB_STUB_ACK '+'
+#define GDB_STUB_NAK '-'
static int tmpsock = -1;
@@ -492,13 +479,13 @@ static void gdb_read_registers()
wbe32hex(bufptr + i*8, riPS0(i));
}
bufptr += 32 * 8;
- wbe32hex(bufptr, PC); bufptr += 4;
- wbe32hex(bufptr, MSR); bufptr += 4;
- wbe32hex(bufptr, GetCR()); bufptr += 4;
- wbe32hex(bufptr, LR); bufptr += 4;
+ wbe32hex(bufptr, PC); bufptr += 4;
+ wbe32hex(bufptr, MSR); bufptr += 4;
+ wbe32hex(bufptr, GetCR()); bufptr += 4;
+ wbe32hex(bufptr, LR); bufptr += 4;
- wbe32hex(bufptr, CTR); bufptr += 4;
+ wbe32hex(bufptr, CTR); bufptr += 4;
wbe32hex(bufptr, PowerPC::ppcState.spr[SPR_XER]); bufptr += 4;
// MQ register not used.
wbe32hex(bufptr, 0x0BADC0DE); bufptr += 4;
@@ -841,10 +828,10 @@ void gdb_init(u32 port)
saddr_client.sin_addr.s_addr = ntohl(saddr_client.sin_addr.s_addr);
/*if (((saddr_client.sin_addr.s_addr >> 24) & 0xff) != 127 ||
- * ((saddr_client.sin_addr.s_addr >> 16) & 0xff) != 0 ||
- * ((saddr_client.sin_addr.s_addr >> 8) & 0xff) != 0 ||
- * ((saddr_client.sin_addr.s_addr >> 0) & 0xff) != 1)
- * ERROR_LOG(GDB_STUB, "gdb: incoming connection not from localhost");
+ * ((saddr_client.sin_addr.s_addr >> 16) & 0xff) != 0 ||
+ * ((saddr_client.sin_addr.s_addr >> 8) & 0xff) != 0 ||
+ * ((saddr_client.sin_addr.s_addr >> 0) & 0xff) != 1)
+ * ERROR_LOG(GDB_STUB, "gdb: incoming connection not from localhost");
*/
close(tmpsock);
tmpsock = -1;
diff --git a/Source/Core/Core/PowerPC/GDBStub.h b/Source/Core/Core/PowerPC/GDBStub.h
index 93330ce..b7d9636 100644
--- a/Source/Core/Core/PowerPC/GDBStub.h
+++ b/Source/Core/Core/PowerPC/GDBStub.h
@@ -7,15 +7,17 @@
#pragma once
#include <signal.h>
-#include "Common.h"
-#include "Thread.h"
-#include "PowerPC.h"
-#include "../HW/CPU.h"
-#include "../HW/Memmap.h"
+
+#include "Common/Common.h"
+#include "Common/Thread.h"
+
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
#ifdef _WIN32
-#define SIGTRAP 5
-#define SIGTERM 15
+#define SIGTRAP 5
+#define SIGTERM 15
#define MSG_WAITALL 8
#endif
diff --git a/Source/Core/Core/PowerPC/Gekko.h b/Source/Core/Core/PowerPC/Gekko.h
index 2695b9a..e14a10b 100644
--- a/Source/Core/Core/PowerPC/Gekko.h
+++ b/Source/Core/Core/PowerPC/Gekko.h
@@ -7,7 +7,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// --- Gekko Instruction ---
@@ -259,10 +259,10 @@ union UGeckoInstruction
};
struct
{
- u32 : 17;
+ u32 : 17;
// Field mask, identifies the FPSCR fields to be updated by mtfsf
- u32 FM : 8;
- u32 : 7;
+ u32 FM : 8;
+ u32 : 7;
};
// paired single quantized load/store
@@ -289,7 +289,7 @@ union UGeckoInstruction
struct
{
- u32 : 11;
+ u32 : 11;
// Number of bytes to use in lswi/stswi (0 means 32 bytes)
u32 NB : 5;
};
@@ -774,15 +774,15 @@ enum
};
// Exceptions
-#define EXCEPTION_DECREMENTER 0x00000001
-#define EXCEPTION_SYSCALL 0x00000002
-#define EXCEPTION_EXTERNAL_INT 0x00000004
-#define EXCEPTION_DSI 0x00000008
-#define EXCEPTION_ISI 0x00000010
-#define EXCEPTION_ALIGNMENT 0x00000020
-#define EXCEPTION_FPU_UNAVAILABLE 0x00000040
-#define EXCEPTION_PROGRAM 0x00000080
-#define EXCEPTION_PERFORMANCE_MONITOR 0x00000100
+#define EXCEPTION_DECREMENTER 0x00000001
+#define EXCEPTION_SYSCALL 0x00000002
+#define EXCEPTION_EXTERNAL_INT 0x00000004
+#define EXCEPTION_DSI 0x00000008
+#define EXCEPTION_ISI 0x00000010
+#define EXCEPTION_ALIGNMENT 0x00000020
+#define EXCEPTION_FPU_UNAVAILABLE 0x00000040
+#define EXCEPTION_PROGRAM 0x00000080
+#define EXCEPTION_PERFORMANCE_MONITOR 0x00000100
inline s32 SignExt16(s16 x) {return (s32)(s16)x;}
inline s32 SignExt26(u32 x) {return x & 0x2000000 ? (s32)(x | 0xFC000000) : (s32)(x);}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp
index dd71abc..1eb7430 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp
@@ -2,20 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <cinttypes>
-#include "Interpreter.h"
#include "PowerPCDisasm.h"
-#include "../PPCTables.h"
-#include "../../Debugger/Debugger_SymbolMap.h"
-#include "../../Host.h"
-#include "../../IPC_HLE/WII_IPC_HLE.h"
+
+#include "Core/Host.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
#ifdef USE_GDBSTUB
-#include "../GDBStub.h"
+#include "Core/PowerPC/GDBStub.h"
#endif
-#include <cinttypes>
-
namespace {
u32 last_pc;
}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
index b6b68bf..0e58f98 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
@@ -4,16 +4,16 @@
#pragma once
-#include "Atomic.h"
-#include "../Gekko.h"
-#include "../PowerPC.h"
-#include "../CPUCoreBase.h"
-#include "../../Core.h"
-#include "../../CoreTiming.h"
-#include "../../ConfigManager.h"
-#include "../../HLE/HLE.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/CPU.h"
+#include "Common/Atomic.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/CPUCoreBase.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PowerPC.h"
class Interpreter : public CPUCoreBase
{
@@ -60,7 +60,7 @@ public:
static void fnmaddsx(UGeckoInstruction _inst);
static void fnmsubsx(UGeckoInstruction _inst);
static void fresx(UGeckoInstruction _inst);
-// static void fsqrtsx(UGeckoInstruction _inst);
+ //static void fsqrtsx(UGeckoInstruction _inst);
static void fsubsx(UGeckoInstruction _inst);
static void fabsx(UGeckoInstruction _inst);
static void fcmpo(UGeckoInstruction _inst);
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp
index 5a3dc9e..b64ee65 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Interpreter.h"
-#include "../PPCAnalyst.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
void Interpreter::bx(UGeckoInstruction _inst)
{
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h
index d2c5c23..48e5cc8 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h
@@ -4,9 +4,9 @@
#pragma once
-#include "CPUDetect.h"
-#include "Interpreter.h"
-#include "MathUtil.h"
+#include "Common/CPUDetect.h"
+#include "Common/MathUtil.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
using namespace MathUtil;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
index daa02c2..3b51496 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <math.h>
+#include <cmath>
#include <limits>
#ifdef _WIN32
@@ -17,10 +17,10 @@
#undef _interlockedbittestandreset64
#endif
-#include "Interpreter.h"
-#include "Interpreter_FPUtils.h"
-#include "MathUtil.h"
-#include "../LUT_frsqrtex.h"
+#include "Common/MathUtil.h"
+#include "Core/PowerPC/LUT_frsqrtex.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
using namespace MathUtil;
@@ -40,9 +40,9 @@ void Interpreter::fcmpo(UGeckoInstruction _inst)
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
FPSCR.FX = 1;
@@ -71,9 +71,9 @@ void Interpreter::fcmpu(UGeckoInstruction _inst)
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
compareResult = 1;
@@ -483,7 +483,7 @@ void Interpreter::fsubx(UGeckoInstruction _inst)
void Interpreter::fsubsx(UGeckoInstruction _inst)
{
rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle(NI_sub(rPS0(_inst.FA), rPS0(_inst.FB)));
- UpdateFPRF(rPS0(_inst.FD));
+ UpdateFPRF(rPS0(_inst.FD));
if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD));
}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
index d09d9bf..5b32d50 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
void Interpreter::Helper_UpdateCR0(u32 _uValue)
{
@@ -217,7 +217,7 @@ void Interpreter::cmp(UGeckoInstruction _inst)
s32 a = (s32)m_GPR[_inst.RA];
s32 b = (s32)m_GPR[_inst.RB];
int fTemp = 0x8; // a < b
- // if (a < b) fTemp = 0x8; else
+ // if (a < b) fTemp = 0x8; else
if (a > b) fTemp = 0x4;
else if (a == b) fTemp = 0x2;
if (GetXER_SO()) PanicAlert("cmp getting overflow flag"); // fTemp |= 0x1
@@ -230,7 +230,7 @@ void Interpreter::cmpl(UGeckoInstruction _inst)
u32 b = m_GPR[_inst.RB];
u32 fTemp = 0x8; // a < b
- // if (a < b) fTemp = 0x8;else
+ // if (a < b) fTemp = 0x8;else
if (a > b) fTemp = 0x4;
else if (a == b) fTemp = 0x2;
if (GetXER_SO()) PanicAlert("cmpl getting overflow flag"); // fTemp |= 0x1;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index 3fb441f..514a9a4 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "MathUtil.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
-#include "Interpreter.h"
-#include "Interpreter_FPUtils.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
-#include "../JitInterface.h"
+#include "Core/PowerPC/JitInterface.h"
bool Interpreter::g_bReserve;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
index c905987..857e0ef 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
@@ -2,49 +2,49 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Interpreter.h"
-#include "Interpreter_FPUtils.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
// dequantize table
const float m_dequantizeTable[] =
{
- 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
- 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
- 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
- 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
- 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
- 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
- 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
- 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
- (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
- (1 << 28), (1 << 27), (1 << 26), (1 << 25),
- (1 << 24), (1 << 23), (1 << 22), (1 << 21),
- (1 << 20), (1 << 19), (1 << 18), (1 << 17),
- (1 << 16), (1 << 15), (1 << 14), (1 << 13),
- (1 << 12), (1 << 11), (1 << 10), (1 << 9),
- (1 << 8), (1 << 7), (1 << 6), (1 << 5),
- (1 << 4), (1 << 3), (1 << 2), (1 << 1),
+ 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
+ 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
+ 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
+ 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
+ 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
+ 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
+ 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
+ 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
+ (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
+ (1 << 28), (1 << 27), (1 << 26), (1 << 25),
+ (1 << 24), (1 << 23), (1 << 22), (1 << 21),
+ (1 << 20), (1 << 19), (1 << 18), (1 << 17),
+ (1 << 16), (1 << 15), (1 << 14), (1 << 13),
+ (1 << 12), (1 << 11), (1 << 10), (1 << 9),
+ (1 << 8), (1 << 7), (1 << 6), (1 << 5),
+ (1 << 4), (1 << 3), (1 << 2), (1 << 1),
};
// quantize table
const float m_quantizeTable[] =
{
- (1 << 0), (1 << 1), (1 << 2), (1 << 3),
- (1 << 4), (1 << 5), (1 << 6), (1 << 7),
- (1 << 8), (1 << 9), (1 << 10), (1 << 11),
- (1 << 12), (1 << 13), (1 << 14), (1 << 15),
- (1 << 16), (1 << 17), (1 << 18), (1 << 19),
- (1 << 20), (1 << 21), (1 << 22), (1 << 23),
- (1 << 24), (1 << 25), (1 << 26), (1 << 27),
- (1 << 28), (1 << 29), (1 << 30), (1 << 31),
- 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
- 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
- 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
- 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
- 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
- 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
- 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
- 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
+ (1 << 0), (1 << 1), (1 << 2), (1 << 3),
+ (1 << 4), (1 << 5), (1 << 6), (1 << 7),
+ (1 << 8), (1 << 9), (1 << 10), (1 << 11),
+ (1 << 12), (1 << 13), (1 << 14), (1 << 15),
+ (1 << 16), (1 << 17), (1 << 18), (1 << 19),
+ (1 << 20), (1 << 21), (1 << 22), (1 << 23),
+ (1 << 24), (1 << 25), (1 << 26), (1 << 27),
+ (1 << 28), (1 << 29), (1 << 30), (1 << 31),
+ 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
+ 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
+ 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
+ 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
+ 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
+ 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
+ 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
+ 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
};
template <class T>
@@ -54,8 +54,7 @@ inline T CLAMP(T a, T bottom, T top) {
return a;
}
-void Interpreter::Helper_Quantize(const u32 _Addr, const double _fValue,
- const EQuantizeType _quantizeType, const unsigned int _uScale)
+void Interpreter::Helper_Quantize(const u32 _Addr, const double _fValue, const EQuantizeType _quantizeType, const unsigned int _uScale)
{
switch (_quantizeType)
{
@@ -98,8 +97,7 @@ void Interpreter::Helper_Quantize(const u32 _Addr, const double _fValue,
}
}
-float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quantizeType,
- const unsigned int _uScale)
+float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quantizeType, const unsigned int _uScale)
{
// dequantize the value
float fResult;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp
index 991ae89..ce99a5c 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <math.h>
-#include "Common.h"
-#include "MathUtil.h"
-#include "Interpreter.h"
-#include "Interpreter_FPUtils.h"
+#include <cmath>
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
using namespace MathUtil;
@@ -358,9 +358,9 @@ void Interpreter::ps_cmpu0(UGeckoInstruction _inst)
double fb = rPS0(_inst.FB);
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
compareResult = 1;
@@ -379,9 +379,9 @@ void Interpreter::ps_cmpo0(UGeckoInstruction _inst)
double fb = rPS0(_inst.FB);
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
compareResult = 1;
@@ -407,9 +407,9 @@ void Interpreter::ps_cmpu1(UGeckoInstruction _inst)
double fb = rPS1(_inst.FB);
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
compareResult = 1;
@@ -428,9 +428,9 @@ void Interpreter::ps_cmpo1(UGeckoInstruction _inst)
double fb = rPS1(_inst.FB);
int compareResult;
- if (fa < fb) compareResult = 8;
- else if (fa > fb) compareResult = 4;
- else if (fa == fb) compareResult = 2;
+ if (fa < fb) compareResult = 8;
+ else if (fa > fb) compareResult = 4;
+ else if (fa == fb) compareResult = 2;
else
{
compareResult = 1;
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
index 475f759..db278e2 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
@@ -14,12 +14,12 @@
#undef _interlockedbittestandreset64
#endif
-#include "CPUDetect.h"
-#include "Interpreter.h"
-#include "Interpreter_FPUtils.h"
-#include "FPURoundMode.h"
-#include "../../HW/GPFifo.h"
-#include "../../HW/SystemTimers.h"
+#include "Common/CPUDetect.h"
+#include "Common/FPURoundMode.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
/*
@@ -468,6 +468,6 @@ void Interpreter::mffsx(UGeckoInstruction _inst)
// TODO(ector): grab all overflow flags etc and set them in FPSCR
UpdateFPSCR();
- riPS0(_inst.FD) = (u64)FPSCR.Hex;
+ riPS0(_inst.FD) = (u64)FPSCR.Hex;
if (_inst.Rc) PanicAlert("mffsx: inst_.Rc");
}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp
index 4b29b16..8196168 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Interpreter_Tables.h"
+#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
typedef void (*_Instruction) (UGeckoInstruction instCode);
@@ -310,7 +310,7 @@ static GekkoOPTemplate table59[] =
{18, Interpreter::fdivsx, {"fdivsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 16, 0, 0, 0}}, // TODO
{20, Interpreter::fsubsx, {"fsubsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}},
{21, Interpreter::faddsx, {"faddsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}},
-// {22, Interpreter::fsqrtsx, {"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}}, // Not implemented on gekko
+ //{22, Interpreter::fsqrtsx, {"fsqrtsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}}, // Not implemented on gekko
{24, Interpreter::fresx, {"fresx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}},
{25, Interpreter::fmulsx, {"fmulsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}},
{28, Interpreter::fmsubsx, {"fmsubsx", OPTYPE_FPU, FL_RC_BIT_F | FL_USE_FPU, 0, 0, 0, 0}},
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.h
index fe96067..6e49b36 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.h
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.h
@@ -6,7 +6,7 @@
#include "../Gekko.h"
#include "../PPCTables.h"
-#include "Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
namespace InterpreterTables
{
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
index 394c7bc..cee8fc2 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
@@ -9,15 +9,15 @@
#include <windows.h>
#endif
-#include "Common.h"
-#include "../../HLE/HLE.h"
-#include "../../PatchEngine.h"
-#include "../Profiler.h"
-#include "Jit.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
-#include "Jit64_Tables.h"
-#include "HW/ProcessorInterface.h"
+#include "Common/Common.h"
+#include "Core/PatchEngine.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit64_Tables.h"
#if defined(_DEBUG) || defined(DEBUGFAST)
#include "PowerPCDisasm.h"
#endif
@@ -276,7 +276,7 @@ void Jit64::Cleanup()
ABI_CallFunctionCCC((void *)&PowerPC::UpdatePerformanceMonitor, js.downcountAmount, jit->js.numLoadStoreInst, jit->js.numFloatingPointInst);
}
-void Jit64::WriteExit(u32 destination, int exit_num)
+void Jit64::WriteExit(u32 destination)
{
Cleanup();
@@ -284,23 +284,26 @@ void Jit64::WriteExit(u32 destination, int exit_num)
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
- b->exitAddress[exit_num] = destination;
- b->exitPtrs[exit_num] = GetWritableCodePtr();
+ JitBlock::LinkData linkData;
+ linkData.exitAddress = destination;
+ linkData.exitPtrs = GetWritableCodePtr();
+ linkData.linkStatus = false;
// Link opportunity!
- if (jo.enableBlocklink)
+ int block;
+ if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0)
{
- int block = blocks.GetBlockNumberFromStartAddress(destination);
- if (block >= 0)
- {
- // It exists! Joy of joy!
- JMP(blocks.GetBlock(block)->checkedEntry, true);
- b->linkStatus[exit_num] = true;
- return;
- }
+ // It exists! Joy of joy!
+ JMP(blocks.GetBlock(block)->checkedEntry, true);
+ linkData.linkStatus = true;
}
- MOV(32, M(&PC), Imm32(destination));
- JMP(asm_routines.dispatcher, true);
+ else
+ {
+ MOV(32, M(&PC), Imm32(destination));
+ JMP(asm_routines.dispatcher, true);
+ }
+
+ b->linkData.push_back(linkData);
}
void Jit64::WriteExitDestInEAX()
@@ -625,7 +628,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
FixupBranch noBreakpoint = J_CC(CC_Z);
- WriteExit(ops[i].address, 0);
+ WriteExit(ops[i].address);
SetJumpTarget(noBreakpoint);
}
@@ -707,7 +710,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
{
gpr.Flush(FLUSH_ALL);
fpr.Flush(FLUSH_ALL);
- WriteExit(nextPC, 0);
+ WriteExit(nextPC);
}
b->flags = js.block_flags;
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h
index dbec3e0..1387fd5 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.h
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.h
@@ -18,23 +18,24 @@
// ----------
#pragma once
-#include "../JitCommon/JitBackpatch.h"
-#include "../JitCommon/JitBase.h"
-#include "../JitCommon/JitCache.h"
-#include "../JitCommon/Jit_Util.h"
-#include "../PowerPC.h"
-#include "../PPCAnalyst.h"
-#include "../PPCTables.h"
-#include "../../Core.h"
-#include "../../CoreTiming.h"
-#include "../../ConfigManager.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/GPFifo.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
-#include "x64ABI.h"
-#include "x64Analyzer.h"
-#include "x64Emitter.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Analyzer.h"
+#include "Common/x64Emitter.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
+#include "Core/PowerPC/JitCommon/JitBackpatch.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "Core/PowerPC/JitCommon/Jit_Util.h"
class Jit64 : public Jitx86Base
{
@@ -88,7 +89,7 @@ public:
// Utilities for use by opcodes
- void WriteExit(u32 destination, int exit_num);
+ void WriteExit(u32 destination);
void WriteExitDestInEAX();
void WriteExceptionExit();
void WriteExternalExceptionExit();
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp
index dc81015..add12a6 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Jit.h"
-#include "Jit64_Tables.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/Jit64_Tables.h"
// Should be moved in to the Jit class
typedef void (Jit64::*_Instruction) (UGeckoInstruction instCode);
@@ -44,7 +44,7 @@ static GekkoOPTemplate primarytable[] =
{17, &Jit64::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
{7, &Jit64::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
- {8, &Jit64::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
+ {8, &Jit64::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
{10, &Jit64::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{11, &Jit64::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{12, &Jit64::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h
index 4a45405..c963ac1 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h
+++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h
@@ -4,9 +4,9 @@
#pragma once
-#include "../Gekko.h"
-#include "../PPCTables.h"
-#include "../Jit64/Jit.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Jit64/Jit.h"
namespace Jit64Tables
{
diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp
index 56975ef..667a6d0 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MemoryUtil.h"
+#include "Common/MemoryUtil.h"
-#include "Jit.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
using namespace Gen;
diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.h b/Source/Core/Core/PowerPC/Jit64/JitAsm.h
index 4399663..f2475ee 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitAsm.h
+++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.h
@@ -4,7 +4,7 @@
#pragma once
-#include "../JitCommon/JitAsmCommon.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
// In Dolphin, we don't use inline assembly. Instead, we generate all machine-near
// code at runtime. In the case of fixed code like this, after writing it, we write
diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
index 1be04a0..73017b5 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Jit.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
using namespace Gen;
using namespace PowerPC;
@@ -360,10 +360,6 @@ void FPURegCache::StoreFromRegister(int i)
regs[i].location = newLoc;
regs[i].away = false;
}
- else
- {
- // _assert_msg_(DYNA_REC,0,"already stored");
- }
}
void RegCache::Flush(FlushMode mode)
diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/PowerPC/Jit64/JitRegCache.h
index db9c377..c27f466 100644
--- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h
+++ b/Source/Core/Core/PowerPC/Jit64/JitRegCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "x64Emitter.h"
+#include "Common/x64Emitter.h"
using namespace Gen;
enum FlushMode
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
index b0f3f1c..aa07251 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
// The branches are known good, or at least reasonably good.
// No need for a disable-mechanism.
@@ -86,12 +86,12 @@ void Jit64::bx(UGeckoInstruction inst)
if (destination == js.compilerPC)
{
//PanicAlert("Idle loop detected at %08x", destination);
- // CALL(ProtectFunction(&CoreTiming::Idle, 0));
- // JMP(Asm::testExceptions, true);
+ // CALL(ProtectFunction(&CoreTiming::Idle, 0));
+ // JMP(Asm::testExceptions, true);
// make idle loops go faster
js.downcountAmount += 8;
}
- WriteExit(destination, 0);
+ WriteExit(destination);
}
// TODO - optimize to hell and beyond
@@ -136,13 +136,13 @@ void Jit64::bcx(UGeckoInstruction inst)
destination = SignExt16(inst.BD << 2);
else
destination = js.compilerPC + SignExt16(inst.BD << 2);
- WriteExit(destination, 0);
+ WriteExit(destination);
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
SetJumpTarget( pConditionDontBranch );
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch );
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
void Jit64::bcctrx(UGeckoInstruction inst)
@@ -163,7 +163,7 @@ void Jit64::bcctrx(UGeckoInstruction inst)
//NPC = CTR & 0xfffffffc;
MOV(32, R(EAX), M(&CTR));
if (inst.LK_3)
- MOV(32, M(&LR), Imm32(js.compilerPC + 4)); // LR = PC + 4;
+ MOV(32, M(&LR), Imm32(js.compilerPC + 4)); // LR = PC + 4;
AND(32, R(EAX), Imm32(0xFFFFFFFC));
WriteExitDestInEAX();
}
@@ -186,11 +186,11 @@ void Jit64::bcctrx(UGeckoInstruction inst)
AND(32, R(EAX), Imm32(0xFFFFFFFC));
//MOV(32, M(&PC), R(EAX)); => Already done in WriteExitDestInEAX()
if (inst.LK_3)
- MOV(32, M(&LR), Imm32(js.compilerPC + 4)); // LR = PC + 4;
+ MOV(32, M(&LR), Imm32(js.compilerPC + 4)); // LR = PC + 4;
WriteExitDestInEAX();
// Would really like to continue the block here, but it ends. TODO.
SetJumpTarget(b);
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
}
@@ -245,5 +245,5 @@ void Jit64::bclrx(UGeckoInstruction inst)
SetJumpTarget( pConditionDontBranch );
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch );
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
index 6b15af1..389c29c 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "CPUDetect.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
static const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
static const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
@@ -225,9 +225,9 @@ void Jit64::fcmpx(UGeckoInstruction inst)
}
//bool ordered = inst.SUBOP10 == 32;
- int a = inst.FA;
- int b = inst.FB;
- int crf = inst.CRFD;
+ int a = inst.FA;
+ int b = inst.FB;
+ int crf = inst.CRFD;
fpr.Lock(a,b);
fpr.BindToRegister(b, true);
@@ -245,7 +245,7 @@ void Jit64::fcmpx(UGeckoInstruction inst)
}
// if (B != B) or (A != A), goto NaN's jump target
- pNaN = J_CC(CC_P);
+ pNaN = J_CC(CC_P);
if (a != b)
{
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
index 696bf39..812c203 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
void Jit64::GenerateConstantOverflow(bool overflow)
{
@@ -254,7 +254,8 @@ void Jit64::reg_imm(UGeckoInstruction inst)
}
break;
case 15:
- if (a == 0) { // lis
+ if (a == 0) // lis
+ {
// Merge with next instruction if loading a 32-bits immediate value (lis + addi, lis + ori)
if (!js.isLastInstruction && !Core::g_CoreStartupParameter.bEnableDebugging)
{
@@ -349,7 +350,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
}
else
{
- signedCompare = false; // silence compiler warning
+ signedCompare = false; // silence compiler warning
PanicAlert("cmpXX");
}
}
@@ -400,7 +401,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
destination = SignExt16(js.next_inst.BD << 2);
else
destination = js.next_compilerPC + SignExt16(js.next_inst.BD << 2);
- WriteExit(destination, 0);
+ WriteExit(destination);
}
else if ((js.next_inst.OPCD == 19) && (js.next_inst.SUBOP10 == 528)) // bcctrx
{
@@ -424,7 +425,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
}
else
{
- WriteExit(js.next_compilerPC + 4, 0);
+ WriteExit(js.next_compilerPC + 4);
}
js.cancel = true;
@@ -507,7 +508,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
destination = SignExt16(js.next_inst.BD << 2);
else
destination = js.next_compilerPC + SignExt16(js.next_inst.BD << 2);
- WriteExit(destination, 0);
+ WriteExit(destination);
}
else if ((js.next_inst.OPCD == 19) && (js.next_inst.SUBOP10 == 528)) // bcctrx
{
@@ -534,7 +535,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
if (!!(4 & test_bit) == condition) SetJumpTarget(continue2);
if (!!(2 & test_bit) == condition) SetJumpTarget(continue1);
- WriteExit(js.next_compilerPC + 4, 1);
+ WriteExit(js.next_compilerPC + 4);
js.cancel = true;
}
@@ -2221,5 +2222,5 @@ void Jit64::twx(UGeckoInstruction inst)
SetJumpTarget(exit3);
SetJumpTarget(exit4);
SetJumpTarget(exit5);
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
index a1c3bd9..7c5078a 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
@@ -5,11 +5,11 @@
// TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only.
// Should give a very noticable speed boost to paired single heavy code.
-#include "Common.h"
+#include "Common/Common.h"
-#include "Jit.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
void Jit64::lXXx(UGeckoInstruction inst)
{
@@ -480,5 +480,5 @@ void Jit64::stmw(UGeckoInstruction inst)
void Jit64::icbi(UGeckoInstruction inst)
{
Default(inst);
- WriteExit(js.compilerPC + 4, 0);
+ WriteExit(js.compilerPC + 4);
}
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
index bc056e6..5429cc7 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
@@ -5,12 +5,12 @@
// TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only.
// Should give a very noticeable speed boost to paired single heavy code.
-#include "Common.h"
-#include "CPUDetect.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
-#include "Jit.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
// pshufb todo: MOVQ
const u8 GC_ALIGNED16(bswapShuffle1x4[16]) = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
@@ -80,7 +80,9 @@ void Jit64::lfd(UGeckoInstruction inst)
fpr.Lock(d);
fpr.BindToRegister(d, true);
X64Reg xd = fpr.RX(d);
- if (cpu_info.bSSSE3) {
+
+ if (cpu_info.bSSSE3)
+ {
#ifdef _M_X64
MOVQ_xmm(XMM0, MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
#else
@@ -116,20 +118,9 @@ void Jit64::lfd(UGeckoInstruction inst)
MOVSD(xd, R(XMM0));
MEMCHECK_END
-#if 0
- // Alternate implementation; possibly faster
- AND(32, R(ABI_PARAM1), Imm32(Memory::MEMVIEW32_MASK));
- MOVQ_xmm(XMM0, MDisp(ABI_PARAM1, (u32)Memory::base + offset));
- PSHUFLW(XMM0, R(XMM0), 0x1B);
- PSRLW(XMM0, 8);
- MOVSD(xd, R(XMM0));
- MOVQ_xmm(XMM0, MDisp(ABI_PARAM1, (u32)Memory::base + offset));
- PSHUFLW(XMM0, R(XMM0), 0x1B);
- PSLLW(XMM0, 8);
- POR(xd, R(XMM0));
-#endif
#endif
}
+
gpr.UnlockAll();
gpr.UnlockAllX();
fpr.UnlockAll();
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
index a2cb078..d2557d3 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
@@ -5,27 +5,15 @@
// TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only.
// Should give a very noticeable speed boost to paired single heavy code.
-#include "Common.h"
-#include "CPUDetect.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
-#include "Jit.h"
-#include "JitAsm.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitAsm.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15};
-//static u64 GC_ALIGNED16(temp64); // unused?
-
-// TODO(ector): Improve 64-bit version
-#if 0
-static void WriteDual32(u64 value, u32 address)
-{
- MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write
- Memory::Write_U32((u32)(value >> 32), address);
- Memory::Write_U32((u32)value, address + 4);
-}
-#endif
-
// The big problem is likely instructions that set the quantizers in the same block.
// We will have to break block after quantizers are written to.
void Jit64::psq_st(UGeckoInstruction inst)
@@ -48,33 +36,6 @@ void Jit64::psq_st(UGeckoInstruction inst)
int a = inst.RA;
int s = inst.RS; // Fp numbers
- const UGQR gqr(rSPR(SPR_GQR0 + inst.I));
-#if 0
- u16 store_gqr = gqr.Hex & 0xFFFF;
-
- const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE);
- int stScale = gqr.ST_SCALE;
-
- // Is this specialization still worth it? Let's keep it for now. It's probably
- // not very risky since a game most likely wouldn't use the same code to process
- // floats as integers (but you never know....).
- if (stType == QUANTIZE_FLOAT)
- {
- if (gpr.R(a).IsImm() && !update && cpu_info.bSSSE3)
- {
- u32 addr = (u32)(gpr.R(a).offset + offset);
- if (addr == 0xCC008000) {
- // Writing to FIFO. Let's do fast method.
- CVTPD2PS(XMM0, fpr.R(s));
- PSHUFB(XMM0, M((void*)&pbswapShuffle2x4));
- CALL((void*)asm_routines.fifoDirectWriteXmm64);
- js.fifoBytesThisBlock += 8;
- return;
- }
- }
- }
-#endif
-
gpr.FlushLockX(EAX, EDX);
gpr.FlushLockX(ECX);
if (update)
@@ -120,8 +81,6 @@ void Jit64::psq_l(UGeckoInstruction inst)
return;
}
- const UGQR gqr(rSPR(SPR_GQR0 + inst.I));
-
bool update = inst.OPCD == 57;
int offset = inst.SIMM_12;
@@ -148,11 +107,11 @@ void Jit64::psq_l(UGeckoInstruction inst)
CALLptr(MScaled(EDX, addr_scale, (u32)(u64)asm_routines.pairedLoadQuantized));
ABI_RestoreStack(0);
-// MEMCHECK_START // FIXME: MMU does not work here because of unsafe memory access
+ // MEMCHECK_START // FIXME: MMU does not work here because of unsafe memory access
CVTPS2PD(fpr.RX(inst.RS), R(XMM0));
-// MEMCHECK_END
+ // MEMCHECK_END
gpr.UnlockAll();
gpr.UnlockAllX();
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
index 781b75a..1af82d2 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "Jit.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
// TODO
// ps_madds0
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
index 573feb3..9bfefab 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "../../HW/SystemTimers.h"
-#include "HW/ProcessorInterface.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SystemTimers.h"
-#include "Jit.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/JitRegCache.h"
void Jit64::mtspr(UGeckoInstruction inst)
{
@@ -19,7 +19,6 @@ void Jit64::mtspr(UGeckoInstruction inst)
switch (iIndex)
{
-
case SPR_DMAU:
case SPR_SPRG0:
@@ -46,20 +45,9 @@ void Jit64::mtspr(UGeckoInstruction inst)
case SPR_GQR0 + 5:
case SPR_GQR0 + 6:
case SPR_GQR0 + 7:
- // Prevent recompiler from compiling in old quantizer values.
- // If the value changed, destroy all blocks using this quantizer
- // This will create a little bit of block churn, but hopefully not too bad.
- {
- /*
- MOV(32, R(EAX), M(&PowerPC::ppcState.spr[iIndex])); // Load old value
- CMP(32, R(EAX), gpr.R(inst.RD));
- FixupBranch skip_destroy = J_CC(CC_E, false);
- int gqr = iIndex - SPR_GQR0;
- ABI_CallFunctionC(ProtectFunction(&Jit64::DestroyBlocksWithFlag, 1), (u32)BLOCK_USE_GQR0 << gqr);
- SetJumpTarget(skip_destroy);*/
- }
+ // These are safe to do the easy way, see the bottom of this function.
break;
- // TODO - break block if quantizers are written to.
+
default:
Default(inst);
return;
@@ -105,7 +93,7 @@ void Jit64::mfspr(UGeckoInstruction inst)
void Jit64::mtmsr(UGeckoInstruction inst)
{
INSTRUCTION_START
- // Don't interpret this, if we do we get thrown out
+ // Don't interpret this, if we do we get thrown out
//JITDISABLE(bJITSystemRegistersOff)
if (!gpr.R(inst.RS).IsImm())
{
@@ -137,7 +125,7 @@ void Jit64::mtmsr(UGeckoInstruction inst)
SetJumpTarget(noExceptionsPending);
SetJumpTarget(eeDisabled);
- WriteExit(js.compilerPC + 4, 0);
+ WriteExit(js.compilerPC + 4);
js.firstFPInstructionFound = false;
}
@@ -276,40 +264,40 @@ void Jit64::crXXX(UGeckoInstruction inst)
// Compute combined bit
switch(inst.SUBOP10)
{
- case 33: // crnor
+ case 33: // crnor
OR(8, R(EAX), R(ECX));
NOT(8, R(EAX));
break;
- case 129: // crandc
+ case 129: // crandc
NOT(8, R(ECX));
AND(8, R(EAX), R(ECX));
break;
- case 193: // crxor
+ case 193: // crxor
XOR(8, R(EAX), R(ECX));
break;
- case 225: // crnand
+ case 225: // crnand
AND(8, R(EAX), R(ECX));
NOT(8, R(EAX));
break;
- case 257: // crand
+ case 257: // crand
AND(8, R(EAX), R(ECX));
break;
- case 289: // creqv
+ case 289: // creqv
XOR(8, R(EAX), R(ECX));
NOT(8, R(EAX));
break;
- case 417: // crorc
+ case 417: // crorc
NOT(8, R(ECX));
OR(8, R(EAX), R(ECX));
break;
- case 449: // cror
+ case 449: // cror
OR(8, R(EAX), R(ECX));
break;
}
diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
index 5c9d207..dca3619 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
+++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
@@ -24,10 +24,10 @@ The register allocation is linear scan allocation.
#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned
#endif
-#include "JitIL.h"
-#include "../../../Common/CPUDetect.h"
-#include "MathUtil.h"
-#include "HW/ProcessorInterface.h"
+#include "Common/CPUDetect.h"
+#include "Common/MathUtil.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/Jit64IL/JitIL.h"
using namespace IREmitter;
using namespace Gen;
@@ -425,8 +425,9 @@ static void regMarkMemAddress(RegInfo& RI, InstLoc I, InstLoc AI, unsigned OpNum
}
// in 64-bit build, this returns a completely bizarre address sometimes!
-static std::pair<OpArg, u32> regBuildMemAddress(RegInfo& RI, InstLoc I,
- InstLoc AI, unsigned OpNum, unsigned Size, X64Reg* dest) {
+static std::pair<OpArg, u32> regBuildMemAddress(RegInfo& RI, InstLoc I, InstLoc AI,
+ unsigned OpNum, unsigned Size, X64Reg* dest)
+{
if (isImm(*AI)) {
unsigned addr = RI.Build->GetImmValue(AI);
if (Memory::IsRAMAddress(addr)) {
@@ -554,7 +555,8 @@ static void regEmitICmpInst(RegInfo& RI, InstLoc I, CCFlags flag) {
static void regWriteExit(RegInfo& RI, InstLoc dest) {
if (isImm(*dest)) {
- RI.Jit->WriteExit(RI.Build->GetImmValue(dest), RI.exitNumber++);
+ RI.exitNumber++;
+ RI.Jit->WriteExit(RI.Build->GetImmValue(dest));
} else {
RI.Jit->WriteExitDestInOpArg(regLocForInst(RI, dest));
}
@@ -566,7 +568,7 @@ static bool checkIsSNAN() {
return MathUtil::IsSNAN(isSNANTemp[0][0]) || MathUtil::IsSNAN(isSNANTemp[1][0]);
}
-static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit) {
+static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) {
//printf("Writing block: %x\n", js.blockStart);
RegInfo RI(Jit, ibuild->getFirstInst(), ibuild->getNumInsts());
RI.Build = ibuild;
@@ -1793,7 +1795,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit) {
Jit->ABI_CallFunction(reinterpret_cast<void *>(&PowerPC::CheckBreakPoints));
Jit->TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
FixupBranch noBreakpoint = Jit->J_CC(CC_Z);
- Jit->WriteExit(InstLoc, 0);
+ Jit->WriteExit(InstLoc);
Jit->SetJumpTarget(noBreakpoint);
break;
}
@@ -1821,10 +1823,10 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit) {
}
}
- Jit->WriteExit(jit->js.curBlock->exitAddress[0], 0);
+ Jit->WriteExit(exitAddress);
Jit->UD2();
}
-void JitIL::WriteCode() {
- DoWriteCode(&ibuild, this);
+void JitIL::WriteCode(u32 exitAddress) {
+ DoWriteCode(&ibuild, this, exitAddress);
}
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp
index b15ffba..c3ed548 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp
@@ -2,17 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <cinttypes>
#include <map>
#include <memory>
-#include <cinttypes>
-#include "Common.h"
-#include "../../HLE/HLE.h"
-#include "../../PatchEngine.h"
-#include "../Profiler.h"
-#include "JitIL.h"
-#include "JitILAsm.h"
-#include "JitIL_Tables.h"
+#include "Common/Common.h"
+#include "Core/PatchEngine.h"
+#include "Core/HLE/HLE.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/PowerPC/Jit64IL/JitIL.h"
+#include "Core/PowerPC/Jit64IL/JitILAsm.h"
+#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
using namespace Gen;
using namespace PowerPC;
@@ -154,10 +154,10 @@ static inline uint64_t __rdtsc()
return (uint64_t)hi << 32 | lo;
#else
__asm__ __volatile__ (
- "xor %%eax,%%eax;"
- "push %%ebx;"
+ "xor %%eax,%%eax;"
+ "push %%ebx;"
"cpuid;"
- "pop %%ebx;"
+ "pop %%ebx;"
::: "%eax", "%ecx", "%edx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
#endif
@@ -315,7 +315,7 @@ void JitIL::WriteCallInterpreter(UGeckoInstruction inst)
void JitIL::unknown_instruction(UGeckoInstruction inst)
{
- // CCPU::Break();
+ // CCPU::Break();
PanicAlert("unknown_instruction %08x - Fix me ;)", inst.hex);
}
@@ -365,7 +365,6 @@ static void ImHere()
return;
}
DEBUG_LOG(DYNA_REC, "I'm here - PC = %08x , LR = %08x", PC, LR);
- // printf("I'm here - PC = %08x , LR = %08x", PC, LR);
been_here[PC] = 1;
}
@@ -381,7 +380,7 @@ void JitIL::Cleanup()
ABI_CallFunctionCCC((void *)&PowerPC::UpdatePerformanceMonitor, js.downcountAmount, jit->js.numLoadStoreInst, jit->js.numFloatingPointInst);
}
-void JitIL::WriteExit(u32 destination, int exit_num)
+void JitIL::WriteExit(u32 destination)
{
Cleanup();
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILTimeProfiling) {
@@ -391,22 +390,25 @@ void JitIL::WriteExit(u32 destination, int exit_num)
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
- b->exitAddress[exit_num] = destination;
- b->exitPtrs[exit_num] = GetWritableCodePtr();
+ JitBlock::LinkData linkData;
+ linkData.exitAddress = destination;
+ linkData.exitPtrs = GetWritableCodePtr();
+ linkData.linkStatus = false;
// Link opportunity!
- int block = blocks.GetBlockNumberFromStartAddress(destination);
- if (block >= 0 && jo.enableBlocklink)
+ int block;
+ if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0)
{
// It exists! Joy of joy!
JMP(blocks.GetBlock(block)->checkedEntry, true);
- b->linkStatus[exit_num] = true;
+ linkData.linkStatus = true;
}
else
{
MOV(32, M(&PC), Imm32(destination));
JMP(asm_routines.dispatcher, true);
}
+ b->linkData.push_back(linkData);
}
void JitIL::WriteExitDestInOpArg(const Gen::OpArg& arg)
@@ -541,14 +543,16 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
// Analyze the block, collect all instructions it is made of (including inlining,
// if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
- b->exitAddress[0] = em_address;
+ u32 exitAddress = em_address;
+
u32 merged_addresses[32];
const int capacity_of_merged_addresses = sizeof(merged_addresses) / sizeof(merged_addresses[0]);
int size_of_merged_addresses = 0;
if (!memory_exception)
{
// If there is a memory exception inside a block (broken_block==true), compile up to that instruction.
- b->exitAddress[0] = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, broken_block, code_buf, blockSize, merged_addresses, capacity_of_merged_addresses, size_of_merged_addresses);
+ // TODO
+ exitAddress = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, broken_block, code_buf, blockSize, merged_addresses, capacity_of_merged_addresses, size_of_merged_addresses);
}
PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
@@ -707,7 +711,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
}
// Perform actual code generation
- WriteCode();
+ WriteCode(exitAddress);
b->codeSize = (u32)(GetCodePtr() - normalEntry);
b->originalSize = size;
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h
index 2e5e382..9ed2a35 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h
@@ -16,24 +16,25 @@
#pragma once
-#include "JitILAsm.h"
-#include "x64Emitter.h"
-#include "x64ABI.h"
-#include "x64Analyzer.h"
-#include "../PowerPC.h"
-#include "../PPCTables.h"
-#include "../PPCAnalyst.h"
-#include "../JitCommon/JitBase.h"
-#include "../JitCommon/JitCache.h"
-#include "../JitCommon/JitBackpatch.h"
-#include "../JitCommon/Jit_Util.h"
-#include "../JitILCommon/JitILBase.h"
-#include "../JitILCommon/IR.h"
-#include "../../ConfigManager.h"
-#include "../../Core.h"
-#include "../../CoreTiming.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/GPFifo.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Analyzer.h"
+#include "Common/x64Emitter.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Jit64IL/JitILAsm.h"
+#include "Core/PowerPC/JitCommon/JitBackpatch.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "Core/PowerPC/JitCommon/Jit_Util.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
+#include "Core/PowerPC/JitILCommon/IR.h"
#ifdef _M_X64
#define DISABLE64 \
@@ -95,7 +96,7 @@ public:
// Utilities for use by opcodes
- void WriteExit(u32 destination, int exit_num);
+ void WriteExit(u32 destination);
void WriteExitDestInOpArg(const Gen::OpArg& arg);
void WriteExceptionExit();
void WriteRfiExitDestInOpArg(const Gen::OpArg& arg);
@@ -111,7 +112,7 @@ public:
void regimmop(int d, int a, bool binary, u32 value, Operation doop, void (Gen::XEmitter::*op)(int, const Gen::OpArg&, const Gen::OpArg&), bool Rc = false, bool carry = false);
void fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (Gen::XEmitter::*op)(Gen::X64Reg, Gen::OpArg));
- void WriteCode();
+ void WriteCode(u32 exitAddress);
// OPCODES
void unknown_instruction(UGeckoInstruction _inst) override;
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.cpp
index a909d32..cb28dd4 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.cpp
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "JitIL.h"
-#include "JitILAsm.h"
+#include "Core/PowerPC/Jit64IL/JitIL.h"
+#include "Core/PowerPC/Jit64IL/JitILAsm.h"
-#include "MemoryUtil.h"
-#include "CPUDetect.h"
+#include "Common/CPUDetect.h"
+#include "Common/MemoryUtil.h"
using namespace Gen;
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.h b/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.h
index 6af6b44..a465df8 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.h
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitILAsm.h
@@ -4,8 +4,8 @@
#pragma once
-#include "x64Emitter.h"
-#include "../JitCommon/JitAsmCommon.h"
+#include "Common/x64Emitter.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
// In Dolphin, we don't use inline assembly. Instead, we generate all machine-near
// code at runtime. In the case of fixed code like this, after writing it, we write
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp
index a9ed852..39fce69 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "JitIL_Tables.h"
+#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
// Should be moved in to the Jit class
typedef void (JitIL::*_Instruction) (UGeckoInstruction instCode);
@@ -46,7 +46,7 @@ static GekkoOPTemplate primarytable[] =
{17, &JitIL::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
{7, &JitIL::mulli}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
- {8, &JitIL::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
+ {8, &JitIL::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
{10, &JitIL::cmpXX}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{11, &JitIL::cmpXX}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{12, &JitIL::reg_imm}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h
index 7225bf8..c1150ae 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h
+++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h
@@ -5,9 +5,9 @@
#ifndef JITIL_TABLES_H
#define JITIL_TABLES_H
-#include "../Gekko.h"
-#include "../PPCTables.h"
-#include "../Jit64IL/JitIL.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Jit64IL/JitIL.h"
namespace JitILTables
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/Jit.cpp b/Source/Core/Core/PowerPC/JitArm32/Jit.cpp
index 4083a38..cb62c02 100644
--- a/Source/Core/Core/PowerPC/JitArm32/Jit.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/Jit.cpp
@@ -1,38 +1,25 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <map>
-#include "Common.h"
-#include "../../HLE/HLE.h"
-#include "../../Core.h"
-#include "../../PatchEngine.h"
-#include "../../CoreTiming.h"
-#include "../../ConfigManager.h"
-#include "../PowerPC.h"
-#include "../Profiler.h"
-#include "../PPCTables.h"
-#include "../PPCAnalyst.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/GPFifo.h"
-#include "Jit.h"
-#include "JitArm_Tables.h"
-#include "ArmEmitter.h"
-#include "../JitInterface.h"
+#include "Common/Common.h"
+#include "Common/ArmEmitter.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PatchEngine.h"
+#include "Core/HLE/HLE.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitArm_Tables.h"
using namespace ArmGen;
using namespace PowerPC;
@@ -186,23 +173,25 @@ void JitArm::WriteExceptionExit()
MOVI2R(A, (u32)asm_routines.testExceptions);
B(A);
}
-void JitArm::WriteExit(u32 destination, int exit_num)
+void JitArm::WriteExit(u32 destination)
{
Cleanup();
DoDownCount();
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
- b->exitAddress[exit_num] = destination;
- b->exitPtrs[exit_num] = GetWritableCodePtr();
+ JitBlock::LinkData linkData;
+ linkData.exitAddress = destination;
+ linkData.exitPtrs = GetWritableCodePtr();
+ linkData.linkStatus = false;
// Link opportunity!
- int block = blocks.GetBlockNumberFromStartAddress(destination);
- if (block >= 0 && jo.enableBlocklink)
+ int block;
+ if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0)
{
// It exists! Joy of joy!
B(blocks.GetBlock(block)->checkedEntry);
- b->linkStatus[exit_num] = true;
+ linkData.linkStatus = true;
}
else
{
@@ -212,6 +201,8 @@ void JitArm::WriteExit(u32 destination, int exit_num)
MOVI2R(A, (u32)asm_routines.dispatcher);
B(A);
}
+
+ b->linkData.push_back(linkData);
}
void STACKALIGN JitArm::Run()
@@ -493,10 +484,10 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
}
if (memory_exception)
BKPT(0x500);
- if (broken_block)
+ if (broken_block)
{
printf("Broken Block going to 0x%08x\n", nextPC);
- WriteExit(nextPC, 0);
+ WriteExit(nextPC);
}
b->flags = js.block_flags;
diff --git a/Source/Core/Core/PowerPC/JitArm32/Jit.h b/Source/Core/Core/PowerPC/JitArm32/Jit.h
index 7e29964..505f649 100644
--- a/Source/Core/Core/PowerPC/JitArm32/Jit.h
+++ b/Source/Core/Core/PowerPC/JitArm32/Jit.h
@@ -1,19 +1,6 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
// ========================
// See comments in Jit.cpp.
@@ -31,13 +18,13 @@
// ----------
#pragma once
-#include "../CPUCoreBase.h"
-#include "../PPCAnalyst.h"
-#include "JitArmCache.h"
-#include "JitRegCache.h"
-#include "JitFPRCache.h"
-#include "JitAsm.h"
-#include "../JitCommon/JitBase.h"
+#include "Core/PowerPC/CPUCoreBase.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/JitArm32/JitArmCache.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitFPRCache.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
#define PPCSTATE_OFF(elem) ((s32)STRUCT_OFF(PowerPC::ppcState, elem) - (s32)STRUCT_OFF(PowerPC::ppcState, spr[0]))
class JitArm : public JitBase, public ArmGen::ARMXCodeBlock
@@ -101,7 +88,7 @@ public:
// Utilities for use by opcodes
- void WriteExit(u32 destination, int exit_num);
+ void WriteExit(u32 destination);
void WriteExitDestInR(ARMReg Reg);
void WriteRfiExitDestInR(ARMReg Reg);
void WriteExceptionExit();
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArmCache.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArmCache.cpp
index 8295636..2fdd195 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArmCache.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArmCache.cpp
@@ -1,19 +1,6 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
// Enable define below to enable oprofile integration. For this to work,
// it requires at least oprofile version 0.9.4, and changing the build
@@ -22,9 +9,9 @@
// performance hit, it's not enabled by default, but it's useful for
// locating performance issues.
-#include "../JitInterface.h"
-#include "Jit.h"
-#include "JitArmCache.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitArmCache.h"
using namespace ArmGen;
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArmCache.h b/Source/Core/Core/PowerPC/JitArm32/JitArmCache.h
index 8f0cc49..cd41399 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArmCache.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArmCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "../JitCommon/JitCache.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
typedef void (*CompiledCode)();
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp
index 79fb88a..4be3639 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp
@@ -1,28 +1,15 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <string>
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
-#include "../../HW/Memmap.h"
-#include "Jit.h"
-#include "../JitCommon/JitBackpatch.h"
-#include "StringUtil.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitCommon/JitBackpatch.h"
// This generates some fairly heavy trampolines, but:
// 1) It's really necessary. We don't know anything about the context.
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp
index 4e9101f..4e535d2 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp
@@ -1,30 +1,17 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
// The branches are known good, or at least reasonably good.
// No need for a disable-mechanism.
@@ -66,9 +53,9 @@ void JitArm::rfi(UGeckoInstruction inst)
gpr.Flush();
fpr.Flush();
- // See Interpreter rfi for details
+ // See Interpreter rfi for details
const u32 mask = 0x87C0FFFF;
- const u32 clearMSR13 = 0xFFFBFFFF; // Mask used to clear the bit MSR[13]
+ const u32 clearMSR13 = 0xFFFBFFFF; // Mask used to clear the bit MSR[13]
// MSR = ((MSR & ~mask) | (SRR1 & mask)) & clearMSR13;
// R0 = MSR location
// R1 = MSR contents
@@ -134,18 +121,18 @@ void JitArm::bx(UGeckoInstruction inst)
destination = SignExt26(inst.LI << 2);
else
destination = js.compilerPC + SignExt26(inst.LI << 2);
- #ifdef ACID_TEST
- if (inst.LK)
- {
- MOV(R14, 0);
- STRB(R14, R9, PPCSTATE_OFF(cr_fast[0]));
- }
- #endif
- if (destination == js.compilerPC)
+#ifdef ACID_TEST
+ if (inst.LK)
+ {
+ MOV(R14, 0);
+ STRB(R14, R9, PPCSTATE_OFF(cr_fast[0]));
+ }
+#endif
+ if (destination == js.compilerPC)
{
- //PanicAlert("Idle loop detected at %08x", destination);
- // CALL(ProtectFunction(&CoreTiming::Idle, 0));
- // JMP(Asm::testExceptions, true);
+ //PanicAlert("Idle loop detected at %08x", destination);
+ // CALL(ProtectFunction(&CoreTiming::Idle, 0));
+ // JMP(Asm::testExceptions, true);
// make idle loops go faster
MOVI2R(R14, (u32)&CoreTiming::Idle);
BL(R14);
@@ -154,7 +141,7 @@ void JitArm::bx(UGeckoInstruction inst)
MOVI2R(R14, (u32)asm_routines.testExceptions);
B(R14);
}
- WriteExit(destination, 0);
+ WriteExit(destination);
}
void JitArm::bcx(UGeckoInstruction inst)
@@ -209,14 +196,14 @@ void JitArm::bcx(UGeckoInstruction inst)
destination = SignExt16(inst.BD << 2);
else
destination = js.compilerPC + SignExt16(inst.BD << 2);
- WriteExit(destination, 0);
+ WriteExit(destination);
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
SetJumpTarget( pConditionDontBranch );
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch );
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
void JitArm::bcctrx(UGeckoInstruction inst)
{
@@ -278,7 +265,7 @@ void JitArm::bcctrx(UGeckoInstruction inst)
WriteExitDestInR(rA);
SetJumpTarget(b);
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
}
void JitArm::bclrx(UGeckoInstruction inst)
@@ -355,5 +342,5 @@ void JitArm::bclrx(UGeckoInstruction inst)
SetJumpTarget( pConditionDontBranch );
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch );
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
}
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h b/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h
index 41b794a..265ba2d 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h
@@ -1,14 +1,15 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
+
#pragma once
-#include "../Interpreter/Interpreter_FPUtils.h"
+#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitFPRCache.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitFPRCache.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
static const double minmaxFloat[2] = {-(double)0x80000000, (double)0x7FFFFFFF};
static const double doublenum = 0xfff8000000000000ull;
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_FloatingPoint.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_FloatingPoint.cpp
index 28e9723..16d13a6 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_FloatingPoint.cpp
@@ -1,35 +1,23 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../ConfigManager.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-#include "../../HW/Memmap.h"
-#include "JitArm_FPUtils.h"
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitFPRCache.h"
-#include "JitAsm.h"
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitArm32/JitArm_FPUtils.h"
+
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitFPRCache.h"
+#include "Core/PowerPC/JitArm32/JitArm_FPUtils.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::Helper_UpdateCR1(ARMReg fpscr, ARMReg temp)
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp
index f39ffd0..525903b 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp
@@ -1,30 +1,19 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
extern u32 Helper_Mask(u8 mb, u8 me);
// Assumes that Sign and Zero flags were set by the last operation. Preserves all flags and registers.
@@ -1005,7 +994,7 @@ void JitArm::twx(UGeckoInstruction inst)
SetJumpTarget(take5);
LDR(RA, R9, PPCSTATE_OFF(Exceptions));
- MOVI2R(RB, EXCEPTION_PROGRAM); // XXX: Can be optimized
+ MOVI2R(RB, EXCEPTION_PROGRAM); // XXX: Can be optimized
ORR(RA, RA, RB);
STR(RA, R9, PPCSTATE_OFF(Exceptions));
WriteExceptionExit();
@@ -1015,7 +1004,7 @@ void JitArm::twx(UGeckoInstruction inst)
SetJumpTarget(exit3);
SetJumpTarget(exit4);
SetJumpTarget(exit5);
- WriteExit(js.compilerPC + 4, 1);
+ WriteExit(js.compilerPC + 4);
gpr.Unlock(RA, RB);
}
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp
index f04c88d..d8de044 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp
@@ -1,34 +1,20 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../ConfigManager.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-#include "../../HW/Memmap.h"
-
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::UnsafeStoreFromReg(ARMReg dest, ARMReg value, int accessSize, s32 offset)
{
@@ -531,6 +517,6 @@ void JitArm::dcbst(UGeckoInstruction inst)
void JitArm::icbi(UGeckoInstruction inst)
{
Default(inst);
- WriteExit(js.compilerPC + 4, 0);
+ WriteExit(js.compilerPC + 4);
}
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp
index 96c7fd4..62389aa 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp
@@ -1,35 +1,21 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../ConfigManager.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-#include "../../HW/Memmap.h"
-
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitFPRCache.h"
-#include "JitAsm.h"
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitFPRCache.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::lfXX(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStorePaired.cpp
index 244ae1d..e11e22f 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStorePaired.cpp
@@ -1,17 +1,18 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::psq_l(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Paired.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Paired.cpp
index 53d5e7b..f4ec493 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Paired.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Paired.cpp
@@ -1,31 +1,19 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-#include "JitArm_FPUtils.h"
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitArm_FPUtils.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::ps_rsqrte(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp
index e4ab630..e1a8c55 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp
@@ -1,30 +1,18 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
+#include "Common/ArmEmitter.h"
+#include "Common/Common.h"
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-
-#include "../../Core.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "../PPCTables.h"
-#include "ArmEmitter.h"
-
-#include "Jit.h"
-#include "JitRegCache.h"
-#include "JitAsm.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
void JitArm::mtspr(UGeckoInstruction inst)
{
@@ -197,7 +185,7 @@ void JitArm::mcrxr(UGeckoInstruction inst)
void JitArm::mtmsr(UGeckoInstruction inst)
{
INSTRUCTION_START
- // Don't interpret this, if we do we get thrown out
+ // Don't interpret this, if we do we get thrown out
//JITDISABLE(bJITSystemRegistersOff)
STR(gpr.R(inst.RS), R9, PPCSTATE_OFF(msr));
@@ -205,7 +193,7 @@ void JitArm::mtmsr(UGeckoInstruction inst)
gpr.Flush();
fpr.Flush();
- WriteExit(js.compilerPC + 4, 0);
+ WriteExit(js.compilerPC + 4);
}
void JitArm::mfmsr(UGeckoInstruction inst)
@@ -256,40 +244,40 @@ void JitArm::crXXX(UGeckoInstruction inst)
// Compute combined bit
switch(inst.SUBOP10)
{
- case 33: // crnor
+ case 33: // crnor
ORR(rA, rA, rB);
MVN(rA, rA);
break;
- case 129: // crandc
+ case 129: // crandc
MVN(rB, rB);
AND(rA, rA, rB);
break;
- case 193: // crxor
+ case 193: // crxor
EOR(rA, rA, rB);
break;
- case 225: // crnand
+ case 225: // crnand
AND(rA, rA, rB);
MVN(rA, rA);
break;
- case 257: // crand
+ case 257: // crand
AND(rA, rA, rB);
break;
- case 289: // creqv
+ case 289: // creqv
EOR(rA, rA, rB);
MVN(rA, rA);
break;
- case 417: // crorc
+ case 417: // crorc
MVN(rA, rA);
ORR(rA, rA, rB);
break;
- case 449: // cror
+ case 449: // cror
ORR(rA, rA, rB);
break;
}
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.cpp
index 7729cf4..661cc6a 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.cpp
@@ -1,23 +1,10 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Jit.h"
-#include "../JitInterface.h"
-#include "JitArm_Tables.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitArm_Tables.h"
// Should be moved in to the Jit class
typedef void (JitArm::*_Instruction) (UGeckoInstruction instCode);
@@ -59,7 +46,7 @@ static GekkoOPTemplate primarytable[] =
{17, &JitArm::sc}, //"sc", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}},
{7, &JitArm::arith}, //"mulli", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_RC_BIT, 2}},
- {8, &JitArm::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
+ {8, &JitArm::subfic}, //"subfic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
{10, &JitArm::cmpli}, //"cmpli", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{11, &JitArm::cmpi}, //"cmpi", OPTYPE_INTEGER, FL_IN_A | FL_SET_CRn}},
{12, &JitArm::arith}, //"addic", OPTYPE_INTEGER, FL_OUT_D | FL_IN_A | FL_SET_CA}},
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.h b/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.h
index c858d77..69b5fda 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Tables.h
@@ -1,24 +1,11 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#pragma once
-#include "../Gekko.h"
-#include "../PPCTables.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCTables.h"
namespace JitArmTables
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitAsm.cpp b/Source/Core/Core/PowerPC/JitArm32/JitAsm.cpp
index 2d619ce..8cec544 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitAsm.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitAsm.cpp
@@ -1,34 +1,20 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
+#include "Common/ArmEmitter.h"
+#include "Common/MemoryUtil.h"
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitAsm.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-
-#include "../../HW/Memmap.h"
-
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "MemoryUtil.h"
-
-#include "Jit.h"
-#include "../JitCommon/JitCache.h"
-
-#include "../../HW/GPFifo.h"
-#include "../../Core.h"
-#include "JitAsm.h"
-#include "ArmEmitter.h"
using namespace ArmGen;
@@ -43,42 +29,42 @@ JitArmAsmRoutineManager asm_routines;
static const float GC_ALIGNED16(m_quantizeTableS[]) =
{
- (1 << 0), (1 << 1), (1 << 2), (1 << 3),
- (1 << 4), (1 << 5), (1 << 6), (1 << 7),
- (1 << 8), (1 << 9), (1 << 10), (1 << 11),
- (1 << 12), (1 << 13), (1 << 14), (1 << 15),
- (1 << 16), (1 << 17), (1 << 18), (1 << 19),
- (1 << 20), (1 << 21), (1 << 22), (1 << 23),
- (1 << 24), (1 << 25), (1 << 26), (1 << 27),
- (1 << 28), (1 << 29), (1 << 30), (1 << 31),
- 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
- 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
- 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
- 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
- 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
- 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
- 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
- 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
+ (1 << 0), (1 << 1), (1 << 2), (1 << 3),
+ (1 << 4), (1 << 5), (1 << 6), (1 << 7),
+ (1 << 8), (1 << 9), (1 << 10), (1 << 11),
+ (1 << 12), (1 << 13), (1 << 14), (1 << 15),
+ (1 << 16), (1 << 17), (1 << 18), (1 << 19),
+ (1 << 20), (1 << 21), (1 << 22), (1 << 23),
+ (1 << 24), (1 << 25), (1 << 26), (1 << 27),
+ (1 << 28), (1 << 29), (1 << 30), (1 << 31),
+ 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
+ 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
+ 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
+ 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
+ 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
+ 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
+ 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
+ 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
};
static const float GC_ALIGNED16(m_dequantizeTableS[]) =
{
- 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
- 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
- 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
- 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
- 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
- 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
- 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
- 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
- (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
- (1 << 28), (1 << 27), (1 << 26), (1 << 25),
- (1 << 24), (1 << 23), (1 << 22), (1 << 21),
- (1 << 20), (1 << 19), (1 << 18), (1 << 17),
- (1 << 16), (1 << 15), (1 << 14), (1 << 13),
- (1 << 12), (1 << 11), (1 << 10), (1 << 9),
- (1 << 8), (1 << 7), (1 << 6), (1 << 5),
- (1 << 4), (1 << 3), (1 << 2), (1 << 1),
+ 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
+ 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
+ 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
+ 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
+ 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
+ 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
+ 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
+ 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
+ (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
+ (1 << 28), (1 << 27), (1 << 26), (1 << 25),
+ (1 << 24), (1 << 23), (1 << 22), (1 << 21),
+ (1 << 20), (1 << 19), (1 << 18), (1 << 17),
+ (1 << 16), (1 << 15), (1 << 14), (1 << 13),
+ (1 << 12), (1 << 11), (1 << 10), (1 << 9),
+ (1 << 8), (1 << 7), (1 << 6), (1 << 5),
+ (1 << 4), (1 << 3), (1 << 2), (1 << 1),
};
static void WriteDual32(u32 value1, u32 value2, u32 address)
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitAsm.h b/Source/Core/Core/PowerPC/JitArm32/JitAsm.h
index a7cabda..061a2ba 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitAsm.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitAsm.h
@@ -1,24 +1,12 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#pragma once
-#include "ArmEmitter.h"
-#include "../JitCommon/JitAsmCommon.h"
+#include "Common/ArmEmitter.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
+
using namespace ArmGen;
class JitArmAsmRoutineManager : public CommonAsmRoutinesBase, public ARMXCodeBlock
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp
index 7247ddb..8f44a9c 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp
@@ -1,22 +1,9 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Jit.h"
-#include "JitFPRCache.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitFPRCache.h"
ArmFPRCache::ArmFPRCache()
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.h b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.h
index 807e200..1e2f1ac 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.h
@@ -4,10 +4,10 @@
#pragma once
-#include "ArmEmitter.h"
-#include "../Gekko.h"
-#include "../PPCAnalyst.h"
-#include "JitRegCache.h"
+#include "Common/ArmEmitter.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
#define ARMFPUREGS 32
using namespace ArmGen;
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp
index f1e678e..c5f97d4 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp
+++ b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp
@@ -1,22 +1,9 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Jit.h"
-#include "JitRegCache.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitRegCache.h"
ArmRegCache::ArmRegCache()
{
diff --git a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.h b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.h
index 6271f58..e1097e9 100644
--- a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.h
+++ b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.h
@@ -4,9 +4,9 @@
#pragma once
-#include "ArmEmitter.h"
-#include "../Gekko.h"
-#include "../PPCAnalyst.h"
+#include "Common/ArmEmitter.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCAnalyst.h"
using namespace ArmGen;
// This ARM Register cache actually pre loads the most used registers before
diff --git a/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp b/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp
index 10620d9..d563ad8 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp
+++ b/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp
@@ -1,14 +1,15 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../JitILCommon/IR.h"
-#include "../PPCTables.h"
-#include "../../CoreTiming.h"
-#include "../../HW/Memmap.h"
-#include "JitILAsm.h"
-#include "JitIL.h"
-#include "ArmEmitter.h"
-#include "../../Core.h"
+
+#include "Common/ArmEmitter.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
+#include "Core/PowerPC/JitArmIL/JitILAsm.h"
+#include "Core/PowerPC/JitILCommon/IR.h"
using namespace IREmitter;
using namespace ArmGen;
@@ -156,7 +157,8 @@ static ARMReg regEnsureInReg(RegInfo& RI, InstLoc I) {
static void regWriteExit(RegInfo& RI, InstLoc dest) {
if (isImm(*dest)) {
- RI.Jit->WriteExit(RI.Build->GetImmValue(dest), RI.exitNumber++);
+ RI.exitNumber++;
+ RI.Jit->WriteExit(RI.Build->GetImmValue(dest));
} else {
RI.Jit->WriteExitDestInReg(regLocForInst(RI, dest));
}
@@ -281,7 +283,7 @@ static void regEmitCmp(RegInfo& RI, InstLoc I) {
}
}
-static void DoWriteCode(IRBuilder* ibuild, JitArmIL* Jit) {
+static void DoWriteCode(IRBuilder* ibuild, JitArmIL* Jit, u32 exitAddress) {
RegInfo RI(Jit, ibuild->getFirstInst(), ibuild->getNumInsts());
RI.Build = ibuild;
@@ -733,10 +735,10 @@ static void DoWriteCode(IRBuilder* ibuild, JitArmIL* Jit) {
}
}
- Jit->WriteExit(jit->js.curBlock->exitAddress[0], 0);
+ Jit->WriteExit(exitAddress);
Jit->BKPT(0x111);
}
-void JitArmIL::WriteCode() {
- DoWriteCode(&ibuild, this);
+void JitArmIL::WriteCode(u32 exitAddress) {
+ DoWriteCode(&ibuild, this, exitAddress);
}
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp
index 0aac4d6..00c51ec 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp
@@ -1,25 +1,25 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <map>
-#include "Common.h"
-#include "../../HLE/HLE.h"
-#include "../../Core.h"
-#include "../../PatchEngine.h"
-#include "../../CoreTiming.h"
-#include "../../ConfigManager.h"
-#include "../PowerPC.h"
-#include "../Profiler.h"
-#include "../PPCTables.h"
-#include "../PPCAnalyst.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/GPFifo.h"
-#include "JitIL.h"
-#include "JitIL_Tables.h"
-#include "ArmEmitter.h"
-#include "../JitInterface.h"
+#include "Common/Common.h"
+#include "Common/ArmEmitter.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/PatchEngine.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
+#include "Core/PowerPC/JitArmIL/JitIL_Tables.h"
using namespace ArmGen;
using namespace PowerPC;
@@ -50,7 +50,7 @@ void JitArmIL::Shutdown()
}
void JitArmIL::unknown_instruction(UGeckoInstruction inst)
{
- // CCPU::Break();
+ // CCPU::Break();
PanicAlert("unknown_instruction %08x - Fix me ;)", inst.hex);
}
@@ -117,21 +117,23 @@ void JitArmIL::WriteExceptionExit()
MOVI2R(R14, (u32)asm_routines.testExceptions);
B(R14);
}
-void JitArmIL::WriteExit(u32 destination, int exit_num)
+void JitArmIL::WriteExit(u32 destination)
{
DoDownCount();
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
- b->exitAddress[exit_num] = destination;
- b->exitPtrs[exit_num] = GetWritableCodePtr();
+ JitBlock::LinkData linkData;
+ linkData.exitAddress = destination;
+ linkData.exitPtrs = GetWritableCodePtr();
+ linkData.linkStatus = false;
// Link opportunity!
- int block = blocks.GetBlockNumberFromStartAddress(destination);
- if (block >= 0 && jo.enableBlocklink)
+ int block;
+ if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0)
{
// It exists! Joy of joy!
B(blocks.GetBlock(block)->checkedEntry);
- b->linkStatus[exit_num] = true;
+ linkData.linkStatus = true;
}
else
{
@@ -140,6 +142,8 @@ void JitArmIL::WriteExit(u32 destination, int exit_num)
MOVI2R(R14, (u32)asm_routines.dispatcher);
B(R14);
}
+
+ b->linkData.push_back(linkData);
}
void JitArmIL::PrintDebug(UGeckoInstruction inst, u32 level)
{
@@ -344,15 +348,15 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
}
if (memory_exception)
BKPT(0x500);
- if (broken_block)
+ if (broken_block)
{
printf("Broken Block going to 0x%08x\n", nextPC);
- WriteExit(nextPC, 0);
+ WriteExit(nextPC);
}
// Perform actual code generation
- WriteCode();
+ WriteCode(nextPC);
b->flags = js.block_flags;
b->codeSize = (u32)(GetCodePtr() - normalEntry);
b->originalSize = size;
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL.h b/Source/Core/Core/PowerPC/JitArmIL/JitIL.h
index 595e1dc..20de066 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitIL.h
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL.h
@@ -1,16 +1,16 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
-#include "../PPCAnalyst.h"
-#include "ArmEmitter.h"
-#include "../JitArm32/JitArmCache.h"
-#include "../JitILCommon/JitILBase.h"
-#include "../JitILCommon/IR.h"
-#include "../JitCommon/JitBase.h"
-#include "JitILAsm.h"
+#include "Common/ArmEmitter.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/JitArm32/JitArmCache.h"
+#include "Core/PowerPC/JitArmIL/JitILAsm.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitILCommon/IR.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
#define PPCSTATE_OFF(elem) ((s32)STRUCT_OFF(PowerPC::ppcState, elem) - (s32)STRUCT_OFF(PowerPC::ppcState, spr[0]))
class JitArmIL : public JitILBase, public ArmGen::ARMXCodeBlock
@@ -58,8 +58,8 @@ public:
void Run();
void SingleStep();
//
- void WriteCode();
- void WriteExit(u32 destination, int exit_num);
+ void WriteCode(u32 exitAddress);
+ void WriteExit(u32 destination);
void WriteExitDestInReg(ARMReg Reg);
void WriteRfiExitDestInR(ARMReg Reg);
void WriteExceptionExit();
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.cpp
index 2cb9e29..ab2c92d 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.cpp
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.cpp
@@ -1,20 +1,18 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../../HW/Memmap.h"
-#include "../PowerPC.h"
-#include "../../CoreTiming.h"
-#include "MemoryUtil.h"
-
-#include "JitIL.h"
-#include "../JitCommon/JitCache.h"
-
-#include "../../HW/GPFifo.h"
-#include "../../Core.h"
-
-#include "JitILAsm.h"
-#include "ArmEmitter.h"
+#include "Common/ArmEmitter.h"
+#include "Common/MemoryUtil.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
+#include "Core/PowerPC/JitArmIL/JitILAsm.h"
JitArmILAsmRoutineManager armil_asm_routines;
void JitArmILAsmRoutineManager::Generate()
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.h b/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.h
index 884baf2..ef95b6d 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.h
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitILAsm.h
@@ -1,11 +1,12 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
-#include "ArmEmitter.h"
-#include "../JitCommon/JitAsmCommon.h"
+#include "Common/ArmEmitter.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
+
using namespace ArmGen;
class JitArmILAsmRoutineManager : public CommonAsmRoutinesBase, public ARMXCodeBlock
{
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp
index bad63dd..65c0297 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp
@@ -1,16 +1,15 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
-#include "../../ConfigManager.h"
-#include "../PowerPC.h"
-#include "../PPCTables.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
-#include "JitIL.h"
-
-#include "../../HW/Memmap.h"
#define NORMALBRANCH_START Default(inst); ibuild.EmitInterpreterBranch(); return;
//#define NORMALBRANCH_START
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.cpp
index eaa5951..9708989 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.cpp
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.cpp
@@ -1,10 +1,10 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "JitIL.h"
-#include "../JitInterface.h"
-#include "JitIL_Tables.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
+#include "Core/PowerPC/JitArmIL/JitIL_Tables.h"
// Should be moved in to the Jit class
typedef void (JitArmIL::*_Instruction) (UGeckoInstruction instCode);
diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.h b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.h
index 8e6e0bc..7d92e6c 100644
--- a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.h
+++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Tables.h
@@ -1,11 +1,11 @@
-// Copyright 2013 Dolphin Emulator Project
+// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
-#include "../Gekko.h"
-#include "../PPCTables.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCTables.h"
namespace JitArmILTables
{
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.cpp b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.cpp
index bc8272f..a448aac 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "JitAsmCommon.h"
-#include "JitBase.h"
-
-#include "CPUDetect.h"
-#include "MemoryUtil.h"
+#include "Common/CPUDetect.h"
+#include "Common/MemoryUtil.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
#define QUANTIZED_REGS_TO_SAVE (ABI_ALL_CALLEE_SAVED & ~((1 << RAX) | (1 << RCX) | (1 << RDX) | \
(1 << XMM0) | (1 << XMM1)))
@@ -77,42 +76,42 @@ static const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8,
static const float GC_ALIGNED16(m_quantizeTableS[]) =
{
- (1 << 0), (1 << 1), (1 << 2), (1 << 3),
- (1 << 4), (1 << 5), (1 << 6), (1 << 7),
- (1 << 8), (1 << 9), (1 << 10), (1 << 11),
- (1 << 12), (1 << 13), (1 << 14), (1 << 15),
- (1 << 16), (1 << 17), (1 << 18), (1 << 19),
- (1 << 20), (1 << 21), (1 << 22), (1 << 23),
- (1 << 24), (1 << 25), (1 << 26), (1 << 27),
- (1 << 28), (1 << 29), (1 << 30), (1 << 31),
- 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
- 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
- 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
- 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
- 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
- 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
- 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
- 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
+ (1 << 0), (1 << 1), (1 << 2), (1 << 3),
+ (1 << 4), (1 << 5), (1 << 6), (1 << 7),
+ (1 << 8), (1 << 9), (1 << 10), (1 << 11),
+ (1 << 12), (1 << 13), (1 << 14), (1 << 15),
+ (1 << 16), (1 << 17), (1 << 18), (1 << 19),
+ (1 << 20), (1 << 21), (1 << 22), (1 << 23),
+ (1 << 24), (1 << 25), (1 << 26), (1 << 27),
+ (1 << 28), (1 << 29), (1 << 30), (1 << 31),
+ 1.0 / (1ULL << 32), 1.0 / (1 << 31), 1.0 / (1 << 30), 1.0 / (1 << 29),
+ 1.0 / (1 << 28), 1.0 / (1 << 27), 1.0 / (1 << 26), 1.0 / (1 << 25),
+ 1.0 / (1 << 24), 1.0 / (1 << 23), 1.0 / (1 << 22), 1.0 / (1 << 21),
+ 1.0 / (1 << 20), 1.0 / (1 << 19), 1.0 / (1 << 18), 1.0 / (1 << 17),
+ 1.0 / (1 << 16), 1.0 / (1 << 15), 1.0 / (1 << 14), 1.0 / (1 << 13),
+ 1.0 / (1 << 12), 1.0 / (1 << 11), 1.0 / (1 << 10), 1.0 / (1 << 9),
+ 1.0 / (1 << 8), 1.0 / (1 << 7), 1.0 / (1 << 6), 1.0 / (1 << 5),
+ 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
};
static const float GC_ALIGNED16(m_dequantizeTableS[]) =
{
- 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
- 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
- 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
- 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
- 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
- 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
- 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
- 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
- (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
- (1 << 28), (1 << 27), (1 << 26), (1 << 25),
- (1 << 24), (1 << 23), (1 << 22), (1 << 21),
- (1 << 20), (1 << 19), (1 << 18), (1 << 17),
- (1 << 16), (1 << 15), (1 << 14), (1 << 13),
- (1 << 12), (1 << 11), (1 << 10), (1 << 9),
- (1 << 8), (1 << 7), (1 << 6), (1 << 5),
- (1 << 4), (1 << 3), (1 << 2), (1 << 1),
+ 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
+ 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
+ 1.0 / (1 << 8), 1.0 / (1 << 9), 1.0 / (1 << 10), 1.0 / (1 << 11),
+ 1.0 / (1 << 12), 1.0 / (1 << 13), 1.0 / (1 << 14), 1.0 / (1 << 15),
+ 1.0 / (1 << 16), 1.0 / (1 << 17), 1.0 / (1 << 18), 1.0 / (1 << 19),
+ 1.0 / (1 << 20), 1.0 / (1 << 21), 1.0 / (1 << 22), 1.0 / (1 << 23),
+ 1.0 / (1 << 24), 1.0 / (1 << 25), 1.0 / (1 << 26), 1.0 / (1 << 27),
+ 1.0 / (1 << 28), 1.0 / (1 << 29), 1.0 / (1 << 30), 1.0 / (1 << 31),
+ (1ULL << 32), (1 << 31), (1 << 30), (1 << 29),
+ (1 << 28), (1 << 27), (1 << 26), (1 << 25),
+ (1 << 24), (1 << 23), (1 << 22), (1 << 21),
+ (1 << 20), (1 << 19), (1 << 18), (1 << 17),
+ (1 << 16), (1 << 15), (1 << 14), (1 << 13),
+ (1 << 12), (1 << 11), (1 << 10), (1 << 9),
+ (1 << 8), (1 << 7), (1 << 6), (1 << 5),
+ (1 << 4), (1 << 3), (1 << 2), (1 << 1),
};
static float GC_ALIGNED16(psTemp[4]);
@@ -440,9 +439,9 @@ void CommonAsmRoutines::GenQuantizedLoads()
RET();
const u8* loadPairedU8One = AlignCode4();
- UnsafeLoadRegToRegNoSwap(ECX, ECX, 8, 0); // ECX = 0x000000xx
+ UnsafeLoadRegToRegNoSwap(ECX, ECX, 8, 0); // ECX = 0x000000xx
MOVD_xmm(XMM0, R(ECX));
- CVTDQ2PS(XMM0, R(XMM0)); // Is CVTSI2SS better?
+ CVTDQ2PS(XMM0, R(XMM0)); // Is CVTSI2SS better?
SHR(32, R(EAX), Imm8(6));
MOVSS(XMM1, MDisp(EAX, (u32)(u64)m_dequantizeTableS));
MULSS(XMM0, R(XMM1));
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h
index a25df98..5d6e92a 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h
+++ b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Jit_Util.h"
+#include "Core/PowerPC/JitCommon/Jit_Util.h"
class CommonAsmRoutinesBase
{
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
index 828d8a6..79469a5 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.cpp
@@ -2,15 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <string>
#include <cinttypes>
+#include <string>
-#include "Common.h"
#include "disasm.h"
-#include "JitBase.h"
-#include "JitBackpatch.h"
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitBackpatch.h"
+
#ifdef _WIN32
#include <windows.h>
#endif
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.h b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.h
index 1d6a031..38f142b 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.h
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBackpatch.h
@@ -4,9 +4,9 @@
#pragma once
-#include "Common.h"
-#include "x64Emitter.h"
-#include "x64Analyzer.h"
+#include "Common/Common.h"
+#include "Common/x64Emitter.h"
+#include "Common/x64Analyzer.h"
// meh.
#if defined(_WIN32)
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
index d135e98..dc49c89 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
@@ -4,9 +4,10 @@
#include <sstream>
-#include "JitBase.h"
-#include "PowerPCDisasm.h"
#include "disasm.h"
+#include "PowerPCDisasm.h"
+
+#include "Core/PowerPC/JitCommon/JitBase.h"
JitBase *jit;
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/PowerPC/JitCommon/JitBase.h
index 920d461..55e5fe6 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBase.h
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.h
@@ -8,24 +8,25 @@
//#define JIT_LOG_GPR // Enables logging of the PPC general purpose regs
//#define JIT_LOG_FPR // Enables logging of the PPC floating point regs
-#include "JitAsmCommon.h"
-#include "JitCache.h"
-#include "Jit_Util.h" // for EmuCodeBlock
-#include "JitBackpatch.h" // for EmuCodeBlock
-#include "x64ABI.h"
-#include "x64Analyzer.h"
-#include "x64Emitter.h"
-#include "../CPUCoreBase.h"
-#include "../PowerPC.h"
-#include "../PPCAnalyst.h"
-#include "../PPCTables.h"
-#include "../../Core.h"
-#include "../../CoreTiming.h"
-#include "../../HW/GPFifo.h"
-#include "../../HW/Memmap.h"
-
#include <unordered_set>
+#include "Common/x64ABI.h"
+#include "Common/x64Analyzer.h"
+#include "Common/x64Emitter.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/CPUCoreBase.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitCommon/JitAsmCommon.h"
+#include "Core/PowerPC/JitCommon/JitBackpatch.h" // for EmuCodeBlock
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "Core/PowerPC/JitCommon/Jit_Util.h" // for EmuCodeBlock
+
// Use these to control the instruction selection
// #define INSTRUCTION_START Default(inst); return;
// #define INSTRUCTION_START PPCTables::CountInstruction(inst);
@@ -91,7 +92,7 @@ public:
virtual void Jit(u32 em_address) = 0;
- virtual const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) = 0;
+ virtual const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) = 0;
virtual const CommonAsmRoutinesBase *GetAsmRoutines() = 0;
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
index a7efa3d..d34bdc9 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
@@ -9,18 +9,17 @@
// performance hit, it's not enabled by default, but it's useful for
// locating performance issues.
-#include "Common.h"
+#include "disasm.h"
+
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
#ifdef _WIN32
#include <windows.h>
#endif
-#include "JitBase.h"
-#include "MemoryUtil.h"
-#include "disasm.h"
-
-#include "../JitInterface.h"
-
#if defined USE_OPROFILE && USE_OPROFILE
#include <opagent.h>
@@ -35,8 +34,6 @@ op_agent_t agent;
using namespace Gen;
-#define INVALID_EXIT 0xFFFFFFFF
-
bool JitBaseBlockCache::IsFull() const
{
return GetNumBlocks() >= MAX_NUM_BLOCKS - 1;
@@ -167,12 +164,7 @@ using namespace Gen;
JitBlock &b = blocks[num_blocks];
b.invalid = false;
b.originalAddress = em_address;
- b.exitAddress[0] = INVALID_EXIT;
- b.exitAddress[1] = INVALID_EXIT;
- b.exitPtrs[0] = 0;
- b.exitPtrs[1] = 0;
- b.linkStatus[0] = false;
- b.linkStatus[1] = false;
+ b.linkData.clear();
num_blocks++; //commit the current block
return num_blocks - 1;
}
@@ -193,10 +185,9 @@ using namespace Gen;
block_map[std::make_pair(pAddr + 4 * b.originalSize - 1, pAddr)] = block_num;
if (block_link)
{
- for (int i = 0; i < 2; i++)
+ for (const auto& e : b.linkData)
{
- if (b.exitAddress[i] != INVALID_EXIT)
- links_to.insert(std::pair<u32, int>(b.exitAddress[i], block_num));
+ links_to.insert(std::pair<u32, int>(e.exitAddress, block_num));
}
LinkBlock(block_num);
@@ -275,15 +266,15 @@ using namespace Gen;
// This block is dead. Don't relink it.
return;
}
- for (int e = 0; e < 2; e++)
+ for (auto& e : b.linkData)
{
- if (b.exitAddress[e] != INVALID_EXIT && !b.linkStatus[e])
+ if (!e.linkStatus)
{
- int destinationBlock = GetBlockNumberFromStartAddress(b.exitAddress[e]);
+ int destinationBlock = GetBlockNumberFromStartAddress(e.exitAddress);
if (destinationBlock != -1)
{
- WriteLinkBlock(b.exitPtrs[e], blocks[destinationBlock].checkedEntry);
- b.linkStatus[e] = true;
+ WriteLinkBlock(e.exitPtrs, blocks[destinationBlock].checkedEntry);
+ e.linkStatus = true;
}
}
}
@@ -316,12 +307,13 @@ using namespace Gen;
return;
for (multimap<u32, int>::iterator iter = ppp.first; iter != ppp.second; ++iter) {
JitBlock &sourceBlock = blocks[iter->second];
- for (int e = 0; e < 2; e++)
+ for (auto& e : sourceBlock.linkData)
{
- if (sourceBlock.exitAddress[e] == b.originalAddress)
- sourceBlock.linkStatus[e] = false;
+ if (e.exitAddress == b.originalAddress)
+ e.linkStatus = false;
}
}
+ links_to.erase(b.originalAddress);
}
void JitBaseBlockCache::DestroyBlock(int block_num, bool invalidate)
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h
index f795a02..c9621bc 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h
+++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h
@@ -8,8 +8,8 @@
#include <map>
#include <vector>
-#include "../Gekko.h"
-#include "../PPCAnalyst.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCAnalyst.h"
// Define this in order to get VTune profile support for the Jit generated code.
// Add the VTune include/lib directories to the project directories to get this to build.
@@ -34,9 +34,6 @@ struct JitBlock
const u8 *checkedEntry;
const u8 *normalEntry;
- u8 *exitPtrs[2]; // to be able to rewrite the exit jum
- u32 exitAddress[2]; // 0xFFFFFFFF == unknown
-
u32 originalAddress;
u32 codeSize;
u32 originalSize;
@@ -44,14 +41,20 @@ struct JitBlock
int flags;
bool invalid;
- bool linkStatus[2];
+
+ struct LinkData {
+ u8 *exitPtrs; // to be able to rewrite the exit jum
+ u32 exitAddress;
+ bool linkStatus; // is it already linked?
+ };
+ std::vector<LinkData> linkData;
#ifdef _WIN32
// we don't really need to save start and stop
// TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;)
- u64 ticStart; // for profiling - time.
- u64 ticStop; // for profiling - time.
- u64 ticCounter; // for profiling - time.
+ u64 ticStart; // for profiling - time.
+ u64 ticStop; // for profiling - time.
+ u64 ticCounter; // for profiling - time.
#endif
#ifdef USE_VTUNE
diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp
index 49a83e1..7475f44 100644
--- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
-#include "CPUDetect.h"
-#include "JitBase.h"
-#include "Jit_Util.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/Jit_Util.h"
using namespace Gen;
@@ -382,7 +382,7 @@ void EmuCodeBlock::SafeWriteFloatToReg(X64Reg xmm_value, X64Reg reg_addr, u32 re
void EmuCodeBlock::WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address)
{
#ifdef _M_X64
- MOV(accessSize, MDisp(RBX, address & 0x3FFFFFFF), arg);
+ MOV(accessSize, MDisp(RBX, address & 0x3FFFFFFF), arg);
#else
MOV(accessSize, M((void*)(Memory::base + (address & Memory::MEMVIEW32_MASK))), arg);
#endif
diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h
index 278b9d7..6746684 100644
--- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h
+++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h
@@ -4,9 +4,10 @@
#pragma once
-#include "x64Emitter.h"
#include <unordered_map>
+#include "Common/x64Emitter.h"
+
#define MEMCHECK_START \
FixupBranch memException; \
if (jit->js.memcheck) \
diff --git a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp
index 3a4866f..5470a6e 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/IR.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/IR.cpp
@@ -77,38 +77,41 @@ integer code are more aggresively combining blocks and dead condition
register elimination, which should be very helpful for small blocks.
TODO (in no particular order):
-JIT for misc remaining FP instructions
-JIT for bcctrx
-Misc optimizations for FP instructions
-Inter-block dead register elimination; this seems likely to have large
- performance benefits, although I'm not completely sure.
-Inter-block inlining; also likely to have large performance benefits.
- The tricky parts are deciding which blocks to inline, and that the
- IR can't really deal with branches whose destination is in the
- the middle of a generated block.
-Specialized slw/srw/sraw; I think there are some tricks that could
- have a non-trivial effect, and there are significantly shorter
- implementations for 64-bit involving abusing 64-bit shifts.
-64-bit compat (it should only be a few tweaks to register allocation and
- the load/store code)
-Scheduling to reduce register pressure: PowerPC compilers like to push
- uses far away from definitions, but it's rather unfriendly to modern
- x86 processors, which are short on registers and extremely good at
- instruction reordering.
-Common subexpression elimination
-Optimize load/store of sum using complex addressing (partially implemented)
-Loop optimizations (loop-carried registers, LICM)
-Code refactoring/cleanup
-Investigate performance of the JIT itself; this doesn't affect
- framerates significantly, but it does take a visible amount
- of time for a complicated piece of code like a video decoder
- to compile.
-Fix profiled loads/stores to work safely. On 32-bit, one solution is to
- use a spare segment register, and expand the backpatch solution
- to work in all the relevant situations. On 64-bit, the existing
- fast memory solution should basically work. An alternative
- would be to figure out a heuristic for what loads actually
- vary their "type", and special-case them.
+- JIT for misc remaining FP instructions
+- JIT for bcctrx
+- Misc optimizations for FP instructions
+- Inter-block dead register elimination; this seems likely to have large
+ performance benefits, although I'm not completely sure.
+
+- Inter-block inlining; also likely to have large performance benefits.
+ The tricky parts are deciding which blocks to inline, and that the
+ IR can't really deal with branches whose destination is in the
+ the middle of a generated block.
+
+- Specialized slw/srw/sraw; I think there are some tricks that could
+ have a non-trivial effect, and there are significantly shorter
+ implementations for 64-bit involving abusing 64-bit shifts.
+ 64-bit compat (it should only be a few tweaks to register allocation and the load/store code)
+
+- Scheduling to reduce register pressure: PowerPCcompilers like to push
+ uses far away from definitions, but it's rather unfriendly to modern
+ x86 processors, which are short on registers and extremely good at instruction reordering.
+
+- Common subexpression elimination
+- Optimize load/store of sum using complex addressing (partially implemented)
+- Loop optimizations (loop-carried registers, LICM)
+- Code refactoring/cleanup
+
+- Investigate performance of the JIT itself; this doesn't affect
+ framerates significantly, but it does take a visible amount
+ of time for a complicated piece of code like a video decoder to compile.
+
+- Fix profiled loads/stores to work safely. On 32-bit, one solution is to
+ use a spare segment register, and expand the backpatch solution
+ to work in all the relevant situations. On 64-bit, the existing
+ fast memory solution should basically work. An alternative
+ would be to figure out a heuristic for what loads actually
+ vary their "type", and special-case them.
*/
@@ -117,16 +120,17 @@ Fix profiled loads/stores to work safely. On 32-bit, one solution is to
#endif
#include <algorithm>
-#include <memory>
#include <cinttypes>
#include <ctime>
+#include <memory>
#include <set>
-#include "IR.h"
-#include "../PPCTables.h"
-#include "../../CoreTiming.h"
-#include "../../HW/Memmap.h"
-#include "../../HW/GPFifo.h"
-#include "../../Core.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitILCommon/IR.h"
using namespace Gen;
namespace IREmitter {
diff --git a/Source/Core/Core/PowerPC/JitILCommon/IR.h b/Source/Core/Core/PowerPC/JitILCommon/IR.h
index 49a1e4e..d15b379 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/IR.h
+++ b/Source/Core/Core/PowerPC/JitILCommon/IR.h
@@ -4,9 +4,10 @@
#pragma once
-#include "x64Emitter.h"
#include <vector>
+#include "Common/x64Emitter.h"
+
namespace IREmitter {
enum Opcode {
Nop = 0,
@@ -65,14 +66,14 @@ enum Opcode {
ICmpCRUnsigned, // CR for unsigned int compare
ICmpEq, // One if equal, zero otherwise
ICmpNe,
- ICmpUgt, // One if op1 > op2, zero otherwise
+ ICmpUgt, // One if op1 > op2, zero otherwise
ICmpUlt,
ICmpUge,
ICmpUle,
- ICmpSgt, // One if op1 > op2, zero otherwise
+ ICmpSgt, // One if op1 > op2, zero otherwise
ICmpSlt,
ICmpSge,
- ICmpSle, // Opposite of sgt
+ ICmpSle, // Opposite of sgt
// Memory store operators
Store8,
Store16,
@@ -147,9 +148,9 @@ enum Opcode {
RFIExit,
InterpreterBranch,
- IdleBranch, // branch operation belonging to idle loop
+ IdleBranch, // branch operation belonging to idle loop
ShortIdleLoop, // Idle loop seen in homebrew like wii mahjong,
- // just a branch
+ // just a branch
// used for exception checking, at least until someone
// has a better idea of integrating it
@@ -573,7 +574,7 @@ private:
InstLoc isNeg(InstLoc I) const;
std::vector<Inst> InstList; // FIXME: We must ensure this is continuous!
- std::vector<bool> MarkUsed; // Used for IRWriter
+ std::vector<bool> MarkUsed; // Used for IRWriter
std::vector<unsigned> ConstList;
InstLoc curReadPtr;
InstLoc GRegCache[32];
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase.h b/Source/Core/Core/PowerPC/JitILCommon/JitILBase.h
index e92e27c..24ac61b 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase.h
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase.h
@@ -4,16 +4,16 @@
#pragma once
-#include "IR.h"
-#include "../PowerPC.h"
-#include "../PPCAnalyst.h"
-#include "../PPCTables.h"
-#include "../JitCommon/JitBase.h"
-#include "../../ConfigManager.h"
-#include "../../Core.h"
-#include "../../CoreTiming.h"
-#include "../../HW/GPFifo.h"
-#include "../../HW/Memmap.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitILCommon/IR.h"
class JitILBase : public JitBase
{
@@ -31,7 +31,7 @@ public:
virtual void Jit(u32 em_address) = 0;
- virtual const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) = 0;
+ virtual const u8 *BackPatch(u8 *codePtr, u32 em_address, void *ctx) = 0;
virtual const CommonAsmRoutinesBase *GetAsmRoutines() = 0;
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp
index 6d6c594..7a6fd16 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
// The branches are known good, or at least reasonably good.
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_FloatingPoint.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_FloatingPoint.cpp
index 893bafe..afa0282 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_FloatingPoint.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
void JitILBase::fp_arith_s(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp
index 836cc9d..97eb674 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp
@@ -6,7 +6,7 @@
#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned
#endif
-#include "JitILBase.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
static void ComputeRC(IREmitter::IRBuilder& ibuild, IREmitter::InstLoc val)
{
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp
index adbf314..67a140c 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
void JitILBase::lhax(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStoreFloating.cpp
index 986489c..2e4a50c 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStoreFloating.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStoreFloating.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
// TODO: Add peephole optimizations for multiple consecutive lfd/lfs/stfd/stfs since they are so common,
// and pshufb could help a lot.
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStorePaired.cpp
index 9c1e3eb..6cc5e02 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStorePaired.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
void JitILBase::psq_st(UGeckoInstruction inst)
{
@@ -32,7 +32,7 @@ void JitILBase::psq_l(UGeckoInstruction inst)
addr = ibuild.EmitAdd(addr, ibuild.EmitLoadGReg(inst.RA));
if (inst.OPCD == 57)
ibuild.EmitStoreGReg(addr, inst.RA);
- val = ibuild.EmitLoadPaired(addr, inst.I | (inst.W << 3)); // The lower 3 bits is for GQR index. The next 1 bit is for inst.W
+ val = ibuild.EmitLoadPaired(addr, inst.I | (inst.W << 3)); // The lower 3 bits is for GQR index. The next 1 bit is for inst.W
val = ibuild.EmitExpandPackedToMReg(val);
ibuild.EmitStoreFReg(val, inst.RD);
}
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Paired.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Paired.cpp
index 7ed6549..15cd6a2 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Paired.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Paired.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
void JitILBase::ps_mr(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_SystemRegisters.cpp
index 93c6358..f171b63 100644
--- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_SystemRegisters.cpp
@@ -2,11 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "JitILBase.h"
-
-#include "../../HW/SystemTimers.h"
-
+#include "Common/Common.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/PowerPC/JitILCommon/JitILBase.h"
void JitILBase::mtspr(UGeckoInstruction inst)
{
diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp
index 91d43a7..54a82d9 100644
--- a/Source/Core/Core/PowerPC/JitInterface.cpp
+++ b/Source/Core/Core/PowerPC/JitInterface.cpp
@@ -9,27 +9,27 @@
#include <windows.h>
#endif
-#include "JitInterface.h"
-#include "JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitInterface.h"
#ifndef _M_GENERIC
-#include "Jit64IL/JitIL.h"
-#include "Jit64/Jit.h"
-#include "Jit64/Jit64_Tables.h"
-#include "Jit64IL/JitIL_Tables.h"
+#include "Core/PowerPC/Jit64/Jit.h"
+#include "Core/PowerPC/Jit64/Jit64_Tables.h"
+#include "Core/PowerPC/Jit64IL/JitIL.h"
+#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
#endif
#ifdef _M_ARM
-#include "JitArm32/Jit.h"
-#include "JitArm32/JitArm_Tables.h"
-#include "JitArmIL/JitIL.h"
-#include "JitArmIL/JitIL_Tables.h"
+#include "Core/PowerPC/JitArm32/Jit.h"
+#include "Core/PowerPC/JitArm32/JitArm_Tables.h"
+#include "Core/PowerPC/JitArmIL/JitIL.h"
+#include "Core/PowerPC/JitArmIL/JitIL_Tables.h"
#endif
-#include "Profiler.h"
-#include "PPCSymbolDB.h"
-#include "HW/Memmap.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
bool bFakeVMEM = false;
bool bMMU = false;
diff --git a/Source/Core/Core/PowerPC/JitInterface.h b/Source/Core/Core/PowerPC/JitInterface.h
index 2b6b970..51fa746 100644
--- a/Source/Core/Core/PowerPC/JitInterface.h
+++ b/Source/Core/Core/PowerPC/JitInterface.h
@@ -4,8 +4,8 @@
#pragma once
-#include "ChunkFile.h"
-#include "CPUCoreBase.h"
+#include "Common/ChunkFile.h"
+#include "Core/PowerPC/CPUCoreBase.h"
namespace JitInterface
{
diff --git a/Source/Core/Core/PowerPC/LUT_frsqrtex.cpp b/Source/Core/Core/PowerPC/LUT_frsqrtex.cpp
index 89aaf33..4f11bcf 100644
--- a/Source/Core/Core/PowerPC/LUT_frsqrtex.cpp
+++ b/Source/Core/Core/PowerPC/LUT_frsqrtex.cpp
@@ -5,7 +5,7 @@
// Gekko related unions, structs, ...
-#include "LUT_frsqrtex.h"
+#include "Core/PowerPC/LUT_frsqrtex.h"
const unsigned int frsqrtex_lut[65536] = {
0x69FA0000, 0x69F8A600, 0x69F74C00,
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 67c92ea..00925de 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -2,19 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <string>
#include <queue>
+#include <string>
+
+#include "Common/StringUtil.h"
-#include "StringUtil.h"
-#include "Interpreter/Interpreter.h"
-#include "../HW/Memmap.h"
-#include "JitInterface.h"
-#include "PPCTables.h"
-#include "PPCSymbolDB.h"
-#include "SignatureDB.h"
-#include "PPCAnalyst.h"
-#include "../ConfigManager.h"
-#include "../GeckoCode.h"
+#include "Core/ConfigManager.h"
+#include "Core/GeckoCode.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/SignatureDB.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
// Analyzes PowerPC code in memory to find functions
// After running, for each function we will know what functions it calls
@@ -287,7 +288,7 @@ u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,
// Disabled the following optimization in preference of FAST_ICACHE
//UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4);
//if (previnst.hex == 0x4e800020)
- // st->isFirstBlockOfFunction = true;
+ // st->isFirstBlockOfFunction = true;
gpa->any = true;
fpa->any = false;
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h
index 21b192f..9f898f5 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.h
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.h
@@ -5,14 +5,13 @@
#pragma once
#include <algorithm>
-#include <vector>
-#include <map>
-
#include <cstdlib>
+#include <map>
#include <string>
+#include <vector>
-#include "Common.h"
-#include "PPCTables.h"
+#include "Common/Common.h"
+#include "Core/PowerPC/PPCTables.h"
class PPCSymbolDB;
struct Symbol;
diff --git a/Source/Core/Core/PowerPC/PPCCache.cpp b/Source/Core/Core/PowerPC/PPCCache.cpp
index 0785e37..976435e 100644
--- a/Source/Core/Core/PowerPC/PPCCache.cpp
+++ b/Source/Core/Core/PowerPC/PPCCache.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "PPCCache.h"
-#include "../HW/Memmap.h"
-#include "PowerPC.h"
-#include "JitCommon/JitBase.h"
-#include "JitCommon/JitCache.h"
-#include "JitInterface.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PPCCache.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "Core/PowerPC/JitInterface.h"
namespace PowerPC
{
diff --git a/Source/Core/Core/PowerPC/PPCCache.h b/Source/Core/Core/PowerPC/PPCCache.h
index b38692d..de4b2ca 100644
--- a/Source/Core/Core/PowerPC/PPCCache.h
+++ b/Source/Core/Core/PowerPC/PPCCache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
#define FAST_ICACHE
diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
index eb5b65a..cb8f0f0 100644
--- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
+++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
@@ -6,16 +6,17 @@
#include <string>
#include <vector>
-#include "Common.h"
-#include "FileUtil.h"
-
-#include "../HW/Memmap.h"
-#include "../PowerPC/PowerPC.h"
-#include "../Host.h"
-#include "StringUtil.h"
-#include "PPCSymbolDB.h"
-#include "SignatureDB.h"
-#include "PPCAnalyst.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "Core/Host.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/SignatureDB.h"
+
PPCSymbolDB g_symbolDB;
diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.h b/Source/Core/Core/PowerPC/PPCSymbolDB.h
index fc73257..b40ef70 100644
--- a/Source/Core/Core/PowerPC/PPCSymbolDB.h
+++ b/Source/Core/Core/PowerPC/PPCSymbolDB.h
@@ -4,14 +4,14 @@
#pragma once
-#include "CommonTypes.h"
-
#include <map>
#include <string>
#include <vector>
-#include "../Debugger/PPCDebugInterface.h"
-#include "SymbolDB.h"
+#include "Common/CommonTypes.h"
+#include "Common/SymbolDB.h"
+
+#include "Core/Debugger/PPCDebugInterface.h"
// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later.
class PPCSymbolDB : public SymbolDB
diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp
index ce7d299..264fe5f 100644
--- a/Source/Core/Core/PowerPC/PPCTables.cpp
+++ b/Source/Core/Core/PowerPC/PPCTables.cpp
@@ -3,16 +3,17 @@
// Refer to the license.txt file included.
#include <algorithm>
-#include <vector>
#include <cinttypes>
+#include <vector>
+
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
-#include "Common.h"
-#include "PPCTables.h"
-#include "StringUtil.h"
-#include "FileUtil.h"
-#include "Interpreter/Interpreter.h"
-#include "Interpreter/Interpreter_Tables.h"
-#include "JitInterface.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
GekkoOPInfo *m_infoTable[64];
GekkoOPInfo *m_infoTable4[1024];
@@ -88,24 +89,24 @@ bool UsesFPU(UGeckoInstruction _inst)
{
switch (_inst.OPCD)
{
- case 04: // PS
+ case 04: // PS
return _inst.SUBOP10 != 1014;
- case 48: // lfs
- case 49: // lfsu
- case 50: // lfd
- case 51: // lfdu
- case 52: // stfs
- case 53: // stfsu
- case 54: // stfd
- case 55: // stfdu
- case 56: // psq_l
- case 57: // psq_lu
-
- case 59: // FPU-sgl
- case 60: // psq_st
- case 61: // psq_stu
- case 63: // FPU-dbl
+ case 48: // lfs
+ case 49: // lfsu
+ case 50: // lfd
+ case 51: // lfdu
+ case 52: // stfs
+ case 53: // stfsu
+ case 54: // stfd
+ case 55: // stfdu
+ case 56: // psq_l
+ case 57: // psq_lu
+
+ case 59: // FPU-sgl
+ case 60: // psq_st
+ case 61: // psq_stu
+ case 63: // FPU-dbl
return true;
case 31:
diff --git a/Source/Core/Core/PowerPC/PPCTables.h b/Source/Core/Core/PowerPC/PPCTables.h
index b54260f..82fcc9e 100644
--- a/Source/Core/Core/PowerPC/PPCTables.h
+++ b/Source/Core/Core/PowerPC/PPCTables.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Gekko.h"
-#include "Interpreter/Interpreter.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
enum
{
diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp
index 2401f0b..bf03584 100644
--- a/Source/Core/Core/PowerPC/PowerPC.cpp
+++ b/Source/Core/Core/PowerPC/PowerPC.cpp
@@ -2,25 +2,25 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "Atomic.h"
-#include "MathUtil.h"
-#include "ChunkFile.h"
-
-#include "../HW/Memmap.h"
-#include "../HW/CPU.h"
-#include "../Core.h"
-#include "../CoreTiming.h"
-#include "../HW/SystemTimers.h"
-
-#include "Interpreter/Interpreter.h"
-#include "PowerPC.h"
-#include "PPCTables.h"
-#include "CPUCoreBase.h"
-#include "JitInterface.h"
-
-#include "../Host.h"
-#include "HW/EXI.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/Host.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/SystemTimers.h"
+
+#include "Core/PowerPC/CPUCoreBase.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Interpreter/Interpreter.h"
+
CPUCoreBase *cpu_core_base;
@@ -62,13 +62,13 @@ void DoState(PointerWrap &p)
// it changes registers even in MODE_MEASURE (which is suspicious and seems like it could cause desyncs)
// and because the values it's changing have been added to CoreTiming::DoState, so it might conflict to mess with them here.
-// rSPR(SPR_DEC) = SystemTimers::GetFakeDecrementer();
-// *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL comes first :)
+ // rSPR(SPR_DEC) = SystemTimers::GetFakeDecrementer();
+ // *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL comes first :)
p.DoPOD(ppcState);
-// SystemTimers::DecrementerSet();
-// SystemTimers::TimeBaseSet();
+ // SystemTimers::DecrementerSet();
+ // SystemTimers::TimeBaseSet();
JitInterface::DoState(p);
}
@@ -357,7 +357,7 @@ void CheckExceptions()
else if (exceptions & EXCEPTION_FPU_UNAVAILABLE)
{
//This happens a lot - Gamecube OS uses deferred FPU context switching
- SRR0 = PC; // re-execute the instruction
+ SRR0 = PC; // re-execute the instruction
SRR1 = MSR & 0x87C0FFFF;
MSR |= (MSR >> 16) & 1;
MSR &= ~0x04EF36;
diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h
index 2b5c58f..12295cf 100644
--- a/Source/Core/Core/PowerPC/PowerPC.h
+++ b/Source/Core/Core/PowerPC/PowerPC.h
@@ -4,12 +4,13 @@
#pragma once
-#include "Common.h"
-#include "CPUCoreBase.h"
-#include "Gekko.h"
-#include "BreakPoints.h"
-#include "../Debugger/PPCDebugInterface.h"
-#include "PPCCache.h"
+#include "Common/BreakPoints.h"
+#include "Common/Common.h"
+
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/PowerPC/CPUCoreBase.h"
+#include "Core/PowerPC/Gekko.h"
+#include "Core/PowerPC/PPCCache.h"
class PointerWrap;
@@ -108,7 +109,7 @@ void OnIdleIL();
void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
- // Easy register access macros.
+// Easy register access macros.
#define HID0 ((UReg_HID0&)PowerPC::ppcState.spr[SPR_HID0])
#define HID2 ((UReg_HID2&)PowerPC::ppcState.spr[SPR_HID2])
#define HID4 ((UReg_HID4&)PowerPC::ppcState.spr[SPR_HID4])
@@ -126,7 +127,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
#define rSPR(i) PowerPC::ppcState.spr[i]
#define LR PowerPC::ppcState.spr[SPR_LR]
#define CTR PowerPC::ppcState.spr[SPR_CTR]
-#define rDEC PowerPC::ppcState.spr[SPR_DEC]
+#define rDEC PowerPC::ppcState.spr[SPR_DEC]
#define SRR0 PowerPC::ppcState.spr[SPR_SRR0]
#define SRR1 PowerPC::ppcState.spr[SPR_SRR1]
#define SPRG0 PowerPC::ppcState.spr[SPR_SPRG0]
@@ -134,10 +135,10 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
#define SPRG2 PowerPC::ppcState.spr[SPR_SPRG2]
#define SPRG3 PowerPC::ppcState.spr[SPR_SPRG3]
#define GQR(x) PowerPC::ppcState.spr[SPR_GQR0+x]
-#define TL PowerPC::ppcState.spr[SPR_TL]
-#define TU PowerPC::ppcState.spr[SPR_TU]
+#define TL PowerPC::ppcState.spr[SPR_TL]
+#define TU PowerPC::ppcState.spr[SPR_TU]
-#define rPS0(i) (*(double*)(&PowerPC::ppcState.ps[i][0]))
+#define rPS0(i) (*(double*)(&PowerPC::ppcState.ps[i][0]))
#define rPS1(i) (*(double*)(&PowerPC::ppcState.ps[i][1]))
#define riPS0(i) (*(u64*)(&PowerPC::ppcState.ps[i][0]))
diff --git a/Source/Core/Core/PowerPC/Profiler.cpp b/Source/Core/Core/PowerPC/Profiler.cpp
index 77da606..59a7535 100644
--- a/Source/Core/Core/PowerPC/Profiler.cpp
+++ b/Source/Core/Core/PowerPC/Profiler.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "JitInterface.h"
+#include "Core/PowerPC/JitInterface.h"
namespace Profiler
{
diff --git a/Source/Core/Core/PowerPC/Profiler.h b/Source/Core/Core/PowerPC/Profiler.h
index 420b424..771dc37 100644
--- a/Source/Core/Core/PowerPC/Profiler.h
+++ b/Source/Core/Core/PowerPC/Profiler.h
@@ -8,24 +8,24 @@
#ifdef _WIN32
#ifdef _M_IX86
-#define PROFILER_QUERY_PERFORMANCE_COUNTER(pt) \
- LEA(32, EAX, M(pt)); PUSH(EAX); \
- CALL(QueryPerformanceCounter)
+#define PROFILER_QUERY_PERFORMANCE_COUNTER(pt) \
+ LEA(32, EAX, M(pt)); PUSH(EAX); \
+ CALL(QueryPerformanceCounter)
// TODO: r64 way
// asm write : (u64) dt += t1-t0
-#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) \
- MOV(32, R(EAX), M(pt1)); \
- SUB(32, R(EAX), M(pt0)); \
- MOV(32, R(ECX), M(((u8*)pt1) + 4)); \
- SBB(32, R(ECX), M(((u8*)pt0) + 4)); \
- ADD(32, R(EAX), M(pdt)); \
- MOV(32, R(EDX), M(((u8*)pdt) + 4)); \
- ADC(32, R(EDX), R(ECX)); \
- MOV(32, M(pdt), R(EAX)); \
- MOV(32, M(((u8*)pdt) + 4), R(EDX))
-
-#define PROFILER_VPUSH PUSH(EAX);PUSH(ECX);PUSH(EDX)
-#define PROFILER_VPOP POP(EDX);POP(ECX);POP(EAX)
+#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) \
+ MOV(32, R(EAX), M(pt1)); \
+ SUB(32, R(EAX), M(pt0)); \
+ MOV(32, R(ECX), M(((u8*)pt1) + 4)); \
+ SBB(32, R(ECX), M(((u8*)pt0) + 4)); \
+ ADD(32, R(EAX), M(pdt)); \
+ MOV(32, R(EDX), M(((u8*)pdt) + 4)); \
+ ADC(32, R(EDX), R(ECX)); \
+ MOV(32, M(pdt), R(EAX)); \
+ MOV(32, M(((u8*)pdt) + 4), R(EDX))
+
+#define PROFILER_VPUSH PUSH(EAX);PUSH(ECX);PUSH(EDX)
+#define PROFILER_VPOP POP(EDX);POP(ECX);POP(EAX)
#else
diff --git a/Source/Core/Core/PowerPC/SignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB.cpp
index 82474fc..1d21ddc 100644
--- a/Source/Core/Core/PowerPC/SignatureDB.cpp
+++ b/Source/Core/Core/PowerPC/SignatureDB.cpp
@@ -2,13 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "PPCAnalyst.h"
-#include "../HW/Memmap.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
-#include "SignatureDB.h"
-#include "PPCSymbolDB.h"
+#include "Core/HW/Memmap.h"
+
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/SignatureDB.h"
namespace {
diff --git a/Source/Core/Core/PowerPC/SignatureDB.h b/Source/Core/Core/PowerPC/SignatureDB.h
index 4d0e451..9d1029b 100644
--- a/Source/Core/Core/PowerPC/SignatureDB.h
+++ b/Source/Core/Core/PowerPC/SignatureDB.h
@@ -4,11 +4,11 @@
#pragma once
-#include "CommonTypes.h"
-
#include <map>
#include <string>
+#include "Common/CommonTypes.h"
+
// You're not meant to keep around SignatureDB objects persistently. Use 'em, throw them away.
class PPCSymbolDB;
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index 1d5f720..3d8f3d5 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -2,26 +2,28 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "Timer.h"
-#include "State.h"
-#include "Core.h"
-#include "ConfigManager.h"
-#include "StringUtil.h"
-#include "Thread.h"
-#include "CoreTiming.h"
-#include "Movie.h"
-#include "HW/Wiimote.h"
-#include "HW/DSP.h"
-#include "HW/HW.h"
-#include "HW/CPU.h"
-#include "PowerPC/JitCommon/JitBase.h"
-#include "VideoBackendBase.h"
-
#include <lzo/lzo1x.h>
-#include "HW/Memmap.h"
-#include "HW/VideoInterface.h"
-#include "HW/SystemTimers.h"
+
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "Core/Core.h"
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/Movie.h"
+#include "Core/State.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/HW.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/SystemTimers.h"
+#include "Core/HW/VideoInterface.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+
+#include "VideoCommon/VideoBackendBase.h"
namespace State
{
@@ -59,7 +61,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
-static const u32 STATE_VERSION = 21;
+static const u32 STATE_VERSION = 22;
enum
{
@@ -252,7 +254,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
f.WriteArray(&header, 1);
- if (0 != header.size) // non-zero header size means the state is compressed
+ if (header.size != 0) // non-zero header size means the state is compressed
{
lzo_uint i = 0;
while (true)
@@ -282,7 +284,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
i += cur_len;
}
}
- else // uncompressed
+ else // uncompressed
{
f.WriteBytes(buffer_data, buffer_size);
}
@@ -374,7 +376,7 @@ void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_data)
std::vector<u8> buffer;
- if (0 != header.size) // non-zero size means the state is compressed
+ if (header.size != 0) // non-zero size means the state is compressed
{
Core::DisplayMessage("Decompressing State...", 500);
@@ -402,7 +404,7 @@ void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_data)
i += new_len;
}
}
- else // uncompressed
+ else // uncompressed
{
const size_t size = (size_t)(f.GetSize() - sizeof(StateHeader));
buffer.resize(size);
diff --git a/Source/Core/Core/Tracer.cpp b/Source/Core/Core/Tracer.cpp
index a57d40b..787b66f 100644
--- a/Source/Core/Core/Tracer.cpp
+++ b/Source/Core/Core/Tracer.cpp
@@ -2,15 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdlib.h>
+#include <cstdlib>
-#include "Common.h"
-#include "Tracer.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
-#include "Host.h"
-
-#include "PowerPC/PowerPC.h"
+#include "Core/Host.h"
+#include "Core/Tracer.h"
+#include "Core/PowerPC/PowerPC.h"
namespace Core {
diff --git a/Source/Core/Core/VolumeHandler.cpp b/Source/Core/Core/VolumeHandler.cpp
index 5ceba83..d1c8d4c 100644
--- a/Source/Core/Core/VolumeHandler.cpp
+++ b/Source/Core/Core/VolumeHandler.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VolumeHandler.h"
-#include "VolumeCreator.h"
+#include "Core/VolumeHandler.h"
+#include "DiscIO/VolumeCreator.h"
namespace VolumeHandler
{
diff --git a/Source/Core/Core/VolumeHandler.h b/Source/Core/Core/VolumeHandler.h
index ca47074..2a6e8f9 100644
--- a/Source/Core/Core/VolumeHandler.h
+++ b/Source/Core/Core/VolumeHandler.h
@@ -9,8 +9,9 @@
#pragma once
#include <string>
-#include "CommonTypes.h"
-#include "Volume.h"
+
+#include "Common/CommonTypes.h"
+#include "DiscIO/Volume.h"
namespace VolumeHandler
{
diff --git a/Source/Core/Core/ec_wii.cpp b/Source/Core/Core/ec_wii.cpp
index f512d82..bb858a9 100644
--- a/Source/Core/Core/ec_wii.cpp
+++ b/Source/Core/Core/ec_wii.cpp
@@ -7,13 +7,15 @@
// Licensed under the terms of the GNU GPL, version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
-#include <stdio.h>
+#include <cstdio>
#include <string.h>
-#include "Common.h"
+
#include "polarssl/sha1.h"
-#include "Crypto/tools.h"
-#include "FileUtil.h"
-#include "ec_wii.h"
+
+#include "Common/FileUtil.h"
+#include "Common/Crypto/tools.h"
+
+#include "Core/ec_wii.h"
static u32 default_NG_id = 0x0403AC68;
static u32 default_NG_key_id = 0x6AAB8C59;
diff --git a/Source/Core/Core/ec_wii.h b/Source/Core/Core/ec_wii.h
index 0874fe5..b995114 100644
--- a/Source/Core/Core/ec_wii.h
+++ b/Source/Core/Core/ec_wii.h
@@ -11,12 +11,12 @@
*
* Structs for keys.bin taken from:
*
- * mini - a Free Software replacement for the Nintendo/BroadOn IOS.
- * crypto hardware support
+ * mini - a Free Software replacement for the Nintendo/BroadOn IOS.
+ * crypto hardware support
*
- * Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
- * Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
- * Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
+ * Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
+ * Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
+ * Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
*
* # This code is licensed to you under the terms of the GNU GPL, version 2;
* # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
@@ -24,7 +24,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
void get_ng_cert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig);
void get_ap_sig_and_cert(u8 *sig_out, u8 *ap_cert_out, u64 title_id, u8 *data, u32 data_size, const u8 *NG_priv, u32 NG_id);
diff --git a/Source/Core/Core/stdafx.h b/Source/Core/Core/stdafx.h
index bc50463..167fccc 100644
--- a/Source/Core/Core/stdafx.h
+++ b/Source/Core/Core/stdafx.h
@@ -9,6 +9,6 @@
#define _WIN32_IE 0x0500 // Default value is 0x0400
#endif
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <algorithm>
diff --git a/Source/Core/Core/x64MemTools.cpp b/Source/Core/Core/x64MemTools.cpp
index a5ed163..5c65695 100644
--- a/Source/Core/Core/x64MemTools.cpp
+++ b/Source/Core/Core/x64MemTools.cpp
@@ -2,22 +2,23 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
+#include <cstdio>
+#include <vector>
+
#ifdef __APPLE__
-#include "Thread.h"
+#include "Common/Thread.h"
#endif
-#include <vector>
+#include "Common/Common.h"
+#include "Common/x64Analyzer.h"
-#include "Common.h"
-#include "MemTools.h"
-#include "HW/Memmap.h"
-#include "PowerPC/PowerPC.h"
-#include "PowerPC/JitInterface.h"
+#include "Core/MemTools.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PowerPC.h"
#ifndef _M_GENERIC
-#include "PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
#endif
-#include "x64Analyzer.h"
namespace EMM
{
diff --git a/Source/Core/DiscIO/BannerLoader.cpp b/Source/Core/DiscIO/BannerLoader.cpp
index 11f9697..d0c59c5 100644
--- a/Source/Core/DiscIO/BannerLoader.cpp
+++ b/Source/Core/DiscIO/BannerLoader.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "BannerLoader.h"
-#include "BannerLoaderWii.h"
-#include "BannerLoaderGC.h"
+#include "Common/FileUtil.h"
-#include "VolumeCreator.h"
-#include "FileUtil.h"
+#include "DiscIO/BannerLoader.h"
+#include "DiscIO/BannerLoaderGC.h"
+#include "DiscIO/BannerLoaderWii.h"
+#include "DiscIO/VolumeCreator.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/BannerLoader.h b/Source/Core/DiscIO/BannerLoader.h
index 0d34193..d291f7f 100644
--- a/Source/Core/DiscIO/BannerLoader.h
+++ b/Source/Core/DiscIO/BannerLoader.h
@@ -4,10 +4,10 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
-#include "Filesystem.h"
+#include "DiscIO/Filesystem.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/BannerLoaderGC.cpp b/Source/Core/DiscIO/BannerLoaderGC.cpp
index ce35258..bc6ba34 100644
--- a/Source/Core/DiscIO/BannerLoaderGC.cpp
+++ b/Source/Core/DiscIO/BannerLoaderGC.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonTypes.h"
-#include "ColorUtil.h"
-#include "BannerLoaderGC.h"
+#include "Common/ColorUtil.h"
+#include "Common/CommonTypes.h"
+#include "DiscIO/BannerLoaderGC.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/BannerLoaderGC.h b/Source/Core/DiscIO/BannerLoaderGC.h
index 5242600..d4d26d8 100644
--- a/Source/Core/DiscIO/BannerLoaderGC.h
+++ b/Source/Core/DiscIO/BannerLoaderGC.h
@@ -4,9 +4,10 @@
#pragma once
-#include "BannerLoader.h"
-#include "VolumeGC.h"
-#include "StringUtil.h"
+#include "Common/StringUtil.h"
+
+#include "DiscIO/BannerLoader.h"
+#include "DiscIO/VolumeGC.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/BannerLoaderWii.cpp b/Source/Core/DiscIO/BannerLoaderWii.cpp
index 15c4325..a037a83 100644
--- a/Source/Core/DiscIO/BannerLoaderWii.cpp
+++ b/Source/Core/DiscIO/BannerLoaderWii.cpp
@@ -2,15 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
#include <algorithm>
+#include <cstdio>
-#include "CommonTypes.h"
-#include "ColorUtil.h"
-#include "BannerLoaderWii.h"
-#include "VolumeCreator.h"
-#include "FileUtil.h"
-#include "FileHandlerARC.h"
+#include "Common/ColorUtil.h"
+#include "Common/CommonTypes.h"
+#include "Common/FileUtil.h"
+
+#include "DiscIO/BannerLoaderWii.h"
+#include "DiscIO/FileHandlerARC.h"
+#include "DiscIO/VolumeCreator.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/BannerLoaderWii.h b/Source/Core/DiscIO/BannerLoaderWii.h
index bfc8f7c..45cbb13 100644
--- a/Source/Core/DiscIO/BannerLoaderWii.h
+++ b/Source/Core/DiscIO/BannerLoaderWii.h
@@ -4,7 +4,7 @@
#pragma once
-#include "BannerLoader.h"
+#include "DiscIO/BannerLoader.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp
index 600b9e0..f8a831d 100644
--- a/Source/Core/DiscIO/Blob.cpp
+++ b/Source/Core/DiscIO/Blob.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Blob.h"
-#include "CDUtils.h"
-#include "CISOBlob.h"
-#include "CompressedBlob.h"
-#include "DriveBlob.h"
-#include "FileBlob.h"
-#include "FileUtil.h"
-#include "WbfsBlob.h"
+#include "Common/CDUtils.h"
+#include "Common/FileUtil.h"
+
+#include "DiscIO/Blob.h"
+#include "DiscIO/CISOBlob.h"
+#include "DiscIO/CompressedBlob.h"
+#include "DiscIO/DriveBlob.h"
+#include "DiscIO/FileBlob.h"
+#include "DiscIO/WbfsBlob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h
index 5fdfe26..c93d47c 100644
--- a/Source/Core/DiscIO/Blob.h
+++ b/Source/Core/DiscIO/Blob.h
@@ -14,7 +14,7 @@
// detect whether the file is a compressed blob, or just a big hunk of data, or a drive, and
// automatically do the right thing.
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/CISOBlob.cpp b/Source/Core/DiscIO/CISOBlob.cpp
index 5070c8e..4bf97ae 100644
--- a/Source/Core/DiscIO/CISOBlob.cpp
+++ b/Source/Core/DiscIO/CISOBlob.cpp
@@ -5,8 +5,8 @@
#include <algorithm>
#include <cmath>
-#include "Blob.h"
-#include "CISOBlob.h"
+#include "DiscIO/Blob.h"
+#include "DiscIO/CISOBlob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/CISOBlob.h b/Source/Core/DiscIO/CISOBlob.h
index 5cd0166..26f2a84 100644
--- a/Source/Core/DiscIO/CISOBlob.h
+++ b/Source/Core/DiscIO/CISOBlob.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp
index ac3050f..f3dd250 100644
--- a/Source/Core/DiscIO/CompressedBlob.cpp
+++ b/Source/Core/DiscIO/CompressedBlob.cpp
@@ -10,13 +10,13 @@
#endif
#include <cinttypes>
+#include <zlib.h>
-#include "CompressedBlob.h"
-#include "DiscScrubber.h"
-#include "FileUtil.h"
-#include "Hash.h"
+#include "Common/FileUtil.h"
+#include "Common/Hash.h"
+#include "DiscIO/CompressedBlob.h"
+#include "DiscIO/DiscScrubber.h"
-#include "zlib.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/CompressedBlob.h b/Source/Core/DiscIO/CompressedBlob.h
index 2d201de..a170239 100644
--- a/Source/Core/DiscIO/CompressedBlob.h
+++ b/Source/Core/DiscIO/CompressedBlob.h
@@ -16,8 +16,8 @@
#include <string>
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp
index 445f25b..b127498 100644
--- a/Source/Core/DiscIO/DiscScrubber.cpp
+++ b/Source/Core/DiscIO/DiscScrubber.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Filesystem.h"
-#include "VolumeCreator.h"
-#include "FileUtil.h"
-#include "DiscScrubber.h"
-
#include <cinttypes>
+#include "Common/FileUtil.h"
+#include "DiscIO/DiscScrubber.h"
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/VolumeCreator.h"
+
namespace DiscIO
{
@@ -238,7 +238,7 @@ bool ParseDisc()
for (auto& rPartition : PartitionGroup[x].PartitionsVec)
{
- const SPartitionHeader& rHeader = rPartition.Header;
+ const SPartitionHeader& rHeader = rPartition.Header;
MarkAsUsed(rPartition.Offset, 0x2c0);
diff --git a/Source/Core/DiscIO/DiscScrubber.h b/Source/Core/DiscIO/DiscScrubber.h
index c1efacb..5b29fda 100644
--- a/Source/Core/DiscIO/DiscScrubber.h
+++ b/Source/Core/DiscIO/DiscScrubber.h
@@ -13,8 +13,8 @@
#pragma once
-#include "CommonTypes.h"
-#include "Blob.h"
+#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
diff --git a/Source/Core/DiscIO/DriveBlob.cpp b/Source/Core/DiscIO/DriveBlob.cpp
index 017cd70..ad0a72a 100644
--- a/Source/Core/DiscIO/DriveBlob.cpp
+++ b/Source/Core/DiscIO/DriveBlob.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DriveBlob.h"
-#include "StringUtil.h"
+#include "Common/StringUtil.h"
+#include "DiscIO/DriveBlob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/DriveBlob.h b/Source/Core/DiscIO/DriveBlob.h
index 5f4a70a..1e70859 100644
--- a/Source/Core/DiscIO/DriveBlob.h
+++ b/Source/Core/DiscIO/DriveBlob.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Blob.h"
#ifdef _WIN32
#include <windows.h>
diff --git a/Source/Core/DiscIO/FileBlob.cpp b/Source/Core/DiscIO/FileBlob.cpp
index 42ea73c..d97a4b1 100644
--- a/Source/Core/DiscIO/FileBlob.cpp
+++ b/Source/Core/DiscIO/FileBlob.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileBlob.h"
+#include "DiscIO/FileBlob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/FileBlob.h b/Source/Core/DiscIO/FileBlob.h
index 21778a0..cafa074 100644
--- a/Source/Core/DiscIO/FileBlob.h
+++ b/Source/Core/DiscIO/FileBlob.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/FileHandlerARC.cpp b/Source/Core/DiscIO/FileHandlerARC.cpp
index 26ec6ec..8e820e6 100644
--- a/Source/Core/DiscIO/FileHandlerARC.cpp
+++ b/Source/Core/DiscIO/FileHandlerARC.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileHandlerARC.h"
-#include "StringUtil.h"
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+#include "DiscIO/Blob.h"
+#include "DiscIO/FileHandlerARC.h"
#define ARC_ID 0x55aa382d
diff --git a/Source/Core/DiscIO/FileHandlerARC.h b/Source/Core/DiscIO/FileHandlerARC.h
index 93f5bde..23ff978 100644
--- a/Source/Core/DiscIO/FileHandlerARC.h
+++ b/Source/Core/DiscIO/FileHandlerARC.h
@@ -7,8 +7,8 @@
#include <string>
#include <vector>
-#include "CommonTypes.h"
-#include "Filesystem.h"
+#include "Common/CommonTypes.h"
+#include "DiscIO/Filesystem.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp
index ae2f9c0..bae2f49 100644
--- a/Source/Core/DiscIO/FileMonitor.cpp
+++ b/Source/Core/DiscIO/FileMonitor.cpp
@@ -2,20 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <algorithm>
#include <iostream>
-#include <vector>
#include <string>
-#include <algorithm>
+#include <vector>
+#include "Common/Common.h"
+#include "Common/IniFile.h"
+#include "Common/LogManager.h"
-#include "Common.h"
-#include "IniFile.h"
-#include "LogManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
-#include "../Core/Core.h"
-#include "../Core/ConfigManager.h"
-#include "FileSystemGCWii.h"
-#include "VolumeCreator.h"
+#include "DiscIO/FileSystemGCWii.h"
+#include "DiscIO/VolumeCreator.h"
namespace FileMon
{
diff --git a/Source/Core/DiscIO/FileMonitor.h b/Source/Core/DiscIO/FileMonitor.h
index 2b35597..2ce4af3 100644
--- a/Source/Core/DiscIO/FileMonitor.h
+++ b/Source/Core/DiscIO/FileMonitor.h
@@ -6,7 +6,7 @@
#include <iostream> // System: For std
-#include "Common.h" // Common: For u64
+#include "Common/Common.h" // Common: For u64
namespace FileMon
diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp
index cc09138..078fb55 100644
--- a/Source/Core/DiscIO/FileSystemGCWii.cpp
+++ b/Source/Core/DiscIO/FileSystemGCWii.cpp
@@ -2,16 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "FileUtil.h"
-
-#include <string>
-#include <vector>
#include <algorithm>
#include <cinttypes>
+#include <string>
+#include <vector>
+
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
-#include "FileSystemGCWii.h"
-#include "StringUtil.h"
+#include "DiscIO/FileSystemGCWii.h"
namespace DiscIO
{
@@ -121,8 +121,8 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const
{
u32 AppSize = Read32(0x2440 + 0x14);// apploader size
- AppSize += Read32(0x2440 + 0x18); // + trailer size
- AppSize += 0x20; // + header size
+ AppSize += Read32(0x2440 + 0x18); // + trailer size
+ AppSize += 0x20; // + header size
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
std::vector<u8> buffer(AppSize);
@@ -150,8 +150,8 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
// Iterate through the 7 code segments
for (u8 i = 0; i < 7; i++)
{
- offset = Read32(DolOffset + 0x00 + i * 4);
- size = Read32(DolOffset + 0x90 + i * 4);
+ offset = Read32(DolOffset + 0x00 + i * 4);
+ size = Read32(DolOffset + 0x90 + i * 4);
if (offset + size > DolSize)
DolSize = offset + size;
}
@@ -159,8 +159,8 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
// Iterate through the 11 data segments
for (u8 i = 0; i < 11; i++)
{
- offset = Read32(DolOffset + 0x1c + i * 4);
- size = Read32(DolOffset + 0xac + i * 4);
+ offset = Read32(DolOffset + 0x1c + i * 4);
+ size = Read32(DolOffset + 0xac + i * 4);
if (offset + size > DolSize)
DolSize = offset + size;
}
diff --git a/Source/Core/DiscIO/FileSystemGCWii.h b/Source/Core/DiscIO/FileSystemGCWii.h
index af8040d..7444711 100644
--- a/Source/Core/DiscIO/FileSystemGCWii.h
+++ b/Source/Core/DiscIO/FileSystemGCWii.h
@@ -6,7 +6,7 @@
#include <vector>
-#include "Filesystem.h"
+#include "DiscIO/Filesystem.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/Filesystem.cpp b/Source/Core/DiscIO/Filesystem.cpp
index cdf6288..fc07bae 100644
--- a/Source/Core/DiscIO/Filesystem.cpp
+++ b/Source/Core/DiscIO/Filesystem.cpp
@@ -2,10 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Filesystem.h"
-
-#include "VolumeCreator.h"
-#include "FileSystemGCWii.h"
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/FileSystemGCWii.h"
+#include "DiscIO/VolumeCreator.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/Filesystem.h b/Source/Core/DiscIO/Filesystem.h
index 10b85e2..b67f0d4 100644
--- a/Source/Core/DiscIO/Filesystem.h
+++ b/Source/Core/DiscIO/Filesystem.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Volume.h"
+#include "DiscIO/Volume.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp
index e5b36c5..35d51a5 100644
--- a/Source/Core/DiscIO/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/NANDContentLoader.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "NANDContentLoader.h"
-
#include <algorithm>
#include <cctype>
#include <polarssl/aes.h>
-#include "MathUtil.h"
-#include "FileUtil.h"
-#include "Log.h"
-#include "WiiWad.h"
-#include "StringUtil.h"
+
+#include "Common/FileUtil.h"
+#include "Common/Log.h"
+#include "Common/MathUtil.h"
+#include "Common/StringUtil.h"
+
+#include "DiscIO/NANDContentLoader.h"
+#include "DiscIO/WiiWad.h"
namespace DiscIO
{
@@ -92,7 +93,7 @@ public:
virtual ~CNANDContentLoader();
- bool IsValid() const override { return m_Valid; }
+ bool IsValid() const override { return m_Valid; }
void RemoveTitle(void) const override;
u64 GetTitleID() const override { return m_TitleID; }
u16 GetIosVersion() const override { return m_IosVersion; }
diff --git a/Source/Core/DiscIO/NANDContentLoader.h b/Source/Core/DiscIO/NANDContentLoader.h
index fa517ca..bff9297 100644
--- a/Source/Core/DiscIO/NANDContentLoader.h
+++ b/Source/Core/DiscIO/NANDContentLoader.h
@@ -4,15 +4,16 @@
#pragma once
+#include <map>
#include <string>
#include <vector>
-#include <map>
-#include "Common.h"
-#include "Blob.h"
-#include "Volume.h"
-#include "NandPaths.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/NandPaths.h"
+
+#include "DiscIO/Blob.h"
+#include "DiscIO/Volume.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index 92112be..5343a9f 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -7,8 +7,8 @@
#include <string>
#include <vector>
-#include "Common.h"
-#include "StringUtil.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/VolumeCommon.cpp b/Source/Core/DiscIO/VolumeCommon.cpp
index 53eb994..af367c7 100644
--- a/Source/Core/DiscIO/VolumeCommon.cpp
+++ b/Source/Core/DiscIO/VolumeCommon.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Volume.h"
+#include "DiscIO/Volume.h"
namespace DiscIO
{
@@ -79,19 +79,19 @@ u8 GetSysMenuRegion(u16 _TitleVersion)
{
switch(_TitleVersion)
{
- case 128: case 192: case 224: case 256:
- case 288: case 352: case 384: case 416:
- case 448: case 480: case 512:
+ case 128: case 192: case 224: case 256:
+ case 288: case 352: case 384: case 416:
+ case 448: case 480: case 512:
return 'J';
- case 97: case 193: case 225: case 257:
- case 289: case 353: case 385: case 417:
- case 449: case 481: case 513:
+ case 97: case 193: case 225: case 257:
+ case 289: case 353: case 385: case 417:
+ case 449: case 481: case 513:
return 'E';
- case 130: case 162: case 194: case 226:
- case 258: case 290: case 354: case 386:
- case 418: case 450: case 482: case 514:
+ case 130: case 162: case 194: case 226:
+ case 258: case 290: case 354: case 386:
+ case 418: case 450: case 482: case 514:
return 'P';
- case 326: case 390: case 454: case 486:
+ case 326: case 390: case 454: case 486:
case 518:
return 'K';
default:
diff --git a/Source/Core/DiscIO/VolumeCreator.cpp b/Source/Core/DiscIO/VolumeCreator.cpp
index 4a47d79..74d4a5d 100644
--- a/Source/Core/DiscIO/VolumeCreator.cpp
+++ b/Source/Core/DiscIO/VolumeCreator.cpp
@@ -6,16 +6,16 @@
#include <polarssl/aes.h>
-#include "VolumeCreator.h"
+#include "Common/Hash.h"
+#include "Common/StringUtil.h"
-#include "Volume.h"
-#include "VolumeDirectory.h"
-#include "VolumeGC.h"
-#include "VolumeWiiCrypted.h"
-#include "VolumeWad.h"
+#include "DiscIO/Volume.h"
+#include "DiscIO/VolumeCreator.h"
+#include "DiscIO/VolumeDirectory.h"
+#include "DiscIO/VolumeGC.h"
+#include "DiscIO/VolumeWad.h"
+#include "DiscIO/VolumeWiiCrypted.h"
-#include "Hash.h"
-#include "StringUtil.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/VolumeCreator.h b/Source/Core/DiscIO/VolumeCreator.h
index a92ec2e..a9f1e43 100644
--- a/Source/Core/DiscIO/VolumeCreator.h
+++ b/Source/Core/DiscIO/VolumeCreator.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Volume.h"
+#include "DiscIO/Volume.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp
index a501a9c..eeaa5fe 100644
--- a/Source/Core/DiscIO/VolumeDirectory.cpp
+++ b/Source/Core/DiscIO/VolumeDirectory.cpp
@@ -2,10 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonPaths.h"
-#include "FileBlob.h"
-#include "MathUtil.h"
-#include "VolumeDirectory.h"
+#include "Common/CommonPaths.h"
+#include "Common/MathUtil.h"
+
+#include "DiscIO/FileBlob.h"
+#include "DiscIO/VolumeDirectory.h"
namespace DiscIO
{
@@ -240,8 +241,8 @@ std::string CVolumeDirectory::ExtractDirectoryName(const std::string& _rDirector
if(lastSep != directoryName.size() - 1)
{
// TODO: This assumes that file names will always have a dot in them
- // and directory names never will; both assumptions are often
- // right but in general wrong.
+ // and directory names never will; both assumptions are often
+ // right but in general wrong.
size_t extensionStart = directoryName.find_last_of('.');
if(extensionStart != std::string::npos && extensionStart > lastSep)
{
@@ -344,7 +345,7 @@ void CVolumeDirectory::BuildFST()
// read data from physical disk to rootEntry
u32 totalEntries = AddDirectoryEntries(m_rootDirectory, rootEntry) + 1;
- m_fstNameOffset = totalEntries * ENTRY_SIZE; // offset in FST nameTable
+ m_fstNameOffset = totalEntries * ENTRY_SIZE; // offset in FST nameTable
m_fstSize = m_fstNameOffset + m_totalNameSize;
m_FSTData = new u8[(u32)m_fstSize];
@@ -356,9 +357,9 @@ void CVolumeDirectory::BuildFST()
m_dataStartAddress = ROUND_UP(FST_ADDRESS + m_fstSize, 0x8000ull);
u64 curDataAddress = m_dataStartAddress;
- u32 fstOffset = 0; // offset within FST data
- u32 nameOffset = 0; // offset within name table
- u32 rootOffset = 0; // offset of root of FST
+ u32 fstOffset = 0; // Offset within FST data
+ u32 nameOffset = 0; // Offset within name table
+ u32 rootOffset = 0; // Offset of root of FST
// write root entry
WriteEntryData(fstOffset, DIRECTORY_ENTRY, 0, 0, totalEntries);
diff --git a/Source/Core/DiscIO/VolumeDirectory.h b/Source/Core/DiscIO/VolumeDirectory.h
index c6a387b..4f9a47f 100644
--- a/Source/Core/DiscIO/VolumeDirectory.h
+++ b/Source/Core/DiscIO/VolumeDirectory.h
@@ -7,8 +7,8 @@
#include <map>
#include <string>
-#include "FileUtil.h"
-#include "Volume.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Volume.h"
//
// --- this volume type is used for reading files directly from the hard drive ---
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp
index f2d9746..8039d56 100644
--- a/Source/Core/DiscIO/VolumeGC.cpp
+++ b/Source/Core/DiscIO/VolumeGC.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VolumeGC.h"
-#include "StringUtil.h"
-#include "FileMonitor.h"
+#include "Common/StringUtil.h"
+#include "DiscIO/FileMonitor.h"
+#include "DiscIO/VolumeGC.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/VolumeGC.h b/Source/Core/DiscIO/VolumeGC.h
index 3ed802c..42b7524 100644
--- a/Source/Core/DiscIO/VolumeGC.h
+++ b/Source/Core/DiscIO/VolumeGC.h
@@ -4,14 +4,14 @@
#pragma once
-#include "Volume.h"
-#include "Blob.h"
+#include "DiscIO/Blob.h"
+#include "DiscIO/Volume.h"
// --- this volume type is used for GC disc images ---
namespace DiscIO
{
-class CVolumeGC : public IVolume
+class CVolumeGC : public IVolume
{
public:
CVolumeGC(IBlobReader* _pReader);
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index cc50ec8..d436c99 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -3,11 +3,11 @@
// Refer to the license.txt file included.
#include <algorithm>
-#include <math.h>
+#include <cmath>
-#include "VolumeWad.h"
-#include "StringUtil.h"
-#include "MathUtil.h"
+#include "Common/MathUtil.h"
+#include "Common/StringUtil.h"
+#include "DiscIO/VolumeWad.h"
#define ALIGN_40(x) ROUND_UP(Common::swap32(x), 0x40)
diff --git a/Source/Core/DiscIO/VolumeWad.h b/Source/Core/DiscIO/VolumeWad.h
index cd5835c..7ae0068 100644
--- a/Source/Core/DiscIO/VolumeWad.h
+++ b/Source/Core/DiscIO/VolumeWad.h
@@ -4,9 +4,9 @@
#pragma once
-#include "Volume.h"
-#include "Blob.h"
-#include "NANDContentLoader.h"
+#include "DiscIO/Blob.h"
+#include "DiscIO/NANDContentLoader.h"
+#include "DiscIO/Volume.h"
// --- this volume type is used for Wad files ---
// Some of this code might look redundant with the CNANDContentLoader class, however,
@@ -25,8 +25,8 @@ public:
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::vector<std::string> GetNames() const;
- u32 GetFSTSize() const { return 0; }
- std::string GetApploaderDate() const { return "0"; }
+ u32 GetFSTSize() const { return 0; }
+ std::string GetApploaderDate() const { return "0"; }
ECountry GetCountry() const;
u64 GetSize() const;
u64 GetRawSize() const;
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
index 8d2e46a..69b7869 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
@@ -2,11 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VolumeWiiCrypted.h"
-#include "VolumeGC.h"
-#include "StringUtil.h"
#include <polarssl/sha1.h>
+#include "Common/StringUtil.h"
+#include "DiscIO/VolumeGC.h"
+#include "DiscIO/VolumeWiiCrypted.h"
+
namespace DiscIO
{
@@ -82,7 +83,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
// increase buffers
_Length -= CopySize;
- _pBuffer += CopySize;
+ _pBuffer += CopySize;
_ReadOffset += CopySize;
}
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h
index 9ff9b99..51033b1 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.h
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.h
@@ -4,15 +4,16 @@
#pragma once
-#include "Volume.h"
-#include "Blob.h"
#include <polarssl/aes.h>
+#include "DiscIO/Blob.h"
+#include "DiscIO/Volume.h"
+
// --- this volume type is used for encrypted Wii images ---
namespace DiscIO
{
-class CVolumeWiiCrypted : public IVolume
+class CVolumeWiiCrypted : public IVolume
{
public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp
index 7a4d8d9..a13e268 100644
--- a/Source/Core/DiscIO/WbfsBlob.cpp
+++ b/Source/Core/DiscIO/WbfsBlob.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "WbfsBlob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/WbfsBlob.h"
namespace DiscIO
{
@@ -187,10 +187,10 @@ bool IsWbfsBlob(const char* filename)
u8 magic[4] = {0, 0, 0, 0};
f.ReadBytes(&magic, 4);
- return (magic[0] == 'W') &&
- (magic[1] == 'B') &&
- (magic[2] == 'F') &&
- (magic[3] == 'S');
+ return (magic[0] == 'W') &&
+ (magic[1] == 'B') &&
+ (magic[2] == 'F') &&
+ (magic[3] == 'S');
}
} // namespace
diff --git a/Source/Core/DiscIO/WbfsBlob.h b/Source/Core/DiscIO/WbfsBlob.h
index 0ac4ecf..83ac436 100644
--- a/Source/Core/DiscIO/WbfsBlob.h
+++ b/Source/Core/DiscIO/WbfsBlob.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Blob.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/WiiWad.cpp b/Source/Core/DiscIO/WiiWad.cpp
index 783ede5..8c6cda7 100644
--- a/Source/Core/DiscIO/WiiWad.cpp
+++ b/Source/Core/DiscIO/WiiWad.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "NANDContentLoader.h"
#include <algorithm>
#include <cctype>
-#include "MathUtil.h"
-#include "FileUtil.h"
-#include "Log.h"
-#include "WiiWad.h"
+
+#include "Common/FileUtil.h"
+#include "Common/Log.h"
+#include "Common/MathUtil.h"
+#include "DiscIO/NANDContentLoader.h"
+#include "DiscIO/WiiWad.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/WiiWad.h b/Source/Core/DiscIO/WiiWad.h
index cde7349..b72f616 100644
--- a/Source/Core/DiscIO/WiiWad.h
+++ b/Source/Core/DiscIO/WiiWad.h
@@ -4,13 +4,13 @@
#pragma once
+#include <map>
#include <string>
#include <vector>
-#include <map>
-#include "CommonTypes.h"
-#include "Blob.h"
-#include "Volume.h"
+#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
+#include "DiscIO/Volume.h"
namespace DiscIO
{
diff --git a/Source/Core/DiscIO/stdafx.cpp b/Source/Core/DiscIO/stdafx.cpp
index 89b0473..8ab4b84 100644
--- a/Source/Core/DiscIO/stdafx.cpp
+++ b/Source/Core/DiscIO/stdafx.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "DiscIO/stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
diff --git a/Source/Core/DolphinWX/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/ARCodeAddEdit.cpp
index d3dacf5..0143e15 100644
--- a/Source/Core/DolphinWX/ARCodeAddEdit.cpp
+++ b/Source/Core/DolphinWX/ARCodeAddEdit.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ARCodeAddEdit.h"
-#include "ARDecrypt.h"
-#include "WxUtils.h"
+#include "Core/ARDecrypt.h"
+#include "DolphinWX/ARCodeAddEdit.h"
+#include "DolphinWX/WxUtils.h"
extern std::vector<ActionReplay::ARCode> arCodes;
@@ -44,9 +44,9 @@ CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id,
UpdateTextCtrl(tempEntries);
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
- sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
- sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
- sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
+ sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
+ sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
+ sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sgEntry->AddGrowableCol(1);
sgEntry->AddGrowableRow(1);
sbEntry->Add(sgEntry, 1, wxEXPAND|wxALL);
diff --git a/Source/Core/DolphinWX/ARCodeAddEdit.h b/Source/Core/DolphinWX/ARCodeAddEdit.h
index e621308..9f22a0c 100644
--- a/Source/Core/DolphinWX/ARCodeAddEdit.h
+++ b/Source/Core/DolphinWX/ARCodeAddEdit.h
@@ -4,9 +4,10 @@
#pragma once
-#include <wx/wx.h>
#include <wx/spinctrl.h>
-#include "ISOProperties.h"
+#include <wx/wx.h>
+
+#include "DolphinWX/ISOProperties.h"
class CARCodeAddEdit : public wxDialog
{
diff --git a/Source/Core/DolphinWX/AboutDolphin.cpp b/Source/Core/DolphinWX/AboutDolphin.cpp
index d197185..c17c219 100644
--- a/Source/Core/DolphinWX/AboutDolphin.cpp
+++ b/Source/Core/DolphinWX/AboutDolphin.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "AboutDolphin.h"
-#include "WxUtils.h"
-#include "resources/dolphin_logo.cpp"
+#include "Common/Common.h"
+#include "DolphinWX/AboutDolphin.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/resources/dolphin_logo.cpp"
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
const wxString &title, const wxPoint &position,
diff --git a/Source/Core/DolphinWX/AboutDolphin.h b/Source/Core/DolphinWX/AboutDolphin.h
index c9fd714..4c1f430 100644
--- a/Source/Core/DolphinWX/AboutDolphin.h
+++ b/Source/Core/DolphinWX/AboutDolphin.h
@@ -4,13 +4,13 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/dialog.h>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/statbox.h>
+#include <wx/dialog.h>
#include <wx/mstream.h>
#include <wx/statbmp.h>
+#include <wx/statbox.h>
+#include <wx/stattext.h>
+#include <wx/wx.h>
class AboutDolphin : public wxDialog
{
diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp
index 7d4fb97..a8ebafd 100644
--- a/Source/Core/DolphinWX/Android/ButtonManager.cpp
+++ b/Source/Core/DolphinWX/Android/ButtonManager.cpp
@@ -1,23 +1,11 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#include <unordered_map>
-#include "GLInterface/GLInterface.h"
-#include "Android/ButtonManager.h"
+
+#include "DolphinWX/Android/ButtonManager.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
namespace ButtonManager
{
@@ -25,26 +13,28 @@ namespace ButtonManager
std::map<std::pair<int, int>, Button*> m_buttons;
std::map<std::pair<int, int>, Axis*> m_axises;
std::unordered_map<std::string, InputDevice*> m_controllers;
- const char* configStrings[] = { "InputA",
- "InputB",
- "InputStart",
- "InputX",
- "InputY",
- "InputZ",
- "DPadUp",
- "DPadDown",
- "DPadLeft",
- "DPadRight",
- "MainUp",
- "MainDown",
- "MainLeft",
- "MainRight",
- "CStickUp",
- "CStickDown",
- "CStickLeft",
- "CStickRight",
- "InputL",
- "InputR" };
+ const char* configStrings[] = {
+ "InputA",
+ "InputB",
+ "InputStart",
+ "InputX",
+ "InputY",
+ "InputZ",
+ "DPadUp",
+ "DPadDown",
+ "DPadLeft",
+ "DPadRight",
+ "MainUp",
+ "MainDown",
+ "MainLeft",
+ "MainRight",
+ "CStickUp",
+ "CStickDown",
+ "CStickLeft",
+ "CStickRight",
+ "InputL",
+ "InputR"
+ };
const int configStringNum = 20;
void AddBind(std::string dev, sBind *bind)
diff --git a/Source/Core/DolphinWX/Android/ButtonManager.h b/Source/Core/DolphinWX/Android/ButtonManager.h
index 07b3bff..f56157d 100644
--- a/Source/Core/DolphinWX/Android/ButtonManager.h
+++ b/Source/Core/DolphinWX/Android/ButtonManager.h
@@ -1,26 +1,13 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#pragma once
-#include <string>
#include <map>
-#include "CommonPaths.h"
-#include "VideoBackendBase.h"
+#include <string>
+#include "Common/CommonPaths.h"
+#include "VideoCommon/VideoBackendBase.h"
namespace ButtonManager
{
diff --git a/Source/Core/DolphinWX/CheatsWindow.cpp b/Source/Core/DolphinWX/CheatsWindow.cpp
index 8bea682..398b981 100644
--- a/Source/Core/DolphinWX/CheatsWindow.cpp
+++ b/Source/Core/DolphinWX/CheatsWindow.cpp
@@ -2,19 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-#include "CheatsWindow.h"
-#include "ActionReplay.h"
-#include "CommonPaths.h"
-#include "Core.h"
-#include "ConfigManager.h"
-#include "VolumeHandler.h"
-#include "ISOProperties.h"
-#include "HW/Memmap.h"
-#include "Frame.h"
-#include "WxUtils.h"
-
-#define MAX_CHEAT_SEARCH_RESULTS_DISPLAY 256
+#include "Common/CommonPaths.h"
+#include "Core/ActionReplay.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/Memmap.h"
+#include "DolphinWX/CheatsWindow.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/ISOProperties.h"
+#include "DolphinWX/WxUtils.h"
+
+
+#define MAX_CHEAT_SEARCH_RESULTS_DISPLAY 256
extern std::vector<ActionReplay::ARCode> arCodes;
extern CFrame* main_frame;
@@ -424,7 +425,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
const int filters[] = {7, 6, 1, 2, 4};
int filter_mask = filters[search_type->GetSelection()];
- if (value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
+ if (value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
{
for (; i!=e; ++i)
{
@@ -442,7 +443,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
}
}
}
- else // using user entered x value comparison
+ else // using user entered x value comparison
{
u32 user_x_val;
@@ -638,7 +639,7 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
arCodes.push_back(new_cheat);
// save the gameini
isoprops.SaveGameConfig();
- isoprops.ActionReplayList_Load(); // loads the new arcodes
+ isoprops.ActionReplayList_Load(); // loads the new arcodes
//ActionReplay::UpdateActiveList();
}
diff --git a/Source/Core/DolphinWX/CheatsWindow.h b/Source/Core/DolphinWX/CheatsWindow.h
index 6ebbbad..d7823a9 100644
--- a/Source/Core/DolphinWX/CheatsWindow.h
+++ b/Source/Core/DolphinWX/CheatsWindow.h
@@ -4,28 +4,25 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/sizer.h>
+#include <string>
+#include <vector>
+#include <wx/colour.h>
#include <wx/filepicker.h>
-#include <wx/statbmp.h>
-#include <wx/imaglist.h>
-#include <wx/treectrl.h>
#include <wx/gbsizer.h>
-#include <wx/textctrl.h>
-#include <wx/notebook.h>
-#include <wx/mimetype.h>
-#include <wx/colour.h>
+#include <wx/imaglist.h>
#include <wx/listbox.h>
+#include <wx/mimetype.h>
+#include <wx/notebook.h>
+#include <wx/sizer.h>
+#include <wx/statbmp.h>
+#include <wx/textctrl.h>
+#include <wx/treectrl.h>
+#include <wx/wx.h>
-#include <string>
-#include <vector>
-
-#include "ActionReplay.h"
-
-#include "GeckoCodeDiag.h"
-
-#include "Filesystem.h"
-#include "IniFile.h"
+#include "Common/IniFile.h"
+#include "Core/ActionReplay.h"
+#include "DiscIO/Filesystem.h"
+#include "DolphinWX/GeckoCodeDiag.h"
class CreateCodeDialog : public wxDialog
{
@@ -60,13 +57,13 @@ protected:
u32 old_value;
};
- std::vector<CheatSearchResult> search_results;
+ std::vector<CheatSearchResult> search_results;
unsigned int search_type_size;
wxChoice* search_type;
- wxListBox* lbox_search_results;
+ wxListBox* lbox_search_results;
wxStaticText* label_results_count;
- wxTextCtrl* textctrl_value_x;
+ wxTextCtrl* textctrl_value_x;
wxButton *btnInitScan, *btnNextScan;
struct
diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp
index 75f0d17..62e41de 100644
--- a/Source/Core/DolphinWX/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/ConfigMain.cpp
@@ -2,35 +2,37 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <string> // System
-#include <vector>
#include <algorithm>
#include <functional>
+#include <string>
+#include <vector>
#include <wx/spinbutt.h>
-#include "Common.h"
-#include "CommonPaths.h"
-#include "FileSearch.h"
-
-#include "Core.h" // Core
-#include "HW/EXI.h"
-#include "HW/SI.h"
-#include "HW/DSPHLE/DSPHLE.h"
-#include "HW/DSPLLE/DSPLLE.h"
-#include "HW/GCMemcard.h"
-#include "IPC_HLE/WII_IPC_HLE.h"
-#include "NANDContentLoader.h"
-
-#include "WxUtils.h"
-#include "Globals.h" // Local
-#include "ConfigMain.h"
-#include "ConfigManager.h"
-#include "SysConf.h"
-#include "Frame.h"
-#include "HotkeyDlg.h"
-#include "Main.h"
-#include "VideoBackendBase.h"
-#include "NetPlayProto.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileSearch.h"
+#include "Common/SysConf.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/NetPlayProto.h"
+#include "Core/HW/EXI.h"
+#include "Core/HW/GCMemcard.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/DSPHLE/DSPHLE.h"
+#include "Core/HW/DSPLLE/DSPLLE.h"
+#include "Core/IPC_HLE/WII_IPC_HLE.h"
+
+#include "DiscIO/NANDContentLoader.h"
+
+#include "DolphinWX/ConfigMain.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/HotkeyDlg.h"
+#include "DolphinWX/Main.h"
+#include "DolphinWX/WxUtils.h"
+
+#include "VideoCommon/VideoBackendBase.h"
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize)
@@ -84,23 +86,23 @@ static const wxLanguage langIds[] =
};
// Strings for Device Selections
-#define DEV_NONE_STR _trans("<Nothing>")
-#define DEV_DUMMY_STR _trans("Dummy")
-
-#define SIDEV_STDCONT_STR _trans("Standard Controller")
-#define SIDEV_STEERING_STR _trans("Steering Wheel")
-#define SIDEV_DANCEMAT_STR _trans("Dance Mat")
-#define SIDEV_BONGO_STR _trans("TaruKonga (Bongos)")
-#define SIDEV_GBA_STR "GBA"
-#define SIDEV_AM_BB_STR _trans("AM-Baseboard")
-
-#define EXIDEV_MEMCARD_STR _trans("Memory Card")
-#define EXIDEV_MIC_STR _trans("Mic")
-#define EXIDEV_BBA_STR "BBA"
-#define EXIDEV_AM_BB_STR _trans("AM-Baseboard")
-#define EXIDEV_GECKO_STR "USBGecko"
-
-#define WXSTR_TRANS(a) wxString(wxGetTranslation(wxT(a)))
+#define DEV_NONE_STR _trans("<Nothing>")
+#define DEV_DUMMY_STR _trans("Dummy")
+
+#define SIDEV_STDCONT_STR _trans("Standard Controller")
+#define SIDEV_STEERING_STR _trans("Steering Wheel")
+#define SIDEV_DANCEMAT_STR _trans("Dance Mat")
+#define SIDEV_BONGO_STR _trans("TaruKonga (Bongos)")
+#define SIDEV_GBA_STR "GBA"
+#define SIDEV_AM_BB_STR _trans("AM-Baseboard")
+
+#define EXIDEV_MEMCARD_STR _trans("Memory Card")
+#define EXIDEV_MIC_STR _trans("Mic")
+#define EXIDEV_BBA_STR "BBA"
+#define EXIDEV_AM_BB_STR _trans("AM-Baseboard")
+#define EXIDEV_GECKO_STR "USBGecko"
+
+#define WXSTR_TRANS(a) wxString(wxGetTranslation(wxT(a)))
#ifdef WIN32
//only used with xgettext to be picked up as translatable string.
//win32 does not have wx on its path, the provided wxALL_FILES
@@ -246,7 +248,7 @@ void CConfigMain::InitializeGUILists()
arrayStringFor_Framelimit.Add(_("Off"));
arrayStringFor_Framelimit.Add(_("Auto"));
arrayStringFor_Framelimit.Add(_("Audio"));
- for (int i = 10; i <= 120; i += 5) // from 10 to 120
+ for (int i = 10; i <= 120; i += 5) // from 10 to 120
arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
// Emulator Engine
@@ -1090,7 +1092,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
ExpansionInterface::ChangeDevice(
isSlotA ? 0 : 1, // SlotA: channel 0, SlotB channel 1
EXIDEVICE_MEMORYCARD,
- 0); // SP1 is device 2, slots are device 0
+ 0); // SP1 is device 2, slots are device 0
}
}
else
@@ -1159,9 +1161,9 @@ void CConfigMain::ChooseEXIDevice(wxString deviceName, int deviceNum)
{
// Change plugged device! :D
ExpansionInterface::ChangeDevice(
- (deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
- tempType, // The device enum to change to
- (deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
+ (deviceNum == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
+ tempType, // The device enum to change to
+ (deviceNum == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
}
}
@@ -1311,7 +1313,7 @@ inline u8 CConfigMain::GetSADRCountryCode(int language)
case 1: //English
countrycode = 49; // United States
break;
- case 2: //German
+ case 2: //German
countrycode = 78; //Germany
break;
case 3: //French
@@ -1323,7 +1325,7 @@ inline u8 CConfigMain::GetSADRCountryCode(int language)
case 5: //Italian
countrycode = 83; //Italy
break;
- case 6: //Dutch
+ case 6: //Dutch
countrycode = 94; //Netherlands
break;
case 7: //Simplified Chinese
diff --git a/Source/Core/DolphinWX/ConfigMain.h b/Source/Core/DolphinWX/ConfigMain.h
index 04ccc96..9aafeed 100644
--- a/Source/Core/DolphinWX/ConfigMain.h
+++ b/Source/Core/DolphinWX/ConfigMain.h
@@ -4,14 +4,16 @@
#pragma once
-#include <wx/wx.h>
+#include <wx/filepicker.h>
#include <wx/gbsizer.h>
-#include <wx/spinbutt.h>
#include <wx/notebook.h>
-#include <wx/filepicker.h>
-#include "ConfigManager.h"
+#include <wx/spinbutt.h>
+#include <wx/spinctrl.h>
+#include <wx/wx.h>
+
+#include "Core/ConfigManager.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR
-#include "X11Utils.h"
+#include "DolphinWX/X11Utils.h"
#endif
class CConfigMain : public wxDialog
@@ -135,13 +137,13 @@ private:
// Audio
wxBoxSizer* sAudioPage; // GC settings
wxRadioBox* DSPEngine;
- wxSlider* VolumeSlider;
+ wxSlider* VolumeSlider;
wxStaticText* VolumeText;
- wxCheckBox* DumpAudio;
- wxCheckBox* DPL2Decoder;
+ wxCheckBox* DumpAudio;
+ wxCheckBox* DPL2Decoder;
wxArrayString wxArrayBackends;
- wxChoice* BackendSelection;
- wxSpinCtrl* Latency;
+ wxChoice* BackendSelection;
+ wxSpinCtrl* Latency;
// Interface
wxCheckBox* ConfirmStop;
diff --git a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp
index 64348e3..047464e 100644
--- a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp
+++ b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "BreakpointDlg.h"
-#include "StringUtil.h"
-#include "PowerPC/PowerPC.h"
-#include "BreakpointWindow.h"
-#include "../WxUtils.h"
+#include "Common/StringUtil.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/BreakpointDlg.h"
+#include "DolphinWX/Debugger/BreakpointWindow.h"
BEGIN_EVENT_TABLE(BreakPointDlg, wxDialog)
EVT_BUTTON(wxID_OK, BreakPointDlg::OnOK)
diff --git a/Source/Core/DolphinWX/Debugger/BreakpointView.cpp b/Source/Core/DolphinWX/Debugger/BreakpointView.cpp
index c23412e..4934122 100644
--- a/Source/Core/DolphinWX/Debugger/BreakpointView.cpp
+++ b/Source/Core/DolphinWX/Debugger/BreakpointView.cpp
@@ -4,13 +4,13 @@
#include <wx/wx.h>
-#include "BreakpointView.h"
-#include "DebuggerUIUtil.h"
-#include "Debugger/Debugger_SymbolMap.h"
-#include "PowerPC/PPCSymbolDB.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/Memmap.h"
-#include "../WxUtils.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/BreakpointView.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id)
: wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
diff --git a/Source/Core/DolphinWX/Debugger/BreakpointView.h b/Source/Core/DolphinWX/Debugger/BreakpointView.h
index 564760f..e53eacd 100644
--- a/Source/Core/DolphinWX/Debugger/BreakpointView.h
+++ b/Source/Core/DolphinWX/Debugger/BreakpointView.h
@@ -5,7 +5,8 @@
#pragma once
#include <wx/listctrl.h>
-#include "Common.h"
+
+#include "Common/Common.h"
class CBreakPointView : public wxListCtrl
{
diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp
index ed00fd2..8afc73f 100644
--- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp
@@ -2,19 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "BreakpointWindow.h"
-#include "BreakpointView.h"
-#include "CodeWindow.h"
-#include "HW/Memmap.h"
-#include "BreakpointDlg.h"
-#include "MemoryCheckDlg.h"
-#include "PowerPC/PowerPC.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/Debugger/BreakpointDlg.h"
+#include "DolphinWX/Debugger/BreakpointView.h"
+#include "DolphinWX/Debugger/BreakpointWindow.h"
+#include "DolphinWX/Debugger/CodeWindow.h"
+#include "DolphinWX/Debugger/MemoryCheckDlg.h"
extern "C" {
-#include "../resources/toolbar_add_breakpoint.c"
-#include "../resources/toolbar_add_memorycheck.c"
-#include "../resources/toolbar_debugger_delete.c"
+#include "DolphinWX/resources/toolbar_add_breakpoint.c"
+#include "DolphinWX/resources/toolbar_add_memorycheck.c"
+#include "DolphinWX/resources/toolbar_debugger_delete.c"
}
class CBreakPointBar : public wxAuiToolBar
@@ -26,12 +26,9 @@ public:
{
SetToolBitmapSize(wxSize(24, 24));
- m_Bitmaps[Toolbar_Delete] =
- wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(24, 24));
- m_Bitmaps[Toolbar_Add_BP] =
- wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(24, 24));
- m_Bitmaps[Toolbar_Add_MC] =
- wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(24, 24));
+ m_Bitmaps[Toolbar_Delete] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(24, 24));
+ m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(24, 24));
+ m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(24, 24));
AddTool(ID_DELETE, wxT("Delete"), m_Bitmaps[Toolbar_Delete]);
Bind(wxEVT_COMMAND_TOOL_CLICKED, &CBreakPointWindow::OnDelete, parent, ID_DELETE);
@@ -85,8 +82,8 @@ BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
END_EVENT_TABLE()
CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent,
- wxWindowID id, const wxString& title, const wxPoint& position,
- const wxSize& size, long style)
+ wxWindowID id, const wxString& title, const wxPoint& position,
+ const wxSize& size, long style)
: wxPanel(parent, id, position, size, style, title)
, m_pCodeWindow(_pCodeWindow)
{
diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.h b/Source/Core/DolphinWX/Debugger/BreakpointWindow.h
index 9efccb7..6e8235b 100644
--- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.h
+++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.h
@@ -4,8 +4,8 @@
#pragma once
-#include <wx/wx.h>
#include <wx/listctrl.h>
+#include <wx/wx.h>
#include <wx/aui/aui.h>
class CBreakPointView;
diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp
index b4d6c43..9dc5237 100644
--- a/Source/Core/DolphinWX/Debugger/CodeView.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp
@@ -2,20 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "StringUtil.h"
-#include "DebuggerUIUtil.h"
-#include "DebugInterface.h"
-
-#include "Host.h"
-#include "CodeView.h"
-#include "SymbolDB.h"
-#include "../WxUtils.h"
-
-#include <wx/event.h>
#include <wx/clipbrd.h>
+#include <wx/event.h>
#include <wx/textdlg.h>
+#include "Common/Common.h"
+#include "Common/DebugInterface.h"
+#include "Common/StringUtil.h"
+#include "Common/SymbolDB.h"
+#include "Core/Host.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/CodeView.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
+
DEFINE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE);
enum
diff --git a/Source/Core/DolphinWX/Debugger/CodeView.h b/Source/Core/DolphinWX/Debugger/CodeView.h
index 18bed46..8d41e5e 100644
--- a/Source/Core/DolphinWX/Debugger/CodeView.h
+++ b/Source/Core/DolphinWX/Debugger/CodeView.h
@@ -7,11 +7,11 @@
#define wxUSE_XPM_IN_MSW 1
#define USE_XPM_BITMAPS 1
-#include <wx/wx.h>
+#include <vector>
-#include "Common.h"
+#include <wx/wx.h>
-#include <vector>
+#include "Common/Common.h"
DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1);
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
index 2094455..8e58eaa 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
@@ -2,44 +2,39 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-// Include
-#include "Common.h"
-
#include <wx/wx.h>
-#include "Host.h"
-
-#include "RegisterWindow.h"
-#include "BreakpointWindow.h"
-#include "MemoryWindow.h"
-#include "JitWindow.h"
-
-#include "CodeWindow.h"
-#include "CodeView.h"
-
-#include "../WxUtils.h"
-#include "FileUtil.h"
-#include "Core.h"
-#include "HW/Memmap.h"
-#include "HLE/HLE.h"
-#include "Boot/Boot.h"
-#include "LogManager.h"
-#include "HW/CPU.h"
-#include "PowerPC/PowerPC.h"
-#include "PowerPC/JitInterface.h"
-#include "Debugger/PPCDebugInterface.h"
-#include "Debugger/Debugger_SymbolMap.h"
-#include "PowerPC/PPCAnalyst.h"
-#include "PowerPC/PPCSymbolDB.h"
-#include "PowerPC/SignatureDB.h"
-#include "PowerPC/PPCTables.h"
-
-#include "ConfigManager.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/Boot/Boot.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/JitInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/SignatureDB.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/BreakpointWindow.h"
+#include "DolphinWX/Debugger/CodeView.h"
+#include "DolphinWX/Debugger/CodeWindow.h"
+#include "DolphinWX/Debugger/JitWindow.h"
+#include "DolphinWX/Debugger/MemoryWindow.h"
+#include "DolphinWX/Debugger/RegisterWindow.h"
+
extern "C" // Bitmaps
{
- #include "../resources/toolbar_add_memorycheck.c"
- #include "../resources/toolbar_add_breakpoint.c"
+ #include "DolphinWX/resources/toolbar_add_memorycheck.c" // NOLINT
+ #include "DolphinWX/resources/toolbar_add_breakpoint.c" // NOLINT
}
// -------
@@ -59,12 +54,12 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
// Other
- EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
- EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
- EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
- EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
+ EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
+ EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
+ EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
+ EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
- EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
+ EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
END_EVENT_TABLE()
@@ -562,12 +557,12 @@ void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
h = m_Bitmaps[0].GetHeight();
toolBar->SetToolBitmapSize(wxSize(w, h));
- toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
- toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
- toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
+ toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
+ toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
+ toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
toolBar->AddSeparator();
- toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
- toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
+ toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
+ toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
toolBar->AddSeparator();
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T("")));
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h
index 59ad2bb..1dd5287 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindow.h
+++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h
@@ -4,17 +4,15 @@
#pragma once
+#include <wx/artprov.h>
#include <wx/dialog.h>
-#include <wx/textctrl.h>
#include <wx/listbox.h>
-#include <wx/artprov.h>
-
-#include "Thread.h"
-#include "CoreParameter.h"
+#include <wx/textctrl.h>
-// GUI global
-#include "../Globals.h"
-#include "../Frame.h"
+#include "Common/Thread.h"
+#include "Core/CoreParameter.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/Globals.h"
class CFrame;
class CRegisterWindow;
@@ -57,8 +55,7 @@ class CCodeWindow
void Update();
void NotifyMapLoaded();
- void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
- wxMenuBar *pMenuBar);
+ void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxAuiToolBar*);
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
index be6d8e4..0de5320 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
@@ -2,45 +2,42 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CommonPaths.h"
-
#include <wx/fontdlg.h>
#include <wx/mimetype.h>
-#include "Host.h"
-
-#include "DebuggerUIUtil.h"
-
-#include "../WxUtils.h"
-#include "RegisterWindow.h"
-#include "BreakpointWindow.h"
-#include "MemoryWindow.h"
-#include "JitWindow.h"
-#include "DebuggerPanel.h"
-#include "DSPDebugWindow.h"
-#include "FileUtil.h"
-
-#include "CodeWindow.h"
-#include "CodeView.h"
-
-#include "Core.h"
-#include "HLE/HLE.h"
-#include "Boot/Boot.h"
-#include "LogManager.h"
-#include "HW/CPU.h"
-#include "PowerPC/PowerPC.h"
-#include "Debugger/PPCDebugInterface.h"
-#include "Debugger/Debugger_SymbolMap.h"
-#include "PowerPC/PPCAnalyst.h"
-#include "PowerPC/Profiler.h"
-#include "PowerPC/PPCSymbolDB.h"
-#include "PowerPC/SignatureDB.h"
-#include "PowerPC/PPCTables.h"
-#include "PowerPC/JitCommon/JitBase.h"
-#include "PowerPC/JitCommon/JitCache.h" // for ClearCache()
-
-#include "ConfigManager.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/Boot/Boot.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/HLE/HLE.h"
+#include "Core/HW/CPU.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "Core/PowerPC/PPCTables.h"
+#include "Core/PowerPC/Profiler.h"
+#include "Core/PowerPC/SignatureDB.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitCache.h" // for ClearCache()
+
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/BreakpointWindow.h"
+#include "DolphinWX/Debugger/CodeView.h"
+#include "DolphinWX/Debugger/CodeWindow.h"
+#include "DolphinWX/Debugger/DebuggerPanel.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
+#include "DolphinWX/Debugger/DSPDebugWindow.h"
+#include "DolphinWX/Debugger/JitWindow.h"
+#include "DolphinWX/Debugger/MemoryWindow.h"
+#include "DolphinWX/Debugger/RegisterWindow.h"
+
// Save and load settings
// -----------------------------
@@ -94,8 +91,7 @@ void CCodeWindow::Save()
IniFile ini;
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
- ini.Set("General", "DebuggerFont",
- WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
+ ini.Set("General", "DebuggerFont", WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
// Boot to pause or not
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
@@ -352,7 +348,7 @@ void CCodeWindow::NotifyMapLoaded()
g_symbolDB.FillInCallers();
//symbols->Show(false); // hide it for faster filling
- symbols->Freeze(); // HyperIris: wx style fast filling
+ symbols->Freeze(); // HyperIris: wx style fast filling
symbols->Clear();
for (const auto& symbol : g_symbolDB.Symbols())
{
@@ -408,8 +404,6 @@ void CCodeWindow::OpenPages()
Parent->ToggleLogWindow(true);
if (bShowOnStart[IDM_LOGCONFIGWINDOW - IDM_LOGWINDOW])
Parent->ToggleLogConfigWindow(true);
- if (bShowOnStart[IDM_CONSOLEWINDOW - IDM_LOGWINDOW])
- Parent->ToggleConsole(true);
if (bShowOnStart[IDM_REGISTERWINDOW - IDM_LOGWINDOW])
ToggleRegisterWindow(true);
if (bShowOnStart[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW])
@@ -428,8 +422,8 @@ void CCodeWindow::ToggleCodeWindow(bool bShow)
{
if (bShow)
Parent->DoAddPage(this,
- iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
else // Hide
Parent->DoRemovePage(this);
}
@@ -440,10 +434,10 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow)
if (bShow)
{
if (!m_RegisterWindow)
- m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
+ m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
Parent->DoAddPage(m_RegisterWindow,
- iNbAffiliation[IDM_REGISTERWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_REGISTERWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
@@ -458,10 +452,10 @@ void CCodeWindow::ToggleBreakPointWindow(bool bShow)
if (bShow)
{
if (!m_BreakpointWindow)
- m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
+ m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
Parent->DoAddPage(m_BreakpointWindow,
- iNbAffiliation[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
@@ -476,10 +470,10 @@ void CCodeWindow::ToggleMemoryWindow(bool bShow)
if (bShow)
{
if (!m_MemoryWindow)
- m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
+ m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
Parent->DoAddPage(m_MemoryWindow,
- iNbAffiliation[IDM_MEMORYWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_MEMORYWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
@@ -494,10 +488,10 @@ void CCodeWindow::ToggleJitWindow(bool bShow)
if (bShow)
{
if (!m_JitWindow)
- m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
+ m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
Parent->DoAddPage(m_JitWindow,
- iNbAffiliation[IDM_JITWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_JITWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
@@ -513,10 +507,10 @@ void CCodeWindow::ToggleSoundWindow(bool bShow)
if (bShow)
{
if (!m_SoundWindow)
- m_SoundWindow = new DSPDebuggerLLE(Parent, IDM_SOUNDWINDOW);
+ m_SoundWindow = new DSPDebuggerLLE(Parent, IDM_SOUNDWINDOW);
Parent->DoAddPage(m_SoundWindow,
- iNbAffiliation[IDM_SOUNDWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_SOUNDWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
@@ -531,10 +525,10 @@ void CCodeWindow::ToggleVideoWindow(bool bShow)
if (bShow)
{
if (!m_VideoWindow)
- m_VideoWindow = new GFXDebuggerPanel(Parent, IDM_VIDEOWINDOW);
+ m_VideoWindow = new GFXDebuggerPanel(Parent, IDM_VIDEOWINDOW);
Parent->DoAddPage(m_VideoWindow,
- iNbAffiliation[IDM_VIDEOWINDOW - IDM_LOGWINDOW],
- Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW]);
+ iNbAffiliation[IDM_VIDEOWINDOW - IDM_LOGWINDOW],
+ Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW]);
}
else // Close
{
diff --git a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
index 48435c7..681209c 100644
--- a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
@@ -2,20 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include <iostream>
#include <fstream>
+#include <iostream>
#include <sstream>
-
#include <wx/artprov.h>
-#include "../WxUtils.h"
-#include "StringUtil.h"
-#include "DSPDebugWindow.h"
-#include "DSPRegisterView.h"
-#include "CodeView.h"
-#include "MemoryView.h"
-#include "HW/DSPLLE/DSPSymbols.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+#include "Core/HW/DSPLLE/DSPSymbols.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/CodeView.h"
+#include "DolphinWX/Debugger/DSPDebugWindow.h"
+#include "DolphinWX/Debugger/DSPRegisterView.h"
+#include "DolphinWX/Debugger/MemoryView.h"
DSPDebuggerLLE* m_DebuggerFrame = NULL;
@@ -203,7 +202,7 @@ void DSPDebuggerLLE::UpdateSymbolMap()
if (g_dsp.dram == NULL)
return;
- m_SymbolList->Freeze(); // HyperIris: wx style fast filling
+ m_SymbolList->Freeze(); // HyperIris: wx style fast filling
m_SymbolList->Clear();
for (const auto& symbol : DSPSymbols::g_dsp_symbol_db.Symbols())
{
diff --git a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.h b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.h
index 3f71321..e0bf61f 100644
--- a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.h
+++ b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.h
@@ -5,26 +5,25 @@
#pragma once
// general things
+#include <algorithm>
#include <iostream>
-#include <vector>
#include <list>
#include <map>
-#include <algorithm>
-
-#include <wx/wx.h>
-#include <wx/frame.h>
+#include <vector>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/statbox.h>
-#include <wx/sizer.h>
+#include <wx/frame.h>
#include <wx/listctrl.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
#include <wx/statline.h>
+#include <wx/stattext.h>
+#include <wx/wx.h>
#include <wx/aui/aui.h>
-#include "DSP/disassemble.h"
-#include "DSP/DSPInterpreter.h"
-#include "DSP/DSPMemoryMap.h"
-#include "HW/DSPLLE/DSPDebugInterface.h"
+#include "Core/DSP/disassemble.h"
+#include "Core/DSP/DSPInterpreter.h"
+#include "Core/DSP/DSPMemoryMap.h"
+#include "Core/HW/DSPLLE/DSPDebugInterface.h"
class DSPRegisterView;
class CCodeView;
diff --git a/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp b/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
index b3ad7dd..8adbb32 100644
--- a/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
+++ b/Source/Core/DolphinWX/Debugger/DSPRegisterView.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DSPDebugWindow.h"
-#include "DSPRegisterView.h"
-#include "../WxUtils.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/DSPDebugWindow.h"
+#include "DolphinWX/Debugger/DSPRegisterView.h"
wxString CDSPRegTable::GetValue(int row, int col)
{
diff --git a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp
index 3eb7d35..bc28c6c 100644
--- a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp
+++ b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp
@@ -2,16 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "IniFile.h"
-#include "DebuggerPanel.h"
-#include "FileUtil.h"
-#include "../../Core/ConfigManager.h"
-
-#include "VideoConfig.h"
-#include "TextureCacheBase.h"
-#include "PixelShaderGen.h"
-#include "VertexShaderGen.h"
-#include "NativeVertexFormat.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Core/ConfigManager.h"
+#include "DolphinWX/Debugger/DebuggerPanel.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VideoConfig.h"
BEGIN_EVENT_TABLE(GFXDebuggerPanel, wxPanel)
EVT_CLOSE(GFXDebuggerPanel::OnClose)
@@ -104,26 +103,26 @@ static PauseEventMap* pauseEventMap;
void GFXDebuggerPanel::CreateGUIControls()
{
static PauseEventMap map[] = {
- {NEXT_FRAME, _("Frame")},
- {NEXT_FLUSH, _("Flush")},
+ {NEXT_FRAME, _("Frame")},
+ {NEXT_FLUSH, _("Flush")},
- {NEXT_PIXEL_SHADER_CHANGE, _("Pixel Shader")},
- {NEXT_VERTEX_SHADER_CHANGE, _("Vertex Shader")},
- {NEXT_TEXTURE_CHANGE, _("Texture")},
- {NEXT_NEW_TEXTURE, _("New Texture")},
+ {NEXT_PIXEL_SHADER_CHANGE, _("Pixel Shader")},
+ {NEXT_VERTEX_SHADER_CHANGE, _("Vertex Shader")},
+ {NEXT_TEXTURE_CHANGE, _("Texture")},
+ {NEXT_NEW_TEXTURE, _("New Texture")},
- {NEXT_XFB_CMD, _("XFB Cmd")},
- {NEXT_EFB_CMD, _("EFB Cmd")},
+ {NEXT_XFB_CMD, _("XFB Cmd")},
+ {NEXT_EFB_CMD, _("EFB Cmd")},
- {NEXT_MATRIX_CMD, _("Matrix Cmd")},
- {NEXT_VERTEX_CMD, _("Vertex Cmd")},
- {NEXT_TEXTURE_CMD, _("Texture Cmd")},
- {NEXT_LIGHT_CMD, _("Light Cmd")},
- {NEXT_FOG_CMD, _("Fog Cmd")},
+ {NEXT_MATRIX_CMD, _("Matrix Cmd")},
+ {NEXT_VERTEX_CMD, _("Vertex Cmd")},
+ {NEXT_TEXTURE_CMD, _("Texture Cmd")},
+ {NEXT_LIGHT_CMD, _("Light Cmd")},
+ {NEXT_FOG_CMD, _("Fog Cmd")},
- {NEXT_SET_TLUT, _("TLUT Cmd")},
+ {NEXT_SET_TLUT, _("TLUT Cmd")},
- {NEXT_ERROR, _("Error")}
+ {NEXT_ERROR, _("Error")}
};
pauseEventMap = map;
const int numPauseEventMap = sizeof(map)/sizeof(PauseEventMap);
diff --git a/Source/Core/DolphinWX/Debugger/DebuggerPanel.h b/Source/Core/DolphinWX/Debugger/DebuggerPanel.h
index 3d9e65e..cdf5144 100644
--- a/Source/Core/DolphinWX/Debugger/DebuggerPanel.h
+++ b/Source/Core/DolphinWX/Debugger/DebuggerPanel.h
@@ -4,9 +4,10 @@
#pragma once
-#include <wx/wx.h>
#include <wx/notebook.h>
-#include "Debugger.h"
+#include <wx/wx.h>
+
+#include "VideoCommon/Debugger.h"
class GFXDebuggerPanel : public wxPanel, public GFXDebuggerBase
{
@@ -37,21 +38,21 @@ public:
private:
DECLARE_EVENT_TABLE();
- wxPanel *m_MainPanel;
-
- wxButton *m_pButtonPause;
- wxButton *m_pButtonPauseAtNext;
- wxButton *m_pButtonPauseAtNextFrame;
- wxButton *m_pButtonCont;
- wxChoice *m_pPauseAtList;
- wxButton *m_pButtonDump;
- wxChoice *m_pDumpList;
- wxButton *m_pButtonUpdateScreen;
- wxButton *m_pButtonClearScreen;
- wxButton *m_pButtonClearTextureCache;
- wxButton *m_pButtonClearVertexShaderCache;
- wxButton *m_pButtonClearPixelShaderCache;
- wxTextCtrl *m_pCount;
+ wxPanel* m_MainPanel;
+
+ wxButton* m_pButtonPause;
+ wxButton* m_pButtonPauseAtNext;
+ wxButton* m_pButtonPauseAtNextFrame;
+ wxButton* m_pButtonCont;
+ wxChoice* m_pPauseAtList;
+ wxButton* m_pButtonDump;
+ wxChoice* m_pDumpList;
+ wxButton* m_pButtonUpdateScreen;
+ wxButton* m_pButtonClearScreen;
+ wxButton* m_pButtonClearTextureCache;
+ wxButton* m_pButtonClearVertexShaderCache;
+ wxButton* m_pButtonClearPixelShaderCache;
+ wxTextCtrl* m_pCount;
// TODO: Prefix with GFX_
diff --git a/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp b/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp
index db14859..406d239 100644
--- a/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp
+++ b/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp
@@ -3,7 +3,7 @@
// Refer to the license.txt file included.
-#include "DebuggerUIUtil.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
// The default font
wxFont DebuggerFont = wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("monospace"));
diff --git a/Source/Core/DolphinWX/Debugger/JitWindow.cpp b/Source/Core/DolphinWX/Debugger/JitWindow.cpp
index b323f79..5e3511b 100644
--- a/Source/Core/DolphinWX/Debugger/JitWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/JitWindow.cpp
@@ -2,30 +2,26 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <disasm.h> // Bochs
+#include <PowerPCDisasm.h> // Bochs
#include <wx/button.h>
-#include <wx/textctrl.h>
#include <wx/listctrl.h>
+#include <wx/textctrl.h>
#include <wx/thread.h>
-#include <wx/listctrl.h>
-
-#include "JitWindow.h"
-#include "HW/CPU.h"
-#include "PowerPC/PowerPC.h"
-#include "PowerPC/JitCommon/JitBase.h"
-#include "PowerPC/JitCommon/JitCache.h"
-#include "PowerPC/PPCAnalyst.h"
-#include "PowerPCDisasm.h"
-#include "disasm.h"
-
-#include "Debugger/PPCDebugInterface.h"
-#include "Debugger/Debugger_SymbolMap.h"
-
-#include "Core.h"
-#include "StringUtil.h"
-#include "LogManager.h"
-#include "../WxUtils.h"
-#include "../Globals.h"
+#include "Common/LogManager.h"
+#include "Common/StringUtil.h"
+#include "Core/Core.h"
+#include "Core/Debugger/Debugger_SymbolMap.h"
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCAnalyst.h"
+#include "Core/PowerPC/JitCommon/JitBase.h"
+#include "Core/PowerPC/JitCommon/JitCache.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/JitWindow.h"
enum
{
@@ -59,11 +55,11 @@ CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING),
0, wxEXPAND);
sizerBig->Add(sizerSplit, 2, wxEXPAND);
-// sizerBig->Add(memview, 5, wxEXPAND);
-// sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
+ // sizerBig->Add(memview, 5, wxEXPAND);
+ // sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
sizerBig->Add(button_refresh = new wxButton(this, IDM_REFRESH_LIST, _("&Refresh")));
-// sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
-// sizerRight->Add(new wxButton(this, IDM_SETPC, _("S&et PC")));
+ // sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
+ // sizerRight->Add(new wxButton(this, IDM_SETPC, _("S&et PC")));
SetSizer(sizerBig);
diff --git a/Source/Core/DolphinWX/Debugger/JitWindow.h b/Source/Core/DolphinWX/Debugger/JitWindow.h
index e91f7d7..6eb0869 100644
--- a/Source/Core/DolphinWX/Debugger/JitWindow.h
+++ b/Source/Core/DolphinWX/Debugger/JitWindow.h
@@ -7,13 +7,13 @@
#include <vector>
#include <wx/dialog.h>
-#include <wx/textctrl.h>
-#include <wx/listctrl.h>
#include <wx/listbox.h>
+#include <wx/listctrl.h>
+#include <wx/textctrl.h>
-#include "MemoryView.h"
-#include "Thread.h"
-#include "CoreParameter.h"
+#include "Common/Thread.h"
+#include "Core/CoreParameter.h"
+#include "DolphinWX/Debugger/MemoryView.h"
class JitBlockList : public wxListCtrl
{
diff --git a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp
index 821ca30..f8ed8ba 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp
+++ b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../WxUtils.h"
-#include "MemoryCheckDlg.h"
-#include "Common.h"
-#include "StringUtil.h"
-#include "PowerPC/PowerPC.h"
-#include "BreakpointWindow.h"
+#include "Common/Common.h"
+#include "Common/StringUtil.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/BreakpointWindow.h"
+#include "DolphinWX/Debugger/MemoryCheckDlg.h"
#define TEXT_BOX(text) new wxStaticText(this, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize)
diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Debugger/MemoryView.cpp
index 56a5c4c..832c13c 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryView.cpp
+++ b/Source/Core/DolphinWX/Debugger/MemoryView.cpp
@@ -2,17 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DebuggerUIUtil.h"
-#include "Common.h"
-#include "Host.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/Memmap.h"
-
-#include "MemoryView.h"
-#include "../WxUtils.h"
-
-#include <wx/event.h>
#include <wx/clipbrd.h>
+#include <wx/event.h>
+
+#include "Common/Common.h"
+#include "Core/Host.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
+#include "DolphinWX/Debugger/MemoryView.h"
enum
{
diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.h b/Source/Core/DolphinWX/Debugger/MemoryView.h
index 327efc6..b018669 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryView.h
+++ b/Source/Core/DolphinWX/Debugger/MemoryView.h
@@ -4,9 +4,9 @@
#pragma once
-#include "DebuggerUIUtil.h"
-#include "Common.h"
-#include "DebugInterface.h"
+#include "Common/Common.h"
+#include "Common/DebugInterface.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
class CMemoryView : public wxControl
{
@@ -27,8 +27,8 @@ public:
curAddress = addr;
Refresh();
}
- int dataType; // u8,u16,u32
- int curAddress; // Will be accessed by parent
+ int dataType; // u8,u16,u32
+ int curAddress; // Will be accessed by parent
private:
int YToAddress(int y);
diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
index e49512a..516ab41 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
@@ -3,28 +3,23 @@
// Refer to the license.txt file included.
#include <wx/button.h>
-#include <wx/textctrl.h>
#include <wx/listctrl.h>
+#include <wx/textctrl.h>
#include <wx/thread.h>
-#include <wx/listctrl.h>
-
-#include "../WxUtils.h"
-#include "MemoryWindow.h"
-#include "HW/CPU.h"
-#include "PowerPC/PowerPC.h"
-#include "FileUtil.h"
-
-#include "Debugger/PPCDebugInterface.h"
-#include "PowerPC/PPCSymbolDB.h"
-
-#include "Core.h"
-#include "ConfigManager.h"
-#include "LogManager.h"
-
-#include "HW/Memmap.h"
-#include "HW/DSP.h"
-#include "../../DolphinWX/Globals.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Debugger/PPCDebugInterface.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DSP.h"
+#include "Core/HW/Memmap.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "Core/PowerPC/PPCSymbolDB.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/MemoryWindow.h"
enum
{
@@ -44,19 +39,19 @@ enum
};
BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel)
- EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
- EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange)
- EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage)
- EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue)
- EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory)
- EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2)
- EVT_BUTTON(IDM_DUMP_FAKEVMEM, CMemoryWindow::OnDumpFakeVMEM)
- EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8)
- EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16)
- EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32)
- EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch)
- EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii)
- EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex)
+ EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
+ EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange)
+ EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage)
+ EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue)
+ EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory)
+ EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2)
+ EVT_BUTTON(IDM_DUMP_FAKEVMEM, CMemoryWindow::OnDumpFakeVMEM)
+ EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8)
+ EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16)
+ EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32)
+ EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch)
+ EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii)
+ EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex)
END_EVENT_TABLE()
CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
@@ -71,7 +66,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
DebugInterface* di = &PowerPC::debug_interface;
//symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition,
- // wxSize(20, 100), 0, NULL, wxLB_SORT);
+ // wxSize(20, 100), 0, NULL, wxLB_SORT);
//sizerLeft->Add(symbols, 1, wxEXPAND);
memview = new CMemoryView(di, this);
memview->dataType = 0;
diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.h b/Source/Core/DolphinWX/Debugger/MemoryWindow.h
index 9cd7439..19fbe1c 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryWindow.h
+++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.h
@@ -5,13 +5,13 @@
#pragma once
#include <wx/dialog.h>
-#include <wx/textctrl.h>
#include <wx/listbox.h>
-#include "MemoryView.h"
-#include "Thread.h"
-#include "StringUtil.h"
+#include <wx/textctrl.h>
-#include "CoreParameter.h"
+#include "Common/StringUtil.h"
+#include "Common/Thread.h"
+#include "Core/CoreParameter.h"
+#include "DolphinWX/Debugger/MemoryView.h"
class CRegisterWindow;
class CBreakPointWindow;
diff --git a/Source/Core/DolphinWX/Debugger/RegisterView.cpp b/Source/Core/DolphinWX/Debugger/RegisterView.cpp
index d059a90..b2045c8 100644
--- a/Source/Core/DolphinWX/Debugger/RegisterView.cpp
+++ b/Source/Core/DolphinWX/Debugger/RegisterView.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DebuggerUIUtil.h"
-#include "RegisterView.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/ProcessorInterface.h"
-#include "IniFile.h"
-#include "../WxUtils.h"
+#include "Common/IniFile.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
+#include "DolphinWX/Debugger/RegisterView.h"
// F-zero 80005e60 wtf??
@@ -57,7 +57,7 @@ wxString CRegTable::GetValue(int row, int col)
{
switch (col)
{
- case 0: return StrToWxStr(special_reg_names[row - 32]);
+ case 0: return StrToWxStr(special_reg_names[row - 32]);
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
default: return wxEmptyString;
}
@@ -79,9 +79,9 @@ static void SetSpecialRegValue(int reg, u32 value)
case 6: PowerPC::ppcState.spr[SPR_SRR0] = value; break;
case 7: PowerPC::ppcState.spr[SPR_SRR1] = value; break;
case 8: PowerPC::ppcState.Exceptions = value; break;
-// Should we just change the value, or use ProcessorInterface::SetInterrupt() to make the system aware?
-// case 9: return ProcessorInterface::GetMask();
-// case 10: return ProcessorInterface::GetCause();
+ // Should we just change the value, or use ProcessorInterface::SetInterrupt() to make the system aware?
+ // case 9: return ProcessorInterface::GetMask();
+ // case 10: return ProcessorInterface::GetCause();
default: return;
}
}
diff --git a/Source/Core/DolphinWX/Debugger/RegisterView.h b/Source/Core/DolphinWX/Debugger/RegisterView.h
index 9cb046b..6bcd46a 100644
--- a/Source/Core/DolphinWX/Debugger/RegisterView.h
+++ b/Source/Core/DolphinWX/Debugger/RegisterView.h
@@ -6,7 +6,7 @@
#include <wx/grid.h>
-#include "Common.h"
+#include "Common/Common.h"
// New register view:
// R0 0x8000000 F0 0.0000 F0_PS1 0.0000
diff --git a/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp b/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp
index c8cb9d1..c18d207 100644
--- a/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/RegisterWindow.cpp
@@ -4,9 +4,9 @@
#include <wx/wx.h>
-#include "RegisterWindow.h"
-#include "PowerPC/PowerPC.h"
-#include "RegisterView.h"
+#include "Core/PowerPC/PowerPC.h"
+#include "DolphinWX/Debugger/RegisterView.h"
+#include "DolphinWX/Debugger/RegisterWindow.h"
extern const char* GetGRPName(unsigned int index);
diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/FifoPlayerDlg.cpp
index 5e3c7b0..5a8a39b 100644
--- a/Source/Core/DolphinWX/FifoPlayerDlg.cpp
+++ b/Source/Core/DolphinWX/FifoPlayerDlg.cpp
@@ -2,20 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "FifoPlayerDlg.h"
-#include "FileUtil.h"
-#include "Thread.h"
-#include "FifoPlayer/FifoPlayer.h"
-#include "FifoPlayer/FifoRecorder.h"
-#include "OpcodeDecoding.h"
-#include "WxUtils.h"
-
-#include <wx/spinctrl.h>
-#include <wx/clipbrd.h>
-
#include <algorithm>
#include <vector>
+#include <wx/clipbrd.h>
+#include <wx/spinctrl.h>
+
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/Thread.h"
+#include "Core/FifoPlayer/FifoPlayer.h"
+#include "Core/FifoPlayer/FifoRecorder.h"
+#include "DolphinWX/FifoPlayerDlg.h"
+#include "DolphinWX/WxUtils.h"
+#include "VideoCommon/OpcodeDecoding.h"
DECLARE_EVENT_TYPE(RECORDING_FINISHED_EVENT, -1)
DEFINE_EVENT_TYPE(RECORDING_FINISHED_EVENT)
@@ -845,12 +844,12 @@ void FifoPlayerDlg::UpdateAnalyzerGui()
FifoPlayer &player = FifoPlayer::GetInstance();
FifoDataFile* file = player.GetFile();
- int num_frames = (file) ? player.GetFile()->GetFrameCount() : 0;
- if ((int)m_framesList->GetCount() != num_frames)
+ size_t num_frames = (file) ? player.GetFile()->GetFrameCount() : 0U;
+ if (m_framesList->GetCount() != num_frames)
{
m_framesList->Clear();
- for (int i = 0; i < num_frames; ++i)
+ for (size_t i = 0; i < num_frames; ++i)
{
m_framesList->Append(wxString::Format(wxT("Frame %i"), i));
}
@@ -897,8 +896,8 @@ wxString FifoPlayerDlg::CreateRecordingFifoSizeLabel() const
if (file)
{
- int fifoBytes = 0;
- for (int i = 0; i < file->GetFrameCount(); ++i)
+ size_t fifoBytes = 0;
+ for (size_t i = 0; i < file->GetFrameCount(); ++i)
fifoBytes += file->GetFrame(i).fifoDataSize;
return CreateIntegerLabel(fifoBytes, _("FIFO Byte"));
@@ -913,8 +912,8 @@ wxString FifoPlayerDlg::CreateRecordingMemSizeLabel() const
if (file)
{
- int memBytes = 0;
- for (int frameNum = 0; frameNum < file->GetFrameCount(); ++frameNum)
+ size_t memBytes = 0;
+ for (size_t frameNum = 0; frameNum < file->GetFrameCount(); ++frameNum)
{
const vector<MemoryUpdate>& memUpdates = file->GetFrame(frameNum).memoryUpdates;
for (auto& memUpdate : memUpdates)
@@ -933,20 +932,20 @@ wxString FifoPlayerDlg::CreateRecordingFrameCountLabel() const
if (file)
{
- int numFrames = file->GetFrameCount();
+ size_t numFrames = file->GetFrameCount();
return CreateIntegerLabel(numFrames, _("Frame"));
}
return wxEmptyString;
}
-wxString FifoPlayerDlg::CreateIntegerLabel(int size, const wxString& label) const
+wxString FifoPlayerDlg::CreateIntegerLabel(size_t size, const wxString& label) const
{
wxString postfix;
if (size != 1)
postfix = _("s");
- return wxString::Format(wxT("%i"), size) + wxT(" ") + label + postfix;
+ return wxString::Format(wxT("%u"), size) + wxT(" ") + label + postfix;
}
bool FifoPlayerDlg::GetSaveButtonEnabled() const
diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.h b/Source/Core/DolphinWX/FifoPlayerDlg.h
index 774991b..4e72878 100644
--- a/Source/Core/DolphinWX/FifoPlayerDlg.h
+++ b/Source/Core/DolphinWX/FifoPlayerDlg.h
@@ -5,8 +5,8 @@
#pragma once
#include <vector>
-#include <wx/wx.h>
#include <wx/notebook.h>
+#include <wx/wx.h>
class wxSpinCtrl;
class wxSpinEvent;
@@ -56,7 +56,7 @@ private:
wxString CreateRecordingFifoSizeLabel() const;
wxString CreateRecordingMemSizeLabel() const;
wxString CreateRecordingFrameCountLabel() const;
- wxString CreateIntegerLabel(int size, const wxString& label) const;
+ wxString CreateIntegerLabel(size_t size, const wxString& label) const;
bool GetSaveButtonEnabled() const;
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 2bb4afd..2a17f6c 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -10,41 +10,42 @@
// m_Panel. The new child window handle that is returned by CreateWindow() can
// be accessed from Core::GetWindowHandle().
-#include "Common.h" // Common
-#include "FileUtil.h"
-#include "Timer.h"
-
-#include "Globals.h" // Local
-#include "Frame.h"
-#include "ConfigMain.h"
-#include "CheatsWindow.h"
-#include "GameListCtrl.h"
-#include "BootManager.h"
-#include "ConsoleListener.h"
-
-#include "ConfigManager.h" // Core
-#include "Core.h"
-#include "HW/DVDInterface.h"
-#include "HW/GCPad.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
-#include "State.h"
-#include "VolumeHandler.h"
-#include "Movie.h"
-#include "RenderBase.h"
-#include "VideoConfig.h"
-#include "VertexShaderManager.h"
-
-#include "VideoBackendBase.h"
-
-#include <wx/datetime.h> // wxWidgets
+#ifdef __APPLE__
+#include <Cocoa/Cocoa.h>
+#endif
+#include <wx/datetime.h>
+
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/Timer.h"
+
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+#include "Core/State.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/GCPad.h"
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+
+#include "DolphinWX/CheatsWindow.h"
+#include "DolphinWX/ConfigMain.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/GameListCtrl.h"
+#include "DolphinWX/Globals.h"
+
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoBackendBase.h"
+#include "VideoCommon/VideoConfig.h"
// Resources
extern "C" {
-#include "resources/Dolphin.c" // Dolphin icon
+#include "DolphinWX/resources/Dolphin.c" // NOLINT: Dolphin icon
};
-
#ifdef _WIN32
// I could not use FindItemByHWND() instead of this, it crashed on that occasion I used it */
HWND MSWGetParent_(HWND Parent)
@@ -101,7 +102,7 @@ CPanel::CPanel(
#endif
CRenderFrame::CRenderFrame(wxFrame* parent, wxWindowID id, const wxString& title,
- const wxPoint& pos, const wxSize& size, long style)
+ const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
{
// Give it an icon
@@ -281,11 +282,8 @@ CFrame::CFrame(wxFrame* parent,
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
bFloatWindow[i] = false;
- if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
-
- // Give it a console early to show potential messages from this onward
- ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
- if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
+ if (ShowLogWindow)
+ SConfig::GetInstance().m_InterfaceLogWindow = true;
// Start debugging maximized
if (UseDebugger) this->Maximize(true);
@@ -363,8 +361,6 @@ CFrame::CFrame(wxFrame* parent,
ToggleLogWindow(true);
if (SConfig::GetInstance().m_InterfaceLogConfigWindow)
ToggleLogConfigWindow(true);
- if (SConfig::GetInstance().m_InterfaceConsole)
- ToggleConsole(true);
}
// Show window
@@ -652,7 +648,6 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height)
// Add space for the log/console/debugger window
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
(SConfig::GetInstance().m_InterfaceLogWindow ||
- SConfig::GetInstance().m_InterfaceConsole ||
SConfig::GetInstance().m_InterfaceLogConfigWindow) &&
!m_Mgr->GetPane(wxT("Pane 1")).IsFloating())
{
@@ -714,12 +709,12 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
SConfig::GetInstance().m_ListTaiwan &&
SConfig::GetInstance().m_ListUnknown)))
{
- SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
- SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListJap =
- SConfig::GetInstance().m_ListUsa = SConfig::GetInstance().m_ListPal =
- SConfig::GetInstance().m_ListFrance = SConfig::GetInstance().m_ListItaly =
- SConfig::GetInstance().m_ListKorea = SConfig::GetInstance().m_ListTaiwan =
- SConfig::GetInstance().m_ListUnknown= true;
+ SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
+ SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListJap =
+ SConfig::GetInstance().m_ListUsa = SConfig::GetInstance().m_ListPal =
+ SConfig::GetInstance().m_ListFrance = SConfig::GetInstance().m_ListItaly =
+ SConfig::GetInstance().m_ListKorea = SConfig::GetInstance().m_ListTaiwan =
+ SConfig::GetInstance().m_ListUnknown = true;
GetMenuBar()->FindItem(IDM_LISTGC)->Check(true);
GetMenuBar()->FindItem(IDM_LISTWII)->Check(true);
diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h
index 0f54002..6894f9d 100644
--- a/Source/Core/DolphinWX/Frame.h
+++ b/Source/Core/DolphinWX/Frame.h
@@ -4,28 +4,26 @@
#pragma once
-#include <wx/wx.h> // wxWidgets
+#include <string>
+#include <vector>
+#include <wx/artprov.h>
#include <wx/busyinfo.h>
-#include <wx/mstream.h>
#include <wx/listctrl.h>
-#include <wx/artprov.h>
-#include <wx/aui/aui.h>
+#include <wx/mstream.h>
#include <wx/tooltip.h>
-#include <string>
-#include <vector>
+#include <wx/wx.h>
+#include <wx/aui/aui.h>
-#ifdef __APPLE__
-#include <Cocoa/Cocoa.h>
-#endif
+#include "Common/CDUtils.h"
+#include "Core/Movie.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/LogConfigWindow.h"
+#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/TASInputDlg.h"
+#include "DolphinWX/Debugger/CodeWindow.h"
-#include "CDUtils.h"
-#include "Debugger/CodeWindow.h"
-#include "LogWindow.h"
-#include "LogConfigWindow.h"
-#include "TASInputDlg.h"
-#include "Movie.h"
#if defined(HAVE_X11) && HAVE_X11
-#include "X11Utils.h"
+#include "DolphinWX/X11Utils.h"
#endif
// A shortcut to access the bitmaps
@@ -121,7 +119,6 @@ public:
void UpdateGameList();
void ToggleLogWindow(bool bShow);
void ToggleLogConfigWindow(bool bShow);
- void ToggleConsole(bool bShow);
void PostEvent(wxCommandEvent& event);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
@@ -232,7 +229,6 @@ private:
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);
void ToggleNotebookStyle(bool On, long Style);
- void ResizeConsole();
// Float window
void DoUnfloatPage(int Id);
void OnFloatingPageClosed(wxCloseEvent& event);
diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp
index 06778f6..ccba858 100644
--- a/Source/Core/DolphinWX/FrameAui.cpp
+++ b/Source/Core/DolphinWX/FrameAui.cpp
@@ -2,15 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h" // Common
-#include "ConsoleListener.h"
-
-#include "Globals.h" // Local
-#include "Frame.h"
-#include "LogWindow.h"
-#include "WxUtils.h"
-
-#include "ConfigManager.h" // Core
+#include "Common/Common.h"
+#include "Core/ConfigManager.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/WxUtils.h"
// ------------
// Aui events
@@ -26,7 +23,6 @@ void CFrame::OnManagerResize(wxAuiManagerEvent& event)
m_LogWindow->winpos = m_Mgr->GetPane(_T("Pane 1")).dock_direction;
}
event.Skip();
- ResizeConsole();
}
void CFrame::OnPaneClose(wxAuiManagerEvent& event)
@@ -39,14 +35,10 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
if (!g_pCodeWindow)
{
if (nb->GetPage(0)->GetId() == IDM_LOGWINDOW ||
- nb->GetPage(0)->GetId() == IDM_LOGCONFIGWINDOW ||
- nb->GetPage(0)->GetId() == IDM_CONSOLEWINDOW)
+ nb->GetPage(0)->GetId() == IDM_LOGCONFIGWINDOW)
{
- // Closing a pane containing the logwindow or a console closes both
- SConfig::GetInstance().m_InterfaceConsole = false;
SConfig::GetInstance().m_InterfaceLogWindow = false;
SConfig::GetInstance().m_InterfaceLogConfigWindow = false;
- ToggleConsole(false);
ToggleLogWindow(false);
ToggleLogConfigWindow(false);
}
@@ -132,59 +124,6 @@ void CFrame::ToggleLogConfigWindow(bool bShow)
TogglePane();
}
-void CFrame::ToggleConsole(bool bShow)
-{
-#ifdef _WIN32
- GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(bShow);
-
- if (bShow)
- {
- // If the console doesn't exist, we create it
- if (!GetConsoleWindow())
- {
- ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
- Console->Open();
- }
- else
- {
- ShowWindow(GetConsoleWindow(), SW_SHOW);
- }
-
- // Create the parent window if it doesn't exist
- wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
- if (!ConsoleParent) ConsoleParent = new wxPanel(this, IDM_CONSOLEWINDOW,
- wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Console"));
-
- wxWindow *ConsoleWin = new wxWindow();
- ConsoleWin->SetHWND((WXHWND)GetConsoleWindow());
- ConsoleWin->AdoptAttributesFromHWND();
- ConsoleWin->Reparent(ConsoleParent);
-
- ConsoleParent->Enable();
- const int nbIndex = IDM_CONSOLEWINDOW - IDM_LOGWINDOW;
- DoAddPage(ConsoleParent,
- g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0,
- g_pCodeWindow ? bFloatWindow[nbIndex] : false);
- }
- else // Hide
- {
- if(GetConsoleWindow())
- ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32
-
- wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
- if (ConsoleParent)
- ConsoleParent->Disable();
-
- // Then close the page
- DoRemovePage(ConsoleParent, true);
- }
-
- // Hide or Show the pane
- if (!g_pCodeWindow)
- TogglePane();
-#endif
-}
-
void CFrame::OnToggleWindow(wxCommandEvent& event)
{
bool bShow = GetMenuBar()->IsChecked(event.GetId());
@@ -201,11 +140,6 @@ void CFrame::OnToggleWindow(wxCommandEvent& event)
SConfig::GetInstance().m_InterfaceLogConfigWindow = bShow;
ToggleLogConfigWindow(bShow);
break;
- case IDM_CONSOLEWINDOW:
- if (!g_pCodeWindow)
- SConfig::GetInstance().m_InterfaceConsole = bShow;
- ToggleConsole(bShow);
- break;
case IDM_REGISTERWINDOW:
g_pCodeWindow->ToggleRegisterWindow(bShow);
break;
@@ -233,7 +167,7 @@ void CFrame::ClosePages()
{
ToggleLogWindow(false);
ToggleLogConfigWindow(false);
- ToggleConsole(false);
+
if (g_pCodeWindow)
{
g_pCodeWindow->ToggleCodeWindow(false);
@@ -275,8 +209,6 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
ToggleLogWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_LOGCONFIGWINDOW)
ToggleLogConfigWindow(false);
- if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_CONSOLEWINDOW)
- ToggleConsole(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW)
g_pCodeWindow->ToggleRegisterWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW)
@@ -299,7 +231,6 @@ void CFrame::OnFloatingPageClosed(wxCloseEvent& event)
void CFrame::OnFloatingPageSize(wxSizeEvent& event)
{
event.Skip();
- ResizeConsole();
}
void CFrame::OnFloatWindow(wxCommandEvent& event)
@@ -392,7 +323,6 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{
event.Skip();
event.Allow();
- ResizeConsole();
}
void CFrame::ShowResizePane()
@@ -772,33 +702,6 @@ void CFrame::OnSelectPerspective(wxCommandEvent& event)
DoLoadPerspective();
}
-void CFrame::ResizeConsole()
-{
-#ifdef _WIN32
- // Get the console parent window
- wxWindow * Win = FindWindowById(IDM_CONSOLEWINDOW);
- if (!Win) return;
-
- const int wxBorder = 2, Border = 4,
- MenuBar = 30, ScrollBar = 19;
-
- // Get the client size
- int X = Win->GetSize().GetX();
- int Y = Win->GetSize().GetY();
- int InternalWidth = X - wxBorder*2 - ScrollBar;
- int InternalHeight = Y - wxBorder*2;
- int WindowWidth = InternalWidth + Border*2 +
- /*max out the width in the word wrap mode*/ 100;
- int WindowHeight = InternalHeight + MenuBar;
- // Resize buffer
- ConsoleListener* Console = LogManager::GetInstance()->GetConsoleListener();
- Console->PixelSpace(0,0, InternalWidth, InternalHeight, false);
- // Move the window to hide the border
- MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder,
- WindowWidth + 100, WindowHeight, true);
-#endif
-}
-
static int Limit(int i, int Low, int High)
{
if (i < Low) return Low;
@@ -1063,11 +966,6 @@ wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title,
Frame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnFloatingPageClosed, this);
- if (Id == IDM_CONSOLEWINDOW_PARENT)
- {
- Frame->Bind(wxEVT_SIZE, &CFrame::OnFloatingPageSize, this);
- }
-
// Main sizer
Frame->SetSizer(m_MainSizer);
// Minimum frame size
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 09cf2a0..ebb345c 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -14,52 +14,54 @@ window handle that is returned by CreateWindow() can be accessed from
Core::GetWindowHandle().
*/
-#include "NetWindow.h"
-#include "Common.h" // Common
-#include "FileUtil.h"
-#include "FileSearch.h"
-#include "Timer.h"
-#include "VideoBackendBase.h"
+#include <wx/datetime.h>
#ifdef __APPLE__
#include <AppKit/AppKit.h>
#endif
-#include "Globals.h" // Local
-#include "Frame.h"
-#include "ConfigMain.h"
-#include "MemcardManager.h"
-#include "CheatsWindow.h"
-#include "AboutDolphin.h"
-#include "GameListCtrl.h"
-#include "BootManager.h"
-#include "LogWindow.h"
-#include "LogConfigWindow.h"
-#include "FifoPlayerDlg.h"
-#include "WxUtils.h"
-#include "Host.h"
-
-#include "ConfigManager.h" // Core
-#include "Core.h"
-#include "Movie.h"
-#include "HW/CPU.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/DVDInterface.h"
-#include "HW/ProcessorInterface.h"
-#include "HW/GCPad.h"
-#include "HW/Wiimote.h"
-#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Common/Common.h"
+#include "Common/FileSearch.h"
+#include "Common/FileUtil.h"
+#include "Common/Timer.h"
+
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/Movie.h"
+#include "Core/State.h"
+#include "Core/VolumeHandler.h"
+#include "Core/HW/CPU.h"
+#include "Core/HW/DVDInterface.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/Wiimote.h"
//#include "IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
-#include "State.h"
-#include "VolumeHandler.h"
-#include "NANDContentLoader.h"
-#include "WXInputBase.h"
-#include "WiimoteConfigDiag.h"
-#include "InputConfigDiag.h"
-#include "HotkeyDlg.h"
-#include "TASInputDlg.h"
-
-#include <wx/datetime.h> // wxWidgets
+#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "DiscIO/NANDContentLoader.h"
+
+#include "DolphinWX/AboutDolphin.h"
+#include "DolphinWX/CheatsWindow.h"
+#include "DolphinWX/ConfigMain.h"
+#include "DolphinWX/FifoPlayerDlg.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/GameListCtrl.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/HotkeyDlg.h"
+#include "DolphinWX/InputConfigDiag.h"
+#include "DolphinWX/LogConfigWindow.h"
+#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/MemcardManager.h"
+#include "DolphinWX/NetWindow.h"
+#include "DolphinWX/TASInputDlg.h"
+#include "DolphinWX/WiimoteConfigDiag.h"
+#include "DolphinWX/WXInputBase.h"
+#include "DolphinWX/WxUtils.h"
+
+#include "VideoCommon/VideoBackendBase.h"
#ifdef _WIN32
#ifndef SM_XVIRTUALSCREEN
@@ -78,7 +80,7 @@ Core::GetWindowHandle().
// Resources
extern "C" {
-#include "resources/Dolphin.c" // Dolphin icon
+#include "DolphinWX/resources/Dolphin.c" // NOLINT: Dolphin icon
};
bool confirmStop = false;
@@ -218,17 +220,11 @@ void CFrame::CreateMenu()
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _("Show &Log"));
viewMenu->AppendCheckItem(IDM_LOGCONFIGWINDOW, _("Show Log &Configuration"));
- viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _("Show &Console"));
viewMenu->AppendSeparator();
-#ifndef _WIN32
- viewMenu->Enable(IDM_CONSOLEWINDOW, false);
-#endif
-
if (g_pCodeWindow)
{
viewMenu->Check(IDM_LOGWINDOW, g_pCodeWindow->bShowOnStart[0]);
- viewMenu->Check(IDM_CONSOLEWINDOW, g_pCodeWindow->bShowOnStart[1]);
const wxString MenuText[] = {
wxTRANSLATE("&Registers"),
@@ -251,7 +247,6 @@ void CFrame::CreateMenu()
{
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
viewMenu->Check(IDM_LOGCONFIGWINDOW, SConfig::GetInstance().m_InterfaceLogConfigWindow);
- viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
}
wxMenu *platformMenu = new wxMenu;
@@ -482,8 +477,8 @@ void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
ToolBar->SetToolBitmapSize(wxSize(w, h));
- ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, _("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Save current perspective"));
- ToolBar->AddTool(IDM_EDIT_PERSPECTIVES, _("Edit"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Edit current perspective"));
+ ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, _("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Save current perspective"));
+ ToolBar->AddTool(IDM_EDIT_PERSPECTIVES, _("Edit"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Edit current perspective"));
ToolBar->SetToolDropDown(IDM_SAVE_PERSPECTIVE, true);
ToolBar->SetToolDropDown(IDM_EDIT_PERSPECTIVES, true);
@@ -581,7 +576,7 @@ void CFrame::BootGame(const std::string& filename)
bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName();
}
else if (!StartUp.m_strDefaultGCM.empty()
- && wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str())))
+ && wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str())))
{
bootfile = StartUp.m_strDefaultGCM;
}
@@ -1192,7 +1187,7 @@ void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
{
InputPlugin *const pad_plugin = Pad::GetPlugin();
bool was_init = false;
- if (g_controller_interface.IsInit()) // check if game is running
+ if (g_controller_interface.IsInit()) // check if game is running
{
was_init = true;
}
@@ -1210,7 +1205,7 @@ void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"));
m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
- if (!was_init) // if game isn't running
+ if (!was_init) // if game isn't running
{
Pad::Shutdown();
}
@@ -1220,7 +1215,7 @@ void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
{
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
bool was_init = false;
- if (g_controller_interface.IsInit()) // check if game is running
+ if (g_controller_interface.IsInit()) // check if game is running
{
was_init = true;
}
@@ -1238,7 +1233,7 @@ void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
WiimoteConfigDiag m_ConfigFrame(this, *wiimote_plugin);
m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
- if (!was_init) // if game isn't running
+ if (!was_init) // if game isn't running
{
Wiimote::Shutdown();
}
diff --git a/Source/Core/DolphinWX/GLInterface/AGL.cpp b/Source/Core/DolphinWX/GLInterface/AGL.cpp
index ffe3b68..b8e157d 100644
--- a/Source/Core/DolphinWX/GLInterface/AGL.cpp
+++ b/Source/Core/DolphinWX/GLInterface/AGL.cpp
@@ -2,16 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoConfig.h"
-#include "Host.h"
-#include "RenderBase.h"
-#include "ConfigManager.h"
-
#include <wx/panel.h>
-#include "VertexShaderManager.h"
-#include "GLInterface.h"
-#include "AGL.h"
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+
+#include "DolphinWX/GLInterface/AGL.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
void cInterfaceAGL::Swap()
{
@@ -19,7 +19,7 @@ void cInterfaceAGL::Swap()
}
// Create rendering window.
-// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
+// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceAGL::Create(void *&window_handle)
{
int _tx, _ty, _twidth, _theight;
diff --git a/Source/Core/DolphinWX/GLInterface/AGL.h b/Source/Core/DolphinWX/GLInterface/AGL.h
index 1554f71..8f75df5 100644
--- a/Source/Core/DolphinWX/GLInterface/AGL.h
+++ b/Source/Core/DolphinWX/GLInterface/AGL.h
@@ -8,7 +8,7 @@
#import <AppKit/AppKit.h>
#endif
-#include "InterfaceBase.h"
+#include "DolphinWX/GLInterface/InterfaceBase.h"
class cInterfaceAGL : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/EGL.cpp b/Source/Core/DolphinWX/GLInterface/EGL.cpp
index 3b3779d..1e75df1 100644
--- a/Source/Core/DolphinWX/GLInterface/EGL.cpp
+++ b/Source/Core/DolphinWX/GLInterface/EGL.cpp
@@ -1,25 +1,11 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Host.h"
-#include "RenderBase.h"
-
-#include "GLInterface.h"
-#include "EGL.h"
+#include "Core/Host.h"
+#include "DolphinWX/GLInterface/EGL.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoCommon/RenderBase.h"
// Show the current FPS
void cInterfaceEGL::UpdateFPSDisplay(const char *text)
@@ -58,7 +44,8 @@ void cInterfaceEGL::DetectMode()
EGL_NONE };
// Get how many configs there are
- if (!eglChooseConfig( GLWin.egl_dpy, attribs, NULL, 0, &num_configs)) {
+ if (!eglChooseConfig( GLWin.egl_dpy, attribs, NULL, 0, &num_configs))
+ {
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
goto err_exit;
}
@@ -101,7 +88,7 @@ err_exit:
}
// Create rendering window.
-// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
+// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceEGL::Create(void *&window_handle)
{
const char *s;
@@ -112,14 +99,16 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_dpy = Platform.EGLGetDisplay();
- if (!GLWin.egl_dpy) {
+ if (!GLWin.egl_dpy)
+ {
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
return false;
}
GLWin.platform = Platform.platform;
- if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
+ if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor))
+ {
INFO_LOG(VIDEO, "Error: eglInitialize() failed\n");
return false;
}
@@ -147,7 +136,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
{
case MODE_OPENGL:
attribs[1] = EGL_OPENGL_BIT;
- ctx_attribs[0] = EGL_NONE;
+ ctx_attribs[0] = EGL_NONE;
break;
case MODE_OPENGLES2:
attribs[1] = EGL_OPENGL_ES2_BIT;
@@ -163,7 +152,8 @@ bool cInterfaceEGL::Create(void *&window_handle)
break;
}
- if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs))
+ {
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
exit(1);
}
@@ -189,16 +179,17 @@ bool cInterfaceEGL::Create(void *&window_handle)
INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", s);
GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
- if (!GLWin.egl_ctx) {
+ if (!GLWin.egl_ctx)
+ {
INFO_LOG(VIDEO, "Error: eglCreateContext failed\n");
exit(1);
}
GLWin.native_window = Platform.CreateWindow();
- GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config,
- GLWin.native_window, NULL);
- if (!GLWin.egl_surf) {
+ GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, NULL);
+ if (!GLWin.egl_surf)
+ {
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
exit(1);
}
diff --git a/Source/Core/DolphinWX/GLInterface/EGL.h b/Source/Core/DolphinWX/GLInterface/EGL.h
index f3e8e5b..54a977a 100644
--- a/Source/Core/DolphinWX/GLInterface/EGL.h
+++ b/Source/Core/DolphinWX/GLInterface/EGL.h
@@ -5,8 +5,9 @@
#pragma once
#include <EGL/egl.h>
-#include "InterfaceBase.h"
-#include "ConfigManager.h"
+
+#include "Core/ConfigManager.h"
+#include "DolphinWX/GLInterface/InterfaceBase.h"
class cPlatform
diff --git a/Source/Core/DolphinWX/GLInterface/GLInterface.h b/Source/Core/DolphinWX/GLInterface/GLInterface.h
index 96cf561..edd7d93 100644
--- a/Source/Core/DolphinWX/GLInterface/GLInterface.h
+++ b/Source/Core/DolphinWX/GLInterface/GLInterface.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Thread.h"
+#include "Common/Thread.h"
#if USE_EGL
// Currently Wayland/EGL and X11/EGL platforms are supported.
@@ -19,19 +19,19 @@ enum egl_platform {
};
#if HAVE_X11
-#include "GLInterface/X11_Util.h"
+#include "DolphinWX/GLInterface/X11_Util.h"
#endif
#if HAVE_WAYLAND
-#include "GLInterface/Wayland_Util.h"
+#include "DolphinWX/GLInterface/Wayland_Util.h"
#endif
-#include "GLInterface/EGL.h"
+#include "DolphinWX/GLInterface/EGL.h"
#elif defined(__APPLE__)
-#include "GLInterface/AGL.h"
+#include "DolphinWX/GLInterface/AGL.h"
#elif defined(_WIN32)
-#include "GLInterface/WGL.h"
+#include "DolphinWX/GLInterface/WGL.h"
#elif HAVE_X11
-#include "GLInterface/GLX.h"
+#include "DolphinWX/GLInterface/GLX.h"
#include <GL/glx.h>
#else
#error Platform doesnt have a GLInterface
diff --git a/Source/Core/DolphinWX/GLInterface/GLX.cpp b/Source/Core/DolphinWX/GLInterface/GLX.cpp
index d124b1d..04ac370 100644
--- a/Source/Core/DolphinWX/GLInterface/GLX.cpp
+++ b/Source/Core/DolphinWX/GLInterface/GLX.cpp
@@ -2,12 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Host.h"
-#include "RenderBase.h"
-#include "VideoConfig.h"
+#include "Core/Host.h"
-#include "GLInterface.h"
-#include "GLX.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/GLX.h"
+
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VideoConfig.h"
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
@@ -36,7 +37,7 @@ void cInterfaceGLX::Swap()
}
// Create rendering window.
-// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
+// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceGLX::Create(void *&window_handle)
{
int _tx, _ty, _twidth, _theight;
diff --git a/Source/Core/DolphinWX/GLInterface/GLX.h b/Source/Core/DolphinWX/GLInterface/GLX.h
index 92cabf3..3b66395 100644
--- a/Source/Core/DolphinWX/GLInterface/GLX.h
+++ b/Source/Core/DolphinWX/GLInterface/GLX.h
@@ -4,8 +4,8 @@
#pragma once
-#include "X11_Util.h"
-#include "InterfaceBase.h"
+#include "DolphinWX/GLInterface/InterfaceBase.h"
+#include "DolphinWX/GLInterface/X11_Util.h"
class cInterfaceGLX : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h b/Source/Core/DolphinWX/GLInterface/InterfaceBase.h
index c13bfe8..e01539a 100644
--- a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h
+++ b/Source/Core/DolphinWX/GLInterface/InterfaceBase.h
@@ -4,6 +4,8 @@
#pragma once
+#include "Common/Common.h"
+
enum GLInterfaceMode {
MODE_DETECT = 0,
MODE_OPENGL,
diff --git a/Source/Core/DolphinWX/GLInterface/Platform.cpp b/Source/Core/DolphinWX/GLInterface/Platform.cpp
index 98d0db9..816731a 100644
--- a/Source/Core/DolphinWX/GLInterface/Platform.cpp
+++ b/Source/Core/DolphinWX/GLInterface/Platform.cpp
@@ -1,22 +1,9 @@
-// Copyright (C) 2013 Scott Moreau <oreaus@gmail.com>
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Host.h"
-#include "GLInterface/GLInterface.h"
+#include "Core/Host.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
bool cPlatform::SelectDisplay(void)
{
diff --git a/Source/Core/DolphinWX/GLInterface/WGL.cpp b/Source/Core/DolphinWX/GLInterface/WGL.cpp
index f8878a5..15b9e41 100644
--- a/Source/Core/DolphinWX/GLInterface/WGL.cpp
+++ b/Source/Core/DolphinWX/GLInterface/WGL.cpp
@@ -2,15 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoConfig.h"
-#include "Host.h"
-#include "RenderBase.h"
+#include "Core/Host.h"
-#include "VertexShaderManager.h"
-#include "GLInterface.h"
-#include "WGL.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/WGL.h"
+
+#include "VideoCommon/EmuWindow.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
-#include "EmuWindow.h"
static HDC hDC = NULL; // Private GDI Device Context
static HGLRC hRC = NULL; // Permanent Rendering Context
static HINSTANCE dllHandle = NULL; // Handle to OpenGL32.dll
@@ -63,7 +64,7 @@ void cInterfaceWGL::UpdateFPSDisplay(const char *text)
}
// Create rendering window.
-// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
+// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceWGL::Create(void *&window_handle)
{
int _tx, _ty, _twidth, _theight;
diff --git a/Source/Core/DolphinWX/GLInterface/WGL.h b/Source/Core/DolphinWX/GLInterface/WGL.h
index 22f7b3e..fa8846c 100644
--- a/Source/Core/DolphinWX/GLInterface/WGL.h
+++ b/Source/Core/DolphinWX/GLInterface/WGL.h
@@ -4,7 +4,7 @@
#pragma once
-#include "InterfaceBase.h"
+#include "DolphinWX/GLInterface/InterfaceBase.h"
class cInterfaceWGL : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
index f2e0fb1..19dbb7a 100644
--- a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
+++ b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
@@ -2,12 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Core.h"
-#include "State.h"
-#include "GLInterface.h"
#include <linux/input.h>
#include <sys/mman.h>
+#include "Core/Core.h"
+#include "Core/State.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+
static void
hide_cursor(void)
{
diff --git a/Source/Core/DolphinWX/GLInterface/Wayland_Util.h b/Source/Core/DolphinWX/GLInterface/Wayland_Util.h
index db38c5c..9025e00 100644
--- a/Source/Core/DolphinWX/GLInterface/Wayland_Util.h
+++ b/Source/Core/DolphinWX/GLInterface/Wayland_Util.h
@@ -5,13 +5,13 @@
#pragma once
#include <wayland-client.h>
-#include <wayland-egl.h>
#include <wayland-cursor.h>
+#include <wayland-egl.h>
#include <xkbcommon/xkbcommon.h>
-#define MOD_SHIFT_MASK 0x01
-#define MOD_ALT_MASK 0x02
-#define MOD_CONTROL_MASK 0x04
+#define MOD_SHIFT_MASK 0x01
+#define MOD_ALT_MASK 0x02
+#define MOD_CONTROL_MASK 0x04
class cWaylandInterface
diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
index a20c88f..d3f4c5b 100644
--- a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
+++ b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
@@ -1,23 +1,10 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Host.h"
-#include "VideoConfig.h"
-#include "GLInterface.h"
+#include "Core/Host.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoCommon/VideoConfig.h"
#if USE_EGL
bool cXInterface::ServerConnect(void)
diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.h b/Source/Core/DolphinWX/GLInterface/X11_Util.h
index 94ebce3..6294df5 100644
--- a/Source/Core/DolphinWX/GLInterface/X11_Util.h
+++ b/Source/Core/DolphinWX/GLInterface/X11_Util.h
@@ -4,8 +4,8 @@
#pragma once
-#include <X11/Xlib.h>
#include <X11/keysym.h>
+#include <X11/Xlib.h>
#include <X11/Xutil.h>
#if USE_EGL
diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp
index 3cbc86c..800cee9 100644
--- a/Source/Core/DolphinWX/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/GameListCtrl.cpp
@@ -2,45 +2,41 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-
-#include <wx/imaglist.h>
-#include <wx/fontmap.h>
-#include <wx/filename.h>
-
#include <algorithm>
#include <cinttypes>
#include <memory>
+#include <wx/filename.h>
+#include <wx/fontmap.h>
+#include <wx/imaglist.h>
-#include "FileSearch.h"
-#include "StringUtil.h"
-#include "ConfigManager.h"
-#include "GameListCtrl.h"
-#include "Blob.h"
-#include "Core.h"
-#include "ISOProperties.h"
-#include "FileUtil.h"
-#include "CDUtils.h"
-#include "WxUtils.h"
-#include "Main.h"
-#include "MathUtil.h"
-#include "HW/DVDInterface.h"
-
-#include "resources/Flag_Europe.xpm"
-#include "resources/Flag_Germany.xpm"
-#include "resources/Flag_France.xpm"
-#include "resources/Flag_Italy.xpm"
-#include "resources/Flag_Japan.xpm"
-#include "resources/Flag_USA.xpm"
-#include "resources/Flag_Taiwan.xpm"
-#include "resources/Flag_Korea.xpm"
-#include "resources/Flag_Unknown.xpm"
-#include "resources/Flag_SDK.xpm"
-
-#include "resources/Platform_Wad.xpm"
-#include "resources/Platform_Wii.xpm"
-#include "resources/Platform_Gamecube.xpm"
-#include "resources/rating_gamelist.h"
+#include "Common/CDUtils.h"
+#include "Common/FileSearch.h"
+#include "Common/FileUtil.h"
+#include "Common/MathUtil.h"
+#include "Common/StringUtil.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/HW/DVDInterface.h"
+#include "DiscIO/Blob.h"
+#include "DolphinWX/GameListCtrl.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/ISOProperties.h"
+#include "DolphinWX/Main.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/resources/Flag_Europe.xpm"
+#include "DolphinWX/resources/Flag_France.xpm"
+#include "DolphinWX/resources/Flag_Germany.xpm"
+#include "DolphinWX/resources/Flag_Italy.xpm"
+#include "DolphinWX/resources/Flag_Japan.xpm"
+#include "DolphinWX/resources/Flag_Korea.xpm"
+#include "DolphinWX/resources/Flag_SDK.xpm"
+#include "DolphinWX/resources/Flag_Taiwan.xpm"
+#include "DolphinWX/resources/Flag_Unknown.xpm"
+#include "DolphinWX/resources/Flag_USA.xpm"
+#include "DolphinWX/resources/Platform_Gamecube.xpm"
+#include "DolphinWX/resources/Platform_Wad.xpm"
+#include "DolphinWX/resources/Platform_Wii.xpm"
+#include "DolphinWX/resources/rating_gamelist.h"
size_t CGameListCtrl::m_currentItem = 0;
size_t CGameListCtrl::m_numberItem = 0;
@@ -50,7 +46,7 @@ bool sorted = false;
extern CFrame* main_frame;
static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2,
- long sortData = CGameListCtrl::COLUMN_TITLE)
+ long sortData = CGameListCtrl::COLUMN_TITLE)
{
int t = 1;
@@ -70,8 +66,8 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
{
indexOne = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
- else
- { // GC
+ else // GC
+ {
indexOne = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
}
@@ -79,8 +75,8 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
{
indexOther = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
- else
- { // GC
+ else // GC
+ {
indexOther = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
}
diff --git a/Source/Core/DolphinWX/GameListCtrl.h b/Source/Core/DolphinWX/GameListCtrl.h
index 114f148..7b3009d 100644
--- a/Source/Core/DolphinWX/GameListCtrl.h
+++ b/Source/Core/DolphinWX/GameListCtrl.h
@@ -10,8 +10,8 @@
#include <wx/listctrl.h>
#include <wx/tipwin.h>
-#include "ISOFile.h"
-#include "MemoryCards/WiiSaveCrypted.h"
+#include "DolphinWX/ISOFile.h"
+#include "DolphinWX/MemoryCards/WiiSaveCrypted.h"
class wxEmuStateTip : public wxTipWindow
{
@@ -59,7 +59,7 @@ private:
void ClearIsoFiles()
{
- while (!m_ISOFiles.empty()) // so lazy
+ while (!m_ISOFiles.empty()) // so lazy
{
delete m_ISOFiles.back();
m_ISOFiles.pop_back();
diff --git a/Source/Core/DolphinWX/GeckoCodeDiag.cpp b/Source/Core/DolphinWX/GeckoCodeDiag.cpp
index fc1e628..7e48bf5 100644
--- a/Source/Core/DolphinWX/GeckoCodeDiag.cpp
+++ b/Source/Core/DolphinWX/GeckoCodeDiag.cpp
@@ -2,13 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GeckoCodeDiag.h"
-#include "Core.h"
-#include "WxUtils.h"
+#include <sstream>
#include <SFML/Network/Http.hpp>
-#include <sstream>
+#include "Core/Core.h"
+#include "DolphinWX/GeckoCodeDiag.h"
+#include "DolphinWX/WxUtils.h"
namespace Gecko
{
@@ -94,7 +94,7 @@ void CodeConfigPanel::LoadCodes(const IniFile& globalIni, const IniFile& localIn
void CodeConfigPanel::ToggleCode(wxCommandEvent& evt)
{
- const int sel = evt.GetInt(); // this right?
+ const int sel = evt.GetInt(); // this right?
if (sel > -1)
m_gcodes[sel].enabled = m_listbox_gcodes->IsChecked(sel);
}
@@ -115,7 +115,7 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&)
notes_end = m_gcodes[sel].notes.end();
for (; notes_iter!=notes_end; ++notes_iter)
m_infobox.textctrl_notes->AppendText(StrToWxStr(*notes_iter));
- m_infobox.textctrl_notes->ScrollLines(-99); // silly
+ m_infobox.textctrl_notes->ScrollLines(-99); // silly
m_infobox.label_creator->SetLabel(wxGetTranslation(wxstr_creator) + StrToWxStr(m_gcodes[sel].creator));
@@ -134,11 +134,6 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&)
}
}
-//void CodeConfigPanel::ApplyChanges(wxCommandEvent&)
-//{
-// Gecko::SetActiveCodes(m_gcodes);
-//}
-
void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
{
if (m_gameid.empty())
@@ -170,7 +165,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
if (sf::Http::Response::Ok == resp.GetStatus())
{
// temp vector containing parsed codes
- std::vector<GeckoCode> gcodes;
+ std::vector<GeckoCode> gcodes;
// parse the codes
std::istringstream ss(resp.GetBody());
@@ -184,7 +179,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
// eh w/e
//std::getline(ss, line);
//if (line != m_gameid)
- // PanicAlert("Bad code file.");
+ // PanicAlert("Bad code file.");
// seek past the header, get to the first code
std::getline(ss, line);
@@ -197,7 +192,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
while ((std::getline(ss, line).good()))
{
// empty line
- if (0 == line.size() || line == "\r" || line == "\n") // \r\n checks might not be needed
+ if (0 == line.size() || line == "\r" || line == "\n") // \r\n checks might not be needed
{
// add the code
if (gcode.codes.size())
@@ -241,7 +236,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
else
{
gcode.notes.push_back(line);
- read_state = 2; // start reading comments
+ read_state = 2; // start reading comments
}
}
diff --git a/Source/Core/DolphinWX/GeckoCodeDiag.h b/Source/Core/DolphinWX/GeckoCodeDiag.h
index 356e1c7..bf3fb06 100644
--- a/Source/Core/DolphinWX/GeckoCodeDiag.h
+++ b/Source/Core/DolphinWX/GeckoCodeDiag.h
@@ -4,10 +4,10 @@
#pragma once
-#include "GeckoCode.h"
-#include "GeckoCodeConfig.h"
+#include <wx/wx.h>
-#include "wx/wx.h"
+#include "Core/GeckoCode.h"
+#include "Core/GeckoCodeConfig.h"
namespace Gecko
{
@@ -36,12 +36,12 @@ private:
std::string m_gameid;
// wxwidgets stuff
- wxCheckListBox *m_listbox_gcodes;
+ wxCheckListBox* m_listbox_gcodes;
struct
{
- wxStaticText *label_name, *label_notes, *label_creator;
- wxTextCtrl *textctrl_notes;
- wxListBox *listbox_codes;
+ wxStaticText* label_name, *label_notes, *label_creator;
+ wxTextCtrl* textctrl_notes;
+ wxListBox* listbox_codes;
} m_infobox;
wxButton* btn_download;
};
diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h
index 0bdde92..f114b8f 100644
--- a/Source/Core/DolphinWX/Globals.h
+++ b/Source/Core/DolphinWX/Globals.h
@@ -7,7 +7,24 @@
#pragma once
-#include "Common.h"
+#include <wx/aboutdlg.h>
+#include <wx/busyinfo.h>
+#include <wx/button.h>
+#include <wx/choice.h>
+#include <wx/cmdline.h>
+#include <wx/filedlg.h>
+#include <wx/image.h>
+#include <wx/imagpng.h>
+#include <wx/listctrl.h>
+#include <wx/log.h>
+#include <wx/progdlg.h>
+#include <wx/spinctrl.h>
+#include <wx/srchctrl.h>
+#include <wx/stattext.h>
+#include <wx/toolbar.h>
+#include <wx/wx.h>
+
+#include "Common/Common.h"
enum
{
@@ -129,7 +146,6 @@ enum
// Views
IDM_LOGWINDOW,
IDM_LOGCONFIGWINDOW,
- IDM_CONSOLEWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
@@ -141,7 +157,6 @@ enum
// Float Window IDs
IDM_LOGWINDOW_PARENT,
IDM_LOGCONFIGWINDOW_PARENT,
- IDM_CONSOLEWINDOW_PARENT,
IDM_REGISTERWINDOW_PARENT,
IDM_BREAKPOINTWINDOW_PARENT,
IDM_MEMORYWINDOW_PARENT,
@@ -253,23 +268,6 @@ enum
LIST_CTRL = 1000
};
-#include <wx/wx.h>
-#include <wx/toolbar.h>
-#include <wx/log.h>
-#include <wx/image.h>
-#include <wx/aboutdlg.h>
-#include <wx/filedlg.h>
-#include <wx/spinctrl.h>
-#include <wx/srchctrl.h>
-#include <wx/listctrl.h>
-#include <wx/progdlg.h>
-#include <wx/imagpng.h>
-#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/choice.h>
-#include <wx/cmdline.h>
-#include <wx/busyinfo.h>
-
// custom message macro
#define EVT_HOST_COMMAND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY(\
diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp
index 5fe375c..12b4bd8 100644
--- a/Source/Core/DolphinWX/HotkeyDlg.cpp
+++ b/Source/Core/DolphinWX/HotkeyDlg.cpp
@@ -4,8 +4,8 @@
#include <wx/notebook.h>
-#include "HotkeyDlg.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "DolphinWX/HotkeyDlg.h"
BEGIN_EVENT_TABLE(HotkeyConfigDialog,wxDialog)
EVT_COMMAND_RANGE(0, NUM_HOTKEYS - 1,
diff --git a/Source/Core/DolphinWX/HotkeyDlg.h b/Source/Core/DolphinWX/HotkeyDlg.h
index 4c389ea..8ca4fc9 100644
--- a/Source/Core/DolphinWX/HotkeyDlg.h
+++ b/Source/Core/DolphinWX/HotkeyDlg.h
@@ -4,20 +4,20 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/textctrl.h>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/combobox.h>
#include <wx/checkbox.h>
+#include <wx/combobox.h>
#include <wx/gbsizer.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+#include <wx/wx.h>
-#include "Common.h"
-#include "CoreParameter.h"
-#include "WXInputBase.h"
+#include "Common/Common.h"
+#include "Core/CoreParameter.h"
+#include "DolphinWX/WXInputBase.h"
#if defined(HAVE_X11) && HAVE_X11
-#include "X11InputBase.h"
+#include "InputCommon/X11InputBase.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
#endif
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index cb3e01e..fabdd9e 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -2,28 +2,29 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <cinttypes>
#include <string>
#include <vector>
#include <wx/mstream.h>
-#include <cinttypes>
-#include "Common.h"
-#include "CommonPaths.h"
-
-#include "Globals.h"
-#include "FileUtil.h"
-#include "ISOFile.h"
-#include "StringUtil.h"
-#include "Hash.h"
-#include "IniFile.h"
-#include "WxUtils.h"
-
-#include "Filesystem.h"
-#include "BannerLoader.h"
-#include "FileSearch.h"
-#include "CompressedBlob.h"
-#include "ChunkFile.h"
-#include "ConfigManager.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileSearch.h"
+#include "Common/FileUtil.h"
+#include "Common/Hash.h"
+#include "Common/IniFile.h"
+#include "Common/StringUtil.h"
+
+#include "Core/ConfigManager.h"
+
+#include "DiscIO/BannerLoader.h"
+#include "DiscIO/CompressedBlob.h"
+#include "DiscIO/Filesystem.h"
+
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/ISOFile.h"
+#include "DolphinWX/WxUtils.h"
static const u32 CACHE_REVISION = 0x115;
diff --git a/Source/Core/DolphinWX/ISOFile.h b/Source/Core/DolphinWX/ISOFile.h
index 724413f..dc6d211 100644
--- a/Source/Core/DolphinWX/ISOFile.h
+++ b/Source/Core/DolphinWX/ISOFile.h
@@ -4,11 +4,11 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
-#include "Volume.h"
-#include "VolumeCreator.h"
+#include "DiscIO/Volume.h"
+#include "DiscIO/VolumeCreator.h"
#if defined(HAVE_WX) && HAVE_WX
#include <wx/image.h>
diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp
index 8899a54..e632340 100644
--- a/Source/Core/DolphinWX/ISOProperties.cpp
+++ b/Source/Core/DolphinWX/ISOProperties.cpp
@@ -6,27 +6,25 @@
#import <Cocoa/Cocoa.h>
#endif
-#include <type_traits>
#include <cinttypes>
+#include <type_traits>
-#include "Common.h"
-#include "CommonPaths.h"
-#include "Globals.h"
-
-#include "WxUtils.h"
-#include "VolumeCreator.h"
-#include "Filesystem.h"
-#include "ISOProperties.h"
-#include "PHackSettings.h"
-#include "PatchAddEdit.h"
-#include "ARCodeAddEdit.h"
-#include "GeckoCodeDiag.h"
-#include "ConfigManager.h"
-#include "StringUtil.h"
-
-#include "resources/isoprop_file.xpm"
-#include "resources/isoprop_folder.xpm"
-#include "resources/isoprop_disc.xpm"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/StringUtil.h"
+#include "Core/ConfigManager.h"
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/VolumeCreator.h"
+#include "DolphinWX/ARCodeAddEdit.h"
+#include "DolphinWX/GeckoCodeDiag.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/ISOProperties.h"
+#include "DolphinWX/PatchAddEdit.h"
+#include "DolphinWX/PHackSettings.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/resources/isoprop_disc.xpm"
+#include "DolphinWX/resources/isoprop_file.xpm"
+#include "DolphinWX/resources/isoprop_folder.xpm"
struct WiiPartition
{
@@ -582,9 +580,9 @@ void CISOProperties::CreateGUIControls(bool IsWad)
// Filesystem icons
wxImageList * const m_iconList = new wxImageList(16, 16);
- m_iconList->Add(wxBitmap(disc_xpm), wxNullBitmap); // 0
- m_iconList->Add(wxBitmap(folder_xpm), wxNullBitmap); // 1
- m_iconList->Add(wxBitmap(file_xpm), wxNullBitmap); // 2
+ m_iconList->Add(wxBitmap(disc_xpm), wxNullBitmap); // 0
+ m_iconList->Add(wxBitmap(folder_xpm), wxNullBitmap); // 1
+ m_iconList->Add(wxBitmap(file_xpm), wxNullBitmap); // 2
// Filesystem tree
m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL,
diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h
index 82c8bd4..12c709f 100644
--- a/Source/Core/DolphinWX/ISOProperties.h
+++ b/Source/Core/DolphinWX/ISOProperties.h
@@ -4,24 +4,24 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/sizer.h>
+#include <string>
#include <wx/filepicker.h>
-#include <wx/statbmp.h>
-#include <wx/imaglist.h>
#include <wx/fontmap.h>
-#include <wx/treectrl.h>
#include <wx/gbsizer.h>
-#include <wx/notebook.h>
+#include <wx/imaglist.h>
#include <wx/mimetype.h>
-#include <string>
+#include <wx/notebook.h>
+#include <wx/sizer.h>
+#include <wx/statbmp.h>
+#include <wx/treectrl.h>
+#include <wx/wx.h>
-#include "ISOFile.h"
-#include "Filesystem.h"
-#include "IniFile.h"
-#include "PatchEngine.h"
-#include "ActionReplay.h"
-#include "GeckoCodeDiag.h"
+#include "Common/IniFile.h"
+#include "Core/ActionReplay.h"
+#include "Core/PatchEngine.h"
+#include "DiscIO/Filesystem.h"
+#include "DolphinWX/GeckoCodeDiag.h"
+#include "DolphinWX/ISOFile.h"
struct PHackData
{
diff --git a/Source/Core/DolphinWX/InputConfigDiag.cpp b/Source/Core/DolphinWX/InputConfigDiag.cpp
index ee54c38..d707eac 100644
--- a/Source/Core/DolphinWX/InputConfigDiag.cpp
+++ b/Source/Core/DolphinWX/InputConfigDiag.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "InputConfigDiag.h"
-#include "UDPConfigDiag.h"
-#include "WxUtils.h"
-#include "HW/Wiimote.h"
-#include "ControllerInterface/ExpressionParser.h"
+#include "Core/HW/Wiimote.h"
+#include "DolphinWX/InputConfigDiag.h"
+#include "DolphinWX/UDPConfigDiag.h"
+#include "DolphinWX/WxUtils.h"
+#include "InputCommon/ControllerInterface/ExpressionParser.h"
using namespace ciface::ExpressionParser;
@@ -118,7 +118,7 @@ ControlDialog::ControlDialog(GamepadPage* const parent, InputPlugin& plugin, Con
szr->Add(d_szr, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5);
szr->Add(control_chooser, 1, wxEXPAND|wxALL, 5);
- SetSizerAndFit(szr); // needed
+ SetSizerAndFit(szr); // needed
UpdateGUI();
SetFocus();
@@ -965,7 +965,7 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
UpdateGUI();
- SetSizerAndFit(mapping); // needed
+ SetSizerAndFit(mapping); // needed
Layout();
};
diff --git a/Source/Core/DolphinWX/InputConfigDiag.h b/Source/Core/DolphinWX/InputConfigDiag.h
index f84adc3..d265e87 100644
--- a/Source/Core/DolphinWX/InputConfigDiag.h
+++ b/Source/Core/DolphinWX/InputConfigDiag.h
@@ -4,32 +4,31 @@
#pragma once
-#define SLIDER_TICK_COUNT 100
-#define DETECT_WAIT_TIME 1500
-#define PREVIEW_UPDATE_TIME 25
+#define SLIDER_TICK_COUNT 100
+#define DETECT_WAIT_TIME 1500
+#define PREVIEW_UPDATE_TIME 25
// might have to change this setup for wiimote
-#define PROFILES_PATH "Profiles/"
+#define PROFILES_PATH "Profiles/"
-#include <wx/wx.h>
-#include <wx/listbox.h>
-#include <wx/textctrl.h>
+#include <sstream>
+#include <vector>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/combobox.h>
#include <wx/checkbox.h>
+#include <wx/combobox.h>
+#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+#include <wx/wx.h>
-#include <sstream>
-#include <vector>
-
-#include "ControllerInterface/ControllerInterface.h"
-#include "ControllerEmu.h"
-#include "InputConfig.h"
-#include "FileSearch.h"
-#include "UDPWrapper.h"
+#include "Common/FileSearch.h"
+#include "InputCommon/ControllerEmu.h"
+#include "InputCommon/InputConfig.h"
+#include "InputCommon/UDPWrapper.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
class PadSetting
{
@@ -42,7 +41,7 @@ public:
virtual ~PadSetting() {}
- wxControl* const wxcontrol;
+ wxControl* const wxcontrol;
};
class PadSettingExtension : public PadSetting
@@ -52,7 +51,7 @@ public:
void UpdateGUI();
void UpdateValue();
- ControllerEmu::Extension* const extension;
+ ControllerEmu::Extension* const extension;
};
class PadSettingSpin : public PadSetting
@@ -61,7 +60,7 @@ public:
PadSettingSpin(wxWindow* const parent, ControllerEmu::ControlGroup::Setting* const setting)
: PadSetting(new wxSpinCtrl(parent, -1, wxEmptyString, wxDefaultPosition
, wxSize(54, -1), 0, setting->low, setting->high, (int)(setting->value * 100)))
- , value(setting->value) {}
+ , value(setting->value) {}
void UpdateGUI();
void UpdateValue();
@@ -76,7 +75,7 @@ public:
void UpdateGUI();
void UpdateValue();
- ControlState& value;
+ ControlState& value;
};
class GamepadPage;
@@ -101,19 +100,19 @@ public:
void SetSelectedControl(wxCommandEvent& event);
void AppendControl(wxCommandEvent& event);
- ControllerInterface::ControlReference* const control_reference;
- InputPlugin& m_plugin;
- wxComboBox* device_cbox;
+ ControllerInterface::ControlReference* const control_reference;
+ InputPlugin& m_plugin;
+ wxComboBox* device_cbox;
- wxTextCtrl* textctrl;
- wxListBox* control_lbox;
- wxSlider* range_slider;
+ wxTextCtrl* textctrl;
+ wxListBox* control_lbox;
+ wxSlider* range_slider;
private:
- GamepadPage* const m_parent;
- wxStaticText* m_bound_label;
- wxStaticText* m_error_label;
- DeviceQualifier m_devq;
+ GamepadPage* const m_parent;
+ wxStaticText* m_bound_label;
+ wxStaticText* m_error_label;
+ DeviceQualifier m_devq;
bool GetExpressionForSelectedControl(wxString &expr);
};
@@ -124,7 +123,7 @@ public:
: wxButton(parent, -1, _("Configure"), wxDefaultPosition)
, extension(ext) {}
- ControllerEmu::Extension* const extension;
+ ControllerEmu::Extension* const extension;
};
class ControlButton : public wxButton
@@ -132,7 +131,7 @@ class ControlButton : public wxButton
public:
ControlButton(wxWindow* const parent, ControllerInterface::ControlReference* const _ref, const unsigned int width, const std::string& label = "");
- ControllerInterface::ControlReference* const control_reference;
+ ControllerInterface::ControlReference* const control_reference;
};
class UDPConfigButton : public wxButton
@@ -151,11 +150,11 @@ public:
ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent, GamepadPage* const eventsink);
~ControlGroupBox();
- std::vector<PadSetting*> options;
+ std::vector<PadSetting*> options;
- ControllerEmu::ControlGroup* const control_group;
- wxStaticBitmap* static_bitmap;
- std::vector<ControlButton*> control_buttons;
+ ControllerEmu::ControlGroup* const control_group;
+ wxStaticBitmap* static_bitmap;
+ std::vector<ControlButton*> control_buttons;
};
class ControlGroupsSizer : public wxBoxSizer
@@ -200,19 +199,19 @@ public:
void GetProfilePath(std::string& path);
- wxComboBox* profile_cbox;
- wxComboBox* device_cbox;
+ wxComboBox* profile_cbox;
+ wxComboBox* device_cbox;
- std::vector<ControlGroupBox*> control_groups;
+ std::vector<ControlGroupBox*> control_groups;
protected:
- ControllerEmu* const controller;
+ ControllerEmu* const controller;
private:
- ControlDialog* m_control_dialog;
- InputConfigDialog* const m_config_dialog;
+ ControlDialog* m_control_dialog;
+ InputConfigDialog* const m_config_dialog;
InputPlugin &m_plugin;
};
@@ -234,8 +233,8 @@ public:
private:
- wxNotebook* m_pad_notebook;
- std::vector<GamepadPage*> m_padpages;
- InputPlugin& m_plugin;
- wxTimer* m_update_timer;
+ wxNotebook* m_pad_notebook;
+ std::vector<GamepadPage*> m_padpages;
+ InputPlugin& m_plugin;
+ wxTimer* m_update_timer;
};
diff --git a/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp b/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp
index fd13247..2e722ff 100644
--- a/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp
+++ b/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "InputConfigDiag.h"
-#include "WxUtils.h"
+#include "DolphinWX/InputConfigDiag.h"
+#include "DolphinWX/WxUtils.h"
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{
diff --git a/Source/Core/DolphinWX/LogConfigWindow.cpp b/Source/Core/DolphinWX/LogConfigWindow.cpp
index 23faa65..1ec51c7 100644
--- a/Source/Core/DolphinWX/LogConfigWindow.cpp
+++ b/Source/Core/DolphinWX/LogConfigWindow.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "LogConfigWindow.h"
-#include "LogManager.h"
-#include "ConsoleListener.h"
-#include "LogWindow.h"
-#include "FileUtil.h"
-#include "WxUtils.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "DolphinWX/LogConfigWindow.h"
+#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/WxUtils.h"
LogConfigWindow::LogConfigWindow(wxWindow* parent, CLogWindow *log_window, wxWindowID id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Log Configuration"))
@@ -43,18 +42,8 @@ void LogConfigWindow::CreateGUIControls()
// Options
m_writeFileCB = new wxCheckBox(this, wxID_ANY, _("Write to File"));
m_writeFileCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteFileChecked, this);
- m_writeConsoleCB = new wxCheckBox(this, wxID_ANY, _("Write to Console"));
- m_writeConsoleCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteConsoleChecked, this);
m_writeWindowCB = new wxCheckBox(this, wxID_ANY, _("Write to Window"));
m_writeWindowCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteWindowChecked, this);
- m_writeDebuggerCB = NULL;
-#ifdef _MSC_VER
- if (IsDebuggerPresent())
- {
- m_writeDebuggerCB = new wxCheckBox(this, wxID_ANY, _("Write to Debugger"));
- m_writeDebuggerCB->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &LogConfigWindow::OnWriteDebuggerChecked, this);
- }
-#endif
wxButton *btn_toggle_all = new wxButton(this, wxID_ANY, _("Toggle All Log Types"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
@@ -67,18 +56,7 @@ void LogConfigWindow::CreateGUIControls()
// Sizers
wxStaticBoxSizer* sbOutputs = new wxStaticBoxSizer(wxVERTICAL, this, _("Logger Outputs"));
sbOutputs->Add(m_writeFileCB, 0, wxDOWN, 1);
- sbOutputs->Add(m_writeConsoleCB, 0, wxDOWN, 1);
-#ifdef _MSC_VER
- if (m_writeDebuggerCB)
- {
- sbOutputs->Add(m_writeWindowCB, 0, wxDOWN, 1);
- sbOutputs->Add(m_writeDebuggerCB, 0);
- }
- else
-#endif
- {
- sbOutputs->Add(m_writeWindowCB, 0);
- }
+ sbOutputs->Add(m_writeWindowCB, 0);
wxStaticBoxSizer* sbLogTypes = new wxStaticBoxSizer(wxVERTICAL, this, _("Log Types"));
sbLogTypes->Add(m_checks, 1, wxEXPAND);
@@ -114,21 +92,8 @@ void LogConfigWindow::LoadSettings()
// Get the logger output settings from the config ini file.
ini.Get("Options", "WriteToFile", &m_writeFile, false);
m_writeFileCB->SetValue(m_writeFile);
- ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
- m_writeConsoleCB->SetValue(m_writeConsole);
ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
m_writeWindowCB->SetValue(m_writeWindow);
-#ifdef _MSC_VER
- if (IsDebuggerPresent())
- {
- ini.Get("Options", "WriteToDebugger", &m_writeDebugger, true);
- m_writeDebuggerCB->SetValue(m_writeDebugger);
- }
- else
-#endif
- {
- m_writeDebugger = false;
- }
// Run through all of the log types and check each checkbox for each logging type
// depending on its set value within the config ini.
@@ -154,12 +119,7 @@ void LogConfigWindow::SaveSettings()
// Save the enabled/disabled states of the logger outputs to the config ini.
ini.Set("Options", "WriteToFile", m_writeFile);
- ini.Set("Options", "WriteToConsole", m_writeConsole);
ini.Set("Options", "WriteToWindow", m_writeWindow);
-#ifdef _MSC_VER
- if (IsDebuggerPresent())
- ini.Set("Options", "WriteToDebugger", m_writeDebugger);
-#endif
// Save all enabled/disabled states of the log types to the config ini.
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
@@ -200,21 +160,6 @@ void LogConfigWindow::OnWriteFileChecked(wxCommandEvent& event)
}
}
-void LogConfigWindow::OnWriteConsoleChecked(wxCommandEvent& event)
-{
- for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
- {
- m_writeConsole = event.IsChecked();
- if (m_checks->IsChecked(i))
- {
- if (m_writeConsole)
- m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());
- else
- m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());
- }
- }
-}
-
void LogConfigWindow::OnWriteWindowChecked(wxCommandEvent& event)
{
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
@@ -230,21 +175,6 @@ void LogConfigWindow::OnWriteWindowChecked(wxCommandEvent& event)
}
}
-void LogConfigWindow::OnWriteDebuggerChecked(wxCommandEvent& event)
-{
- for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
- {
- m_writeDebugger = event.IsChecked();
- if (m_checks->IsChecked(i))
- {
- if (m_writeDebugger)
- m_LogManager->AddListener((LogTypes::LOG_TYPE)i, (LogListener *)m_LogManager->GetDebuggerListener());
- else
- m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, (LogListener *)m_LogManager->GetDebuggerListener());
- }
- }
-}
-
void LogConfigWindow::OnToggleAll(wxCommandEvent& WXUNUSED(event))
{
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
@@ -265,19 +195,14 @@ void LogConfigWindow::ToggleLog(int _logType, bool enable)
{
if (m_writeWindow)
m_LogManager->AddListener(logType, (LogListener *)m_LogWindow);
+
if (m_writeFile)
m_LogManager->AddListener(logType, m_LogManager->GetFileListener());
- if (m_writeConsole)
- m_LogManager->AddListener(logType, m_LogManager->GetConsoleListener());
- if (m_writeDebugger)
- m_LogManager->AddListener(logType, m_LogManager->GetDebuggerListener());
}
else
{
m_LogManager->RemoveListener(logType, (LogListener *)m_LogWindow);
m_LogManager->RemoveListener(logType, m_LogManager->GetFileListener());
- m_LogManager->RemoveListener(logType, m_LogManager->GetConsoleListener());
- m_LogManager->RemoveListener(logType, m_LogManager->GetDebuggerListener());
}
}
diff --git a/Source/Core/DolphinWX/LogConfigWindow.h b/Source/Core/DolphinWX/LogConfigWindow.h
index a08e388..a465c74 100644
--- a/Source/Core/DolphinWX/LogConfigWindow.h
+++ b/Source/Core/DolphinWX/LogConfigWindow.h
@@ -23,20 +23,18 @@ public:
private:
LogManager *m_LogManager;
CLogWindow *m_LogWindow;
- bool m_writeFile, m_writeConsole, m_writeWindow, m_writeDebugger;
+ bool m_writeFile, m_writeWindow;
bool enableAll;
// Controls
- wxCheckBox *m_writeFileCB, *m_writeConsoleCB, *m_writeWindowCB, *m_writeDebuggerCB;
+ wxCheckBox *m_writeFileCB, *m_writeWindowCB;
wxCheckListBox* m_checks;
wxRadioBox *m_verbosity;
void CreateGUIControls();
void OnVerbosityChange(wxCommandEvent& event);
void OnWriteFileChecked(wxCommandEvent& event);
- void OnWriteConsoleChecked(wxCommandEvent& event);
void OnWriteWindowChecked(wxCommandEvent& event);
- void OnWriteDebuggerChecked(wxCommandEvent& event);
void OnToggleAll(wxCommandEvent& event);
void ToggleLog(int _logType, bool enable);
void OnLogCheck(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp
index 5d6b526..8376149 100644
--- a/Source/Core/DolphinWX/LogWindow.cpp
+++ b/Source/Core/DolphinWX/LogWindow.cpp
@@ -2,22 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "LogWindow.h"
-#include "ConsoleListener.h"
-#include "Console.h"
-#include "IniFile.h"
-#include "FileUtil.h"
-#include "Debugger/DebuggerUIUtil.h"
-#include "WxUtils.h"
-
#include <wx/fontmap.h>
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/DebuggerUIUtil.h"
+
// Milliseconds between msgQueue flushes to wxTextCtrl
#define UPDATETIME 200
BEGIN_EVENT_TABLE(CLogWindow, wxPanel)
EVT_CLOSE(CLogWindow::OnClose)
- EVT_TEXT_ENTER(IDM_SUBMITCMD, CLogWindow::OnSubmit)
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
EVT_CHOICE(IDM_FONT, CLogWindow::OnFontChange)
EVT_CHECKBOX(IDM_WRAPLINE, CLogWindow::OnWrapLineCheck)
@@ -60,18 +57,7 @@ void CLogWindow::CreateGUIControls()
// Get the logger output settings from the config ini file.
ini.Get("Options", "WriteToFile", &m_writeFile, false);
- ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
-#ifdef _MSC_VER
- if (IsDebuggerPresent())
- {
- ini.Get("Options", "WriteToDebugger", &m_writeDebugger, true);
- }
- else
-#endif
- {
- m_writeDebugger = false;
- }
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
@@ -88,16 +74,6 @@ void CLogWindow::CreateGUIControls()
else
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());
- if (m_writeConsole && enable)
- m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());
- else
- m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());
-
- if (m_writeDebugger && enable)
- m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetDebuggerListener());
- else
- m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetDebuggerListener());
-
m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity));
}
@@ -182,25 +158,15 @@ void CLogWindow::SaveSettings()
ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX));
}
-void CLogWindow::OnSubmit(wxCommandEvent& WXUNUSED (event))
-{
- if (!m_cmdline) return;
- Console_Submit(WxStrToStr(m_cmdline->GetValue()).c_str());
- m_cmdline->SetValue(wxEmptyString);
-}
-
void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event))
{
m_Log->Clear();
- {
+
std::lock_guard<std::mutex> lk(m_LogSection);
int msgQueueSize = (int)msgQueue.size();
for (int i = 0; i < msgQueueSize; i++)
msgQueue.pop();
- }
-
- m_LogManager->GetConsoleListener()->ClearScreen();
}
void CLogWindow::UnPopulateBottom()
@@ -249,19 +215,17 @@ void CLogWindow::OnWrapLineCheck(wxCommandEvent& event)
#else
wxString Text;
// Unfortunately wrapping styles can only be changed dynamically with wxGTK
- // Notice: To retain the colors when changing word wrapping we need to
- // loop through every letter with GetStyle and then reapply them letter by letter
+ // Notice: To retain the colors when changing word wrapping we need to
+ // loop through every letter with GetStyle and then reapply them letter by letter
// Prevent m_Log access while it's being destroyed
m_LogAccess = false;
UnPopulateBottom();
Text = m_Log->GetValue();
m_Log->Destroy();
if (event.IsChecked())
- m_Log = CreateTextCtrl(this, IDM_LOG,
- wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP);
+ m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP);
else
- m_Log = CreateTextCtrl(this, IDM_LOG,
- wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
+ m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
m_Log->AppendText(Text);
PopulateBottom();
@@ -335,7 +299,7 @@ void CLogWindow::UpdateLog()
}
msgQueue.pop();
}
- } // unlock log
+ } // unlock log
// m_LogTimer->Start(UPDATETIME);
m_ignoreLogTimer = false;
diff --git a/Source/Core/DolphinWX/LogWindow.h b/Source/Core/DolphinWX/LogWindow.h
index f2957d5..bb1b59c 100644
--- a/Source/Core/DolphinWX/LogWindow.h
+++ b/Source/Core/DolphinWX/LogWindow.h
@@ -4,11 +4,12 @@
#pragma once
-#include "LogManager.h"
-#include "Frame.h"
-#include "Thread.h"
#include <queue>
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+#include "DolphinWX/Frame.h"
+
enum
{
IDM_LOG,
@@ -51,7 +52,7 @@ private:
bool m_ignoreLogTimer;
LogManager *m_LogManager;
std::queue<std::pair<u8, wxString> > msgQueue;
- bool m_writeFile, m_writeConsole, m_writeWindow, m_writeDebugger, m_LogAccess;
+ bool m_writeFile, m_writeWindow, m_LogAccess;
// Controls
wxBoxSizer *sBottom;
@@ -68,7 +69,6 @@ private:
void PopulateBottom();
void UnPopulateBottom();
void OnClose(wxCloseEvent& event);
- void OnSubmit(wxCommandEvent& event);
void OnFontChange(wxCommandEvent& event);
void OnWrapLineCheck(wxCommandEvent& event);
void OnClear(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 6b416a4..97cded8 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -2,36 +2,35 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <vector>
#include <string>
+#include <vector>
+#include <wx/intl.h>
+#include <wx/stdpaths.h>
-#include "Common.h"
-#include "CommonPaths.h"
-
-#if defined HAVE_X11 && HAVE_X11
-#include <X11/Xlib.h>
-#endif
-
-#include "CPUDetect.h"
-#include "IniFile.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/CommonPaths.h"
+#include "Common/CPUDetect.h"
+#include "Common/ExtendedTrace.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
-#include "Host.h" // Core
-#include "HW/Wiimote.h"
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+#include "Core/HW/Wiimote.h"
-#include "WxUtils.h"
-#include "Globals.h" // Local
-#include "Main.h"
-#include "ConfigManager.h"
-#include "Debugger/CodeWindow.h"
-#include "Debugger/JitWindow.h"
-#include "ExtendedTrace.h"
-#include "BootManager.h"
-#include "Frame.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/Globals.h"
+#include "DolphinWX/Main.h"
+#include "DolphinWX/WxUtils.h"
+#include "DolphinWX/Debugger/CodeWindow.h"
+#include "DolphinWX/Debugger/JitWindow.h"
-#include "VideoBackendBase.h"
+#include "VideoCommon/VideoBackendBase.h"
-#include <wx/intl.h>
+#if defined HAVE_X11 && HAVE_X11
+#include <X11/Xlib.h>
+#endif
#ifdef _WIN32
#include <shellapi.h>
@@ -75,7 +74,6 @@ BEGIN_EVENT_TABLE(DolphinApp, wxApp)
EVT_END_SESSION(DolphinApp::OnEndSession)
END_EVENT_TABLE()
-#include <wx/stdpaths.h>
bool wxMsgAlert(const char*, const char*, bool, int);
std::string wxStringTranslator(const char *);
diff --git a/Source/Core/DolphinWX/Main.h b/Source/Core/DolphinWX/Main.h
index cb932c1..3901e01 100644
--- a/Source/Core/DolphinWX/Main.h
+++ b/Source/Core/DolphinWX/Main.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Frame.h"
+#include "DolphinWX/Frame.h"
// Define a new application
class CFrame;
diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp
index d235a8a..7f49b1d 100644
--- a/Source/Core/DolphinWX/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/MainAndroid.cpp
@@ -14,38 +14,36 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "Common.h"
-#include "FileUtil.h"
-
-#include "Core.h"
-#include "Host.h"
-#include "CPUDetect.h"
-#include "Thread.h"
-
-#include "State.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/Wiimote.h"
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <jni.h>
+#include <android/log.h>
+#include <android/native_window_jni.h>
-#include "VideoBackendBase.h"
-#include "ConfigManager.h"
-#include "LogManager.h"
-#include "BootManager.h"
-#include "OnScreenDisplay.h"
+#include "Android/ButtonManager.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/State.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/PowerPC/PowerPC.h"
// Banner loading
-#include "Filesystem.h"
-#include "BannerLoader.h"
-#include "VolumeCreator.h"
+#include "DiscIO/BannerLoader.h"
+#include "DiscIO/Filesystem.h"
+#include "DiscIO/VolumeCreator.h"
-#include "Android/ButtonManager.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/VideoBackendBase.h"
-#include <jni.h>
-#include <android/log.h>
-#include <android/native_window_jni.h>
ANativeWindow* surf;
int g_width, g_height;
std::string g_filename;
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp
index be794cc..ac7941d 100644
--- a/Source/Core/DolphinWX/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/MainNoGUI.cpp
@@ -2,41 +2,41 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
#include <getopt.h>
-#include "Common.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+
+#include "Core/BootManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/PowerPC/PowerPC.h"
+
+#include "VideoCommon/VideoBackendBase.h"
#if HAVE_X11
#include <X11/keysym.h>
-#include "State.h"
-#include "X11Utils.h"
+#include "Core/State.h"
+#include "DolphinWX/X11Utils.h"
#endif
#if HAVE_WAYLAND
#include <wayland-client.h>
-#include "GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
#endif
#ifdef __APPLE__
#import <Cocoa/Cocoa.h>
#endif
-#include "Core.h"
-#include "Host.h"
-#include "CPUDetect.h"
-#include "Thread.h"
-#include "PowerPC/PowerPC.h"
-#include "HW/Wiimote.h"
-
-#include "VideoBackendBase.h"
-#include "ConfigManager.h"
-#include "LogManager.h"
-#include "BootManager.h"
-
bool rendererHasFocus = true;
bool running = true;
@@ -92,7 +92,7 @@ void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
void Host_RequestRenderWindowSize(int width, int height) {}
void Host_SetStartupDebuggingParameters()
{
- SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
+ SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
StartUp.bEnableDebugging = false;
StartUp.bBootToPause = false;
}
@@ -118,10 +118,12 @@ void Host_SysMessage(const char *fmt, ...)
va_end(list);
size_t len = strlen(msg);
- if (msg[len - 1] != '\n') {
+ if (msg[len - 1] != '\n')
+ {
msg[len - 1] = '\n';
msg[len] = '\0';
}
+
fprintf(stderr, "%s", msg);
}
@@ -289,14 +291,16 @@ int main(int argc, char* argv[])
#endif
int ch, help = 0;
struct option longopts[] = {
- { "exec", no_argument, NULL, 'e' },
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { NULL, 0, NULL, 0 }
+ { "exec", no_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
};
- while ((ch = getopt_long(argc, argv, "eh?v", longopts, 0)) != -1) {
- switch (ch) {
+ while ((ch = getopt_long(argc, argv, "eh?v", longopts, 0)) != -1)
+ {
+ switch (ch)
+ {
case 'e':
break;
case 'h':
@@ -309,13 +313,14 @@ int main(int argc, char* argv[])
}
}
- if (help == 1 || argc == optind) {
+ if (help == 1 || argc == optind)
+ {
fprintf(stderr, "%s\n\n", scm_rev_str);
fprintf(stderr, "A multi-platform Gamecube/Wii emulator\n\n");
fprintf(stderr, "Usage: %s [-e <file>] [-h] [-v]\n", argv[0]);
- fprintf(stderr, " -e, --exec Load the specified file\n");
- fprintf(stderr, " -h, --help Show this help message\n");
- fprintf(stderr, " -v, --help Print version and exit\n");
+ fprintf(stderr, " -e, --exec Load the specified file\n");
+ fprintf(stderr, " -h, --help Show this help message\n");
+ fprintf(stderr, " -v, --help Print version and exit\n");
return 1;
}
@@ -346,7 +351,8 @@ int main(int argc, char* argv[])
#endif
#if HAVE_X11
#if USE_EGL
- if (GLWin.platform == EGL_PLATFORM_X11) {
+ if (GLWin.platform == EGL_PLATFORM_X11)
+ {
#endif
XInitThreads();
X11_MainLoop();
diff --git a/Source/Core/DolphinWX/MemcardManager.cpp b/Source/Core/DolphinWX/MemcardManager.cpp
index 9b345c3..e7d2466 100644
--- a/Source/Core/DolphinWX/MemcardManager.cpp
+++ b/Source/Core/DolphinWX/MemcardManager.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MemcardManager.h"
-#include "Common.h"
+#include <wx/mstream.h>
-#include "WxUtils.h"
-#include "wx/mstream.h"
+#include "Common/Common.h"
+#include "DolphinWX/MemcardManager.h"
+#include "DolphinWX/WxUtils.h"
#define ARROWS slot ? _T("") : ARROW[slot], slot ? ARROW[slot] : _T("")
@@ -160,7 +160,7 @@ bool CMemcardManager::SaveSettings()
iniMemcardSection->Set("cBanner", mcmSettings.column[COLUMN_BANNER], true);
iniMemcardSection->Set("cTitle", mcmSettings.column[COLUMN_TITLE], true);
iniMemcardSection->Set("cComment", mcmSettings.column[COLUMN_COMMENT], true);
- iniMemcardSection->Set("cIcon", mcmSettings.column[COLUMN_ICON], true);
+ iniMemcardSection->Set("cIcon", mcmSettings.column[COLUMN_ICON], true);
iniMemcardSection->Set("cBlocks", mcmSettings.column[COLUMN_BLOCKS], true);
iniMemcardSection->Set("cFirst Block", mcmSettings.column[COLUMN_FIRSTBLOCK], true);
@@ -179,13 +179,13 @@ void CMemcardManager::CreateGUIControls()
for (int slot = SLOT_A; slot <= SLOT_B; slot++)
{
- m_CopyFrom[slot] = new wxButton(this, ID_COPYFROM_A + slot,
+ m_CopyFrom[slot] = new wxButton(this, ID_COPYFROM_A + slot,
wxString::Format(_("%1$sCopy%1$s"), ARROW[slot ? 0 : 1]));
- m_SaveImport[slot] = new wxButton(this, ID_SAVEIMPORT_A + slot,
+ m_SaveImport[slot] = new wxButton(this, ID_SAVEIMPORT_A + slot,
wxString::Format(_("%sImport GCI%s"), ARROWS));
- m_SaveExport[slot] = new wxButton(this, ID_SAVEEXPORT_A + slot,
+ m_SaveExport[slot] = new wxButton(this, ID_SAVEEXPORT_A + slot,
wxString::Format(_("%sExport GCI%s"), ARROWS));
- m_Delete[slot] = new wxButton(this, ID_DELETE_A + slot,
+ m_Delete[slot] = new wxButton(this, ID_DELETE_A + slot,
wxString::Format(_("%sDelete%s"), ARROWS));
@@ -389,8 +389,8 @@ void CMemcardManager::OnMenuChange(wxCommandEvent& event)
break;
}
- if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()).c_str(), SLOT_A);
- if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()).c_str(), SLOT_B);
+ if (memoryCard[SLOT_A]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_A]->GetPath()).c_str(), SLOT_A);
+ if (memoryCard[SLOT_B]) ReloadMemcard(WxStrToStr(m_MemcardPath[SLOT_B]->GetPath()).c_str(), SLOT_B);
}
bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
{
@@ -684,7 +684,7 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
}
}
- int pagesMax = (mcmSettings.usePages) ?
+ int pagesMax = (mcmSettings.usePages) ?
(page[card] + 1) * itemsPerPage : 128;
for (j = page[card] * itemsPerPage; (j < nFiles) && (j < pagesMax); j++)
@@ -718,7 +718,7 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
wxBlock.Printf(wxT("%10d"), blocks);
m_MemcardList[card]->SetItem(index,COLUMN_BLOCKS, wxBlock);
firstblock = memoryCard[card]->DEntry_FirstBlock(fileIndex);
- //if (firstblock == 0xFFFF) firstblock = 3; // to make firstblock -1
+ //if (firstblock == 0xFFFF) firstblock = 3; // to make firstblock -1
wxFirstBlock.Printf(wxT("%15d"), firstblock);
m_MemcardList[card]->SetItem(index, COLUMN_FIRSTBLOCK, wxFirstBlock);
m_MemcardList[card]->SetItem(index, COLUMN_ICON, wxEmptyString);
@@ -808,14 +808,14 @@ void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu->AppendSeparator();
-// popupMenu->AppendCheckItem(COLUMN_BANNER, _("Show save banner"));
+ // popupMenu->AppendCheckItem(COLUMN_BANNER, _("Show save banner"));
popupMenu->AppendCheckItem(COLUMN_TITLE, _("Show save title"));
popupMenu->AppendCheckItem(COLUMN_COMMENT, _("Show save comment"));
popupMenu->AppendCheckItem(COLUMN_ICON, _("Show save icon"));
popupMenu->AppendCheckItem(COLUMN_BLOCKS, _("Show save blocks"));
popupMenu->AppendCheckItem(COLUMN_FIRSTBLOCK, _("Show first block"));
-// for (int i = COLUMN_BANNER; i <= COLUMN_FIRSTBLOCK; i++)
+ // for (int i = COLUMN_BANNER; i <= COLUMN_FIRSTBLOCK; i++)
for (int i = COLUMN_TITLE; i <= COLUMN_FIRSTBLOCK; i++)
{
popupMenu->FindItem(i)->Check(__mcmSettings.column[i]);
diff --git a/Source/Core/DolphinWX/MemcardManager.h b/Source/Core/DolphinWX/MemcardManager.h
index df05e92..775146f 100644
--- a/Source/Core/DolphinWX/MemcardManager.h
+++ b/Source/Core/DolphinWX/MemcardManager.h
@@ -4,18 +4,18 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/sizer.h>
#include <wx/filepicker.h>
+#include <wx/fontmap.h>
+#include <wx/imaglist.h>
+#include <wx/listctrl.h>
+#include <wx/sizer.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
-#include <wx/listctrl.h>
-#include <wx/imaglist.h>
-#include <wx/fontmap.h>
+#include <wx/wx.h>
-#include "IniFile.h"
-#include "FileUtil.h"
-#include "HW/GCMemcard.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Core/HW/GCMemcard.h"
#undef MEMCARD_MANAGER_STYLE
#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX
@@ -36,28 +36,28 @@ class CMemcardManager : public wxDialog
private:
DECLARE_EVENT_TABLE();
- int page[2],
- itemsPerPage,
- maxPages;
- std::string DefaultMemcard[2],
- DefaultIOPath;
+ int page[2];
+ int itemsPerPage;
+ int maxPages;
+ std::string DefaultMemcard[2];
+ std::string DefaultIOPath;
IniFile MemcardManagerIni;
IniFile::Section* iniMemcardSection;
- wxButton *m_CopyFrom[2],
- *m_SaveImport[2],
- *m_SaveExport[2],
- *m_Delete[2],
- *m_NextPage[2],
- *m_PrevPage[2],
- *m_ConvertToGci;
+ wxButton* m_CopyFrom[2];
+ wxButton* m_SaveImport[2];
+ wxButton* m_SaveExport[2];
+ wxButton* m_Delete[2];
+ wxButton* m_NextPage[2];
+ wxButton* m_PrevPage[2];
+ wxButton* m_ConvertToGci;
wxFilePickerCtrl *m_MemcardPath[2];
wxStaticText *t_Status[2];
enum
{
- ID_COPYFROM_A = 1000, // Do not rearrange these items,
- ID_COPYFROM_B, // ID_..._B must be 1 more than ID_..._A
+ ID_COPYFROM_A = 1000, // Do not rearrange these items,
+ ID_COPYFROM_B, // ID_..._B must be 1 more than ID_..._A
ID_FIXCHECKSUM_A,
ID_FIXCHECKSUM_B,
ID_DELETE_A,
@@ -142,8 +142,8 @@ class CMemcardManager : public wxDialog
Unbind(wxEVT_RIGHT_DOWN, &CMemcardListCtrl::OnRightClick, this);
}
_mcmSettings & __mcmSettings;
- bool prevPage,
- nextPage;
+ bool prevPage;
+ bool nextPage;
private:
void OnRightClick(wxMouseEvent& event);
};
diff --git a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
index 0d1a896..1703b79 100644
--- a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
+++ b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
@@ -10,23 +10,26 @@
#include <algorithm>
#include <cinttypes>
-#include "WiiSaveCrypted.h"
-#include "FileUtil.h"
-#include "MathUtil.h"
-#include "NandPaths.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/MathUtil.h"
+#include "Common/NandPaths.h"
+#include "DolphinWX/MemoryCards/WiiSaveCrypted.h"
static Common::replace_v replacements;
-const u8 SDKey[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08,
- 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D};
-const u8 MD5_BLANKER[0x10] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17,
- 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93};
+const u8 SDKey[16] = {
+ 0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08,
+ 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D
+};
+const u8 MD5_BLANKER[0x10] = {
+ 0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17,
+ 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93
+};
const u32 NG_id = 0x0403AC68;
bool CWiiSaveCrypted::ImportWiiSave(const char* FileName)
{
- CWiiSaveCrypted saveFile(FileName);
+ CWiiSaveCrypted saveFile(FileName);
return saveFile.b_valid;
}
@@ -147,8 +150,8 @@ void CWiiSaveCrypted::ReadHDR()
m_TitleID = Common::swap64(_header.hdr.SaveGameTitle);
- u8 md5_file[16],
- md5_calc[16];
+ u8 md5_file[16];
+ u8 md5_calc[16];
memcpy(md5_file, _header.hdr.Md5, 0x10);
memcpy(_header.hdr.Md5, MD5_BLANKER, 0x10);
md5((u8*)&_header, HEADER_SZ, md5_calc);
@@ -195,7 +198,7 @@ void CWiiSaveCrypted::WriteHDR()
// remove nocopy flag
_header.BNR[7] &= ~1;
- u8 md5_calc[16];
+ u8 md5_calc[16];
md5((u8*)&_header, HEADER_SZ, md5_calc);
memcpy(_header.hdr.Md5, md5_calc, 0x10);
@@ -450,13 +453,17 @@ void CWiiSaveCrypted::do_sig()
u32 NG_key_id = 0x6AAB8C59;
- u8 NG_priv[30] = { 0, 0xAB, 0xEE, 0xC1, 0xDD, 0xB4, 0xA6, 0x16, 0x6B, 0x70, 0xFD, 0x7E, 0x56, 0x67, 0x70,
- 0x57, 0x55, 0x27, 0x38, 0xA3, 0x26, 0xC5, 0x46, 0x16, 0xF7, 0x62, 0xC9, 0xED, 0x73, 0xF2};
+ u8 NG_priv[30] = {
+ 0, 0xAB, 0xEE, 0xC1, 0xDD, 0xB4, 0xA6, 0x16, 0x6B, 0x70, 0xFD, 0x7E, 0x56, 0x67, 0x70,
+ 0x57, 0x55, 0x27, 0x38, 0xA3, 0x26, 0xC5, 0x46, 0x16, 0xF7, 0x62, 0xC9, 0xED, 0x73, 0xF2
+ };
- u8 NG_sig[0x3C] = {0, 0xD8, 0x81, 0x63, 0xB2, 0x00, 0x6B, 0x0B, 0x54, 0x82, 0x88, 0x63, 0x81, 0x1C, 0x00,
- 0x71, 0x12, 0xED, 0xB7, 0xFD, 0x21, 0xAB, 0x0E, 0x50, 0x0E, 0x1F, 0xBF, 0x78, 0xAD, 0x37,
- 0x00, 0x71, 0x8D, 0x82, 0x41, 0xEE, 0x45, 0x11, 0xC7, 0x3B, 0xAC, 0x08, 0xB6, 0x83, 0xDC,
- 0x05, 0xB8, 0xA8, 0x90, 0x1F, 0xA8, 0x2A, 0x0E, 0x4E, 0x76, 0xEF, 0x44, 0x72, 0x99, 0xF8};
+ u8 NG_sig[0x3C] = {
+ 0, 0xD8, 0x81, 0x63, 0xB2, 0x00, 0x6B, 0x0B, 0x54, 0x82, 0x88, 0x63, 0x81, 0x1C, 0x00,
+ 0x71, 0x12, 0xED, 0xB7, 0xFD, 0x21, 0xAB, 0x0E, 0x50, 0x0E, 0x1F, 0xBF, 0x78, 0xAD, 0x37,
+ 0x00, 0x71, 0x8D, 0x82, 0x41, 0xEE, 0x45, 0x11, 0xC7, 0x3B, 0xAC, 0x08, 0xB6, 0x83, 0xDC,
+ 0x05, 0xB8, 0xA8, 0x90, 0x1F, 0xA8, 0x2A, 0x0E, 0x4E, 0x76, 0xEF, 0x44, 0x72, 0x99, 0xF8
+ };
sprintf(signer, "Root-CA00000001-MS00000002");
sprintf(name, "NG%08x", NG_id);
@@ -466,7 +473,7 @@ void CWiiSaveCrypted::do_sig()
memset(ap_priv, 0, sizeof ap_priv);
ap_priv[10] = 1;
- memset(ap_sig, 81, sizeof ap_sig); // temp
+ memset(ap_sig, 81, sizeof ap_sig); // temp
sprintf(signer, "Root-CA00000001-MS00000002-NG%08x", NG_id);
sprintf(name, "AP%08x%08x", 1, 2);
diff --git a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.h b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.h
index b2a3f7e..c2c85cb 100644
--- a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.h
+++ b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.h
@@ -4,10 +4,11 @@
#pragma once
-#include "StringUtil.h"
-#include "Crypto/tools.h"
#include <polarssl/aes.h>
-#include "polarssl/md5.h"
+#include <polarssl/md5.h>
+
+#include "Common/StringUtil.h"
+#include "Common/Crypto/tools.h"
// --- this is used for encrypted Wii save files
@@ -96,8 +97,8 @@ private:
struct BK_Header // Not encrypted
{
u32 size; // 0x00000070
-// u16 magic; // 'Bk'
-// u16 magic2; // or version (0x0001)
+ // u16 magic; // 'Bk'
+ // u16 magic2; // or version (0x0001)
u32 magic; // 0x426B0001
u32 NGid;
u32 numberOfFiles;
diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp
index 1e7b93d..a5eadd1 100644
--- a/Source/Core/DolphinWX/NetWindow.cpp
+++ b/Source/Core/DolphinWX/NetWindow.cpp
@@ -2,21 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <FileUtil.h>
-#include <IniFile.h>
-
-#include "WxUtils.h"
-#include "NetPlayClient.h"
-#include "NetPlayServer.h"
-#include "NetWindow.h"
-#include "Frame.h"
-#include "Core.h"
-#include "ConfigManager.h"
-
#include <sstream>
#include <string>
-#define NETPLAY_TITLEBAR "Dolphin NetPlay"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/NetPlayClient.h"
+#include "Core/NetPlayServer.h"
+
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/NetWindow.h"
+#include "DolphinWX/WxUtils.h"
+
+#define NETPLAY_TITLEBAR "Dolphin NetPlay"
#define INITIAL_PAD_BUFFER_SIZE 20
BEGIN_EVENT_TABLE(NetPlayDiag, wxFrame)
diff --git a/Source/Core/DolphinWX/NetWindow.h b/Source/Core/DolphinWX/NetWindow.h
index a645c0a..b02f735 100644
--- a/Source/Core/DolphinWX/NetWindow.h
+++ b/Source/Core/DolphinWX/NetWindow.h
@@ -4,25 +4,21 @@
#pragma once
-#include "CommonTypes.h"
-
#include <queue>
#include <string>
-
-#include <wx/wx.h>
-#include <wx/event.h>
-#include <wx/sizer.h>
#include <wx/dialog.h>
-#include <wx/notebook.h>
+#include <wx/event.h>
#include <wx/gbsizer.h>
#include <wx/listbox.h>
+#include <wx/notebook.h>
+#include <wx/sizer.h>
#include <wx/spinctrl.h>
+#include <wx/wx.h>
-#include "GameListCtrl.h"
-
-#include "FifoQueue.h"
-
-#include "NetPlayClient.h"
+#include "Common/CommonTypes.h"
+#include "Common/FifoQueue.h"
+#include "Core/NetPlayClient.h"
+#include "DolphinWX/GameListCtrl.h"
enum
{
@@ -43,14 +39,14 @@ private:
void MakeNetPlayDiag(int port, const std::string &game, bool is_hosting);
- wxTextCtrl *m_nickname_text,
- *m_host_port_text,
- *m_connect_port_text,
- *m_connect_ip_text;
+ wxTextCtrl* m_nickname_text;
+ wxTextCtrl* m_host_port_text;
+ wxTextCtrl* m_connect_port_text;
+ wxTextCtrl* m_connect_ip_text;
- wxListBox* m_game_lbox;
+ wxListBox* m_game_lbox;
#ifdef USE_UPNP
- wxCheckBox* m_upnp_chk;
+ wxCheckBox* m_upnp_chk;
#endif
const CGameListCtrl* const m_game_list;
@@ -63,7 +59,7 @@ public:
, const std::string& game, const bool is_hosting = false);
~NetPlayDiag();
- Common::FifoQueue<std::string> chat_msgs;
+ Common::FifoQueue<std::string> chat_msgs;
void OnStart(wxCommandEvent& event);
@@ -94,17 +90,17 @@ private:
void GetNetSettings(NetSettings &settings);
std::string FindGame();
- wxListBox* m_player_lbox;
- wxTextCtrl* m_chat_text;
- wxTextCtrl* m_chat_msg_text;
- wxCheckBox* m_memcard_write;
- wxCheckBox* m_record_chkbox;
+ wxListBox* m_player_lbox;
+ wxTextCtrl* m_chat_text;
+ wxTextCtrl* m_chat_msg_text;
+ wxCheckBox* m_memcard_write;
+ wxCheckBox* m_record_chkbox;
- std::string m_selected_game;
- wxButton* m_game_btn;
- wxButton* m_start_btn;
+ std::string m_selected_game;
+ wxButton* m_game_btn;
+ wxButton* m_start_btn;
- std::vector<int> m_playerids;
+ std::vector<int> m_playerids;
const CGameListCtrl* const m_game_list;
@@ -119,8 +115,8 @@ public:
private:
void OnPick(wxCommandEvent& event);
- wxListBox* m_game_lbox;
- wxString& m_game_name;
+ wxListBox* m_game_lbox;
+ wxString& m_game_name;
};
class PadMapDiag : public wxDialog
@@ -131,7 +127,7 @@ public:
private:
void OnAdjust(wxCommandEvent& event);
- wxChoice* m_map_cbox[8];
+ wxChoice* m_map_cbox[8];
PadMapping* const m_mapping;
PadMapping* const m_wiimapping;
std::vector<const Player *>& m_player_list;
diff --git a/Source/Core/DolphinWX/PHackSettings.cpp b/Source/Core/DolphinWX/PHackSettings.cpp
index 3db4489..086303e 100644
--- a/Source/Core/DolphinWX/PHackSettings.cpp
+++ b/Source/Core/DolphinWX/PHackSettings.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonPaths.h"
-#include "PHackSettings.h"
-#include "ConfigManager.h"
-#include "WxUtils.h"
+#include "Common/CommonPaths.h"
+#include "Core/ConfigManager.h"
+#include "DolphinWX/PHackSettings.h"
+#include "DolphinWX/WxUtils.h"
extern PHackData PHack_Data;
diff --git a/Source/Core/DolphinWX/PHackSettings.h b/Source/Core/DolphinWX/PHackSettings.h
index efa7d00..18965b7 100644
--- a/Source/Core/DolphinWX/PHackSettings.h
+++ b/Source/Core/DolphinWX/PHackSettings.h
@@ -4,9 +4,10 @@
#pragma once
-#include <wx/wx.h>
#include <wx/spinctrl.h>
-#include "ISOProperties.h"
+#include <wx/wx.h>
+
+#include "DolphinWX/ISOProperties.h"
class CPHackSettings : public wxDialog
{
diff --git a/Source/Core/DolphinWX/PatchAddEdit.cpp b/Source/Core/DolphinWX/PatchAddEdit.cpp
index 9850d2b..09a77a5 100644
--- a/Source/Core/DolphinWX/PatchAddEdit.cpp
+++ b/Source/Core/DolphinWX/PatchAddEdit.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "PatchAddEdit.h"
-#include "WxUtils.h"
+#include "DolphinWX/PatchAddEdit.h"
+#include "DolphinWX/WxUtils.h"
extern std::vector<PatchEngine::Patch> onFrame;
diff --git a/Source/Core/DolphinWX/PatchAddEdit.h b/Source/Core/DolphinWX/PatchAddEdit.h
index a5bc1f3..e57c80a 100644
--- a/Source/Core/DolphinWX/PatchAddEdit.h
+++ b/Source/Core/DolphinWX/PatchAddEdit.h
@@ -4,9 +4,10 @@
#pragma once
-#include <wx/wx.h>
#include <wx/spinctrl.h>
-#include "ISOProperties.h"
+#include <wx/wx.h>
+
+#include "DolphinWX/ISOProperties.h"
class CPatchAddEdit : public wxDialog
{
diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp
index 8952725..0ccb8bc 100644
--- a/Source/Core/DolphinWX/TASInputDlg.cpp
+++ b/Source/Core/DolphinWX/TASInputDlg.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "TASInputDlg.h"
-#include "Movie.h"
+#include "Core/Movie.h"
+#include "DolphinWX/TASInputDlg.h"
BEGIN_EVENT_TABLE(TASInputDlg, wxDialog)
diff --git a/Source/Core/DolphinWX/TASInputDlg.h b/Source/Core/DolphinWX/TASInputDlg.h
index 7d5b183..45d54ef 100644
--- a/Source/Core/DolphinWX/TASInputDlg.h
+++ b/Source/Core/DolphinWX/TASInputDlg.h
@@ -6,9 +6,9 @@
#include <wx/wx.h>
-#include "Common.h"
-#include "CoreParameter.h"
-#include "../InputCommon/GCPadStatus.h"
+#include "Common/Common.h"
+#include "Core/CoreParameter.h"
+#include "InputCommon/GCPadStatus.h"
class TASInputDlg : public wxDialog
{
@@ -75,7 +75,7 @@ class TASInputDlg : public wxDialog
wxCheckBox *wx_up_button, *wx_down_button, *wx_left_button, *wx_right_button, *wx_a_button, *wx_b_button, *wx_x_button, *wx_y_button, *wx_l_button, *wx_r_button, *wx_z_button, *wx_start_button;
wxTextCtrl *wx_mainX_t, *wx_mainY_t, *wx_cX_t, *wx_cY_t, *wx_l_t, *wx_r_t;
wxMemoryDC dc_main, dc_c;
- wxStaticBitmap* static_bitmap_main, *static_bitmap_c;
+ wxStaticBitmap* static_bitmap_main, *static_bitmap_c;
wxBitmap bitmap;
bool A_turbo,B_turbo, X_turbo, Y_turbo, Z_turbo, L_turbo, R_turbo, START_turbo,DL_turbo,DR_turbo,DD_turbo,DU_turbo;
bool A_cont,B_cont, X_cont, Y_cont, Z_cont, L_cont, L_button_cont, R_cont, R_button_cont, START_cont,DL_cont,DR_cont,DD_cont,DU_cont,mstickx,msticky,cstickx,csticky;
diff --git a/Source/Core/DolphinWX/UDPConfigDiag.cpp b/Source/Core/DolphinWX/UDPConfigDiag.cpp
index 3504ae5..c01d913 100644
--- a/Source/Core/DolphinWX/UDPConfigDiag.cpp
+++ b/Source/Core/DolphinWX/UDPConfigDiag.cpp
@@ -1,13 +1,12 @@
-#include "UDPConfigDiag.h"
-#include "UDPWrapper.h"
-
-#include "Common.h"
-#include "ControllerEmu.h"
-#include "IniFile.h"
-#include "WxUtils.h"
-
#include <string>
+#include "Common/Common.h"
+#include "Common/IniFile.h"
+#include "DolphinWX/UDPConfigDiag.h"
+#include "DolphinWX/WxUtils.h"
+#include "InputCommon/ControllerEmu.h"
+#include "InputCommon/UDPWrapper.h"
+
UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
wxDialog(parent, -1, _("UDP Wiimote"), wxDefaultPosition, wxDefaultSize),
wrp(_wrp)
diff --git a/Source/Core/DolphinWX/UDPConfigDiag.h b/Source/Core/DolphinWX/UDPConfigDiag.h
index 3c495c0..97d5f04 100644
--- a/Source/Core/DolphinWX/UDPConfigDiag.h
+++ b/Source/Core/DolphinWX/UDPConfigDiag.h
@@ -1,17 +1,17 @@
#pragma once
-#include "UDPWrapper.h"
-
-#include <wx/wx.h>
-#include <wx/listbox.h>
-#include <wx/textctrl.h>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/combobox.h>
#include <wx/checkbox.h>
+#include <wx/combobox.h>
+#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+#include <wx/wx.h>
+
+#include "InputCommon/UDPWrapper.h"
class UDPConfigDiag : public wxDialog
{
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp
index d8af788..dfd958c 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp
@@ -1,11 +1,11 @@
-#include "VideoConfigDiag.h"
+#include <wx/intl.h>
-#include "FileUtil.h"
-#include "TextureCacheBase.h"
-#include "Core.h"
-#include "Frame.h"
+#include "Common/FileUtil.h"
+#include "Core/Core.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/VideoConfigDiag.h"
+#include "VideoCommon/TextureCacheBase.h"
-#include <wx/intl.h>
#ifdef __APPLE__
#include <ApplicationServices/ApplicationServices.h>
@@ -489,7 +489,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5);
group_xfb->Add(real_xfb, 0, wxRIGHT, 5);
szr_hacks->Add(group_xfb, 0, wxEXPAND | wxALL, 5);
- } // xfb
+ } // xfb
// - other hacks
{
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h
index f2cc9d3..fca4e13 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.h
+++ b/Source/Core/DolphinWX/VideoConfigDiag.h
@@ -1,25 +1,23 @@
#pragma once
-#include <vector>
-#include <string>
#include <map>
-
-#include "ConfigManager.h"
-#include "VideoConfig.h"
-#include "Core.h"
-
-#include <wx/wx.h>
-#include <wx/textctrl.h>
+#include <string>
+#include <vector>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/combobox.h>
#include <wx/checkbox.h>
+#include <wx/combobox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+#include <wx/wx.h>
-#include "MsgHandler.h"
-#include "WxUtils.h"
+#include "Common/MsgHandler.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "DolphinWX/WxUtils.h"
+#include "VideoCommon/VideoConfig.h"
template <typename W>
class BoolSetting : public W
diff --git a/Source/Core/DolphinWX/WXInputBase.cpp b/Source/Core/DolphinWX/WXInputBase.cpp
index fc05479..22a1d5f 100644
--- a/Source/Core/DolphinWX/WXInputBase.cpp
+++ b/Source/Core/DolphinWX/WXInputBase.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "WXInputBase.h"
+#include "DolphinWX/WXInputBase.h"
namespace InputCommon
{
@@ -11,119 +11,120 @@ const wxString WXKeyToString(int keycode)
{
switch (keycode)
{
- case WXK_BACK: return _("Back");
- case WXK_TAB: return _("Tab");
- case WXK_RETURN: return _("Return");
- case WXK_ESCAPE: return _("Escape");
- case WXK_SPACE: return _("Space");
- case WXK_DELETE: return _("Delete");
+ case WXK_BACK: return _("Back");
+ case WXK_TAB: return _("Tab");
+ case WXK_RETURN: return _("Return");
+ case WXK_ESCAPE: return _("Escape");
+ case WXK_SPACE: return _("Space");
+ case WXK_DELETE: return _("Delete");
// Undocumented wx keycodes
- case 167: return _("Paragraph");
- case 177: return _("Plus-Minus");
+ case 167: return _("Paragraph");
+ case 177: return _("Plus-Minus");
- case WXK_START: return _("Start");
- case WXK_LBUTTON: return _("L Button");
- case WXK_RBUTTON: return _("R Button");
- case WXK_CANCEL: return _("Cancel");
- case WXK_MBUTTON: return _("M Button");
- case WXK_CLEAR: return _("Clear");
- case WXK_SHIFT: return wxT("Shift");
- case WXK_ALT: return wxT("Alt");
- case WXK_RAW_CONTROL: return _("Control");
+ case WXK_START: return _("Start");
+ case WXK_LBUTTON: return _("L Button");
+ case WXK_RBUTTON: return _("R Button");
+ case WXK_CANCEL: return _("Cancel");
+ case WXK_MBUTTON: return _("M Button");
+ case WXK_CLEAR: return _("Clear");
+ case WXK_SHIFT: return wxT("Shift");
+ case WXK_ALT: return wxT("Alt");
+ case WXK_RAW_CONTROL: return _("Control");
#ifdef __WXOSX__
- case WXK_COMMAND: return _("Command");
+ case WXK_COMMAND: return _("Command");
#endif
- case WXK_MENU: return _("Menu");
- case WXK_PAUSE: return _("Pause");
- case WXK_CAPITAL: return _("Caps Lock");
- case WXK_END: return _("End");
- case WXK_HOME: return _("Home");
- case WXK_LEFT: return _("Left");
- case WXK_UP: return _("Up");
- case WXK_RIGHT: return _("Right");
- case WXK_DOWN: return _("Down");
- case WXK_SELECT: return _("Select");
- case WXK_PRINT: return _("Print");
- case WXK_EXECUTE: return _("Execute");
- case WXK_SNAPSHOT: return _("Snapshot");
- case WXK_INSERT: return _("Insert");
- case WXK_HELP: return _("Help");
- case WXK_NUMPAD0: return wxT("NP 0");
- case WXK_NUMPAD1: return wxT("NP 1");
- case WXK_NUMPAD2: return wxT("NP 2");
- case WXK_NUMPAD3: return wxT("NP 3");
- case WXK_NUMPAD4: return wxT("NP 4");
- case WXK_NUMPAD5: return wxT("NP 5");
- case WXK_NUMPAD6: return wxT("NP 6");
- case WXK_NUMPAD7: return wxT("NP 7");
- case WXK_NUMPAD8: return wxT("NP 8");
- case WXK_NUMPAD9: return wxT("NP 9");
- case WXK_MULTIPLY: return _("Multiply");
- case WXK_ADD: return _("Add");
- case WXK_SEPARATOR: return _("Separator");
- case WXK_SUBTRACT: return _("Subtract");
- case WXK_DECIMAL: return _("Decimal");
- case WXK_DIVIDE: return _("Divide");
- case WXK_F1: return wxT("F1");
- case WXK_F2: return wxT("F2");
- case WXK_F3: return wxT("F3");
- case WXK_F4: return wxT("F4");
- case WXK_F5: return wxT("F5");
- case WXK_F6: return wxT("F6");
- case WXK_F7: return wxT("F7");
- case WXK_F8: return wxT("F8");
- case WXK_F9: return wxT("F9");
- case WXK_F10: return wxT("F10");
- case WXK_F11: return wxT("F11");
- case WXK_F12: return wxT("F12");
- case WXK_F13: return wxT("F13");
- case WXK_F14: return wxT("F14");
- case WXK_F15: return wxT("F15");
- case WXK_F16: return wxT("F16");
- case WXK_F17: return wxT("F17");
- case WXK_F18: return wxT("F19");
- case WXK_F19: return wxT("F20");
- case WXK_F20: return wxT("F21");
- case WXK_F21: return wxT("F22");
- case WXK_F22: return wxT("F23");
- case WXK_F23: return wxT("F24");
- case WXK_F24: return wxT("F25");
- case WXK_NUMLOCK: return _("Num Lock");
- case WXK_SCROLL: return _("Scroll Lock");
- case WXK_PAGEUP: return _("Page Up");
- case WXK_PAGEDOWN: return _("Page Down");
- case WXK_NUMPAD_SPACE: return _("NP Space");
- case WXK_NUMPAD_TAB: return _("NP Tab");
- case WXK_NUMPAD_ENTER: return _("NP Enter");
- case WXK_NUMPAD_F1: return wxT("NP F1");
- case WXK_NUMPAD_F2: return wxT("NP F2");
- case WXK_NUMPAD_F3: return wxT("NP F3");
- case WXK_NUMPAD_F4: return wxT("NP F4");
- case WXK_NUMPAD_HOME: return _("NP Home");
- case WXK_NUMPAD_LEFT: return _("NP Left");
- case WXK_NUMPAD_UP: return _("NP Up");
- case WXK_NUMPAD_RIGHT: return _("NP Right");
- case WXK_NUMPAD_DOWN: return _("NP Down");
- case WXK_NUMPAD_PAGEUP: return _("NP Page Up");
- case WXK_NUMPAD_PAGEDOWN: return _("NP Page Down");
- case WXK_NUMPAD_END: return _("NP End");
- case WXK_NUMPAD_BEGIN: return _("NP Begin");
- case WXK_NUMPAD_INSERT: return _("NP Insert");
- case WXK_NUMPAD_DELETE: return _("NP Delete");
- case WXK_NUMPAD_EQUAL: return _("NP Equal");
- case WXK_NUMPAD_MULTIPLY: return _("NP Multiply");
- case WXK_NUMPAD_ADD: return _("NP Add");
- case WXK_NUMPAD_SEPARATOR: return _("NP Separator");
- case WXK_NUMPAD_SUBTRACT: return _("NP Subtract");
- case WXK_NUMPAD_DECIMAL: return _("NP Decimal");
- case WXK_NUMPAD_DIVIDE: return _("NP Divide");
- case WXK_WINDOWS_LEFT: return _("Windows Left");
- case WXK_WINDOWS_RIGHT: return _("Windows Right");
- case WXK_WINDOWS_MENU: return _("Windows Menu");
+ case WXK_MENU: return _("Menu");
+ case WXK_PAUSE: return _("Pause");
+ case WXK_CAPITAL: return _("Caps Lock");
+ case WXK_END: return _("End");
+ case WXK_HOME: return _("Home");
+ case WXK_LEFT: return _("Left");
+ case WXK_UP: return _("Up");
+ case WXK_RIGHT: return _("Right");
+ case WXK_DOWN: return _("Down");
+ case WXK_SELECT: return _("Select");
+ case WXK_PRINT: return _("Print");
+ case WXK_EXECUTE: return _("Execute");
+ case WXK_SNAPSHOT: return _("Snapshot");
+ case WXK_INSERT: return _("Insert");
+ case WXK_HELP: return _("Help");
+ case WXK_NUMPAD0: return wxT("NP 0");
+ case WXK_NUMPAD1: return wxT("NP 1");
+ case WXK_NUMPAD2: return wxT("NP 2");
+ case WXK_NUMPAD3: return wxT("NP 3");
+ case WXK_NUMPAD4: return wxT("NP 4");
+ case WXK_NUMPAD5: return wxT("NP 5");
+ case WXK_NUMPAD6: return wxT("NP 6");
+ case WXK_NUMPAD7: return wxT("NP 7");
+ case WXK_NUMPAD8: return wxT("NP 8");
+ case WXK_NUMPAD9: return wxT("NP 9");
+ case WXK_MULTIPLY: return _("Multiply");
+ case WXK_ADD: return _("Add");
+ case WXK_SEPARATOR: return _("Separator");
+ case WXK_SUBTRACT: return _("Subtract");
+ case WXK_DECIMAL: return _("Decimal");
+ case WXK_DIVIDE: return _("Divide");
+ case WXK_F1: return wxT("F1");
+ case WXK_F2: return wxT("F2");
+ case WXK_F3: return wxT("F3");
+ case WXK_F4: return wxT("F4");
+ case WXK_F5: return wxT("F5");
+ case WXK_F6: return wxT("F6");
+ case WXK_F7: return wxT("F7");
+ case WXK_F8: return wxT("F8");
+ case WXK_F9: return wxT("F9");
+ case WXK_F10: return wxT("F10");
+ case WXK_F11: return wxT("F11");
+ case WXK_F12: return wxT("F12");
+ case WXK_F13: return wxT("F13");
+ case WXK_F14: return wxT("F14");
+ case WXK_F15: return wxT("F15");
+ case WXK_F16: return wxT("F16");
+ case WXK_F17: return wxT("F17");
+ case WXK_F18: return wxT("F19");
+ case WXK_F19: return wxT("F20");
+ case WXK_F20: return wxT("F21");
+ case WXK_F21: return wxT("F22");
+ case WXK_F22: return wxT("F23");
+ case WXK_F23: return wxT("F24");
+ case WXK_F24: return wxT("F25");
+ case WXK_NUMLOCK: return _("Num Lock");
+ case WXK_SCROLL: return _("Scroll Lock");
+ case WXK_PAGEUP: return _("Page Up");
+ case WXK_PAGEDOWN: return _("Page Down");
+ case WXK_NUMPAD_SPACE: return _("NP Space");
+ case WXK_NUMPAD_TAB: return _("NP Tab");
+ case WXK_NUMPAD_ENTER: return _("NP Enter");
+ case WXK_NUMPAD_F1: return wxT("NP F1");
+ case WXK_NUMPAD_F2: return wxT("NP F2");
+ case WXK_NUMPAD_F3: return wxT("NP F3");
+ case WXK_NUMPAD_F4: return wxT("NP F4");
+ case WXK_NUMPAD_HOME: return _("NP Home");
+ case WXK_NUMPAD_LEFT: return _("NP Left");
+ case WXK_NUMPAD_UP: return _("NP Up");
+ case WXK_NUMPAD_RIGHT: return _("NP Right");
+ case WXK_NUMPAD_DOWN: return _("NP Down");
+ case WXK_NUMPAD_PAGEUP: return _("NP Page Up");
+ case WXK_NUMPAD_PAGEDOWN: return _("NP Page Down");
+ case WXK_NUMPAD_END: return _("NP End");
+ case WXK_NUMPAD_BEGIN: return _("NP Begin");
+ case WXK_NUMPAD_INSERT: return _("NP Insert");
+ case WXK_NUMPAD_DELETE: return _("NP Delete");
+ case WXK_NUMPAD_EQUAL: return _("NP Equal");
+ case WXK_NUMPAD_MULTIPLY: return _("NP Multiply");
+ case WXK_NUMPAD_ADD: return _("NP Add");
+ case WXK_NUMPAD_SEPARATOR: return _("NP Separator");
+ case WXK_NUMPAD_SUBTRACT: return _("NP Subtract");
+ case WXK_NUMPAD_DECIMAL: return _("NP Decimal");
+ case WXK_NUMPAD_DIVIDE: return _("NP Divide");
+ case WXK_WINDOWS_LEFT: return _("Windows Left");
+ case WXK_WINDOWS_RIGHT: return _("Windows Right");
+ case WXK_WINDOWS_MENU: return _("Windows Menu");
}
- if (keycode > WXK_SPACE && keycode < WXK_DELETE) {
+ if (keycode > WXK_SPACE && keycode < WXK_DELETE)
+ {
return wxString((wxChar)keycode, 1);
}
diff --git a/Source/Core/DolphinWX/WXInputBase.h b/Source/Core/DolphinWX/WXInputBase.h
index 704bc02..d47e2f3 100644
--- a/Source/Core/DolphinWX/WXInputBase.h
+++ b/Source/Core/DolphinWX/WXInputBase.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
#if defined(HAVE_WX) && HAVE_WX
#include <wx/wx.h>
#endif
diff --git a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/WiimoteConfigDiag.cpp
index 0dff321..2de3bf0 100644
--- a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp
+++ b/Source/Core/DolphinWX/WiimoteConfigDiag.cpp
@@ -1,9 +1,8 @@
-
-#include "WiimoteConfigDiag.h"
-#include "HW/Wiimote.h"
-#include "HW/WiimoteReal/WiimoteReal.h"
-#include "Frame.h"
-#include "NetPlayProto.h"
+#include "Core/NetPlayProto.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "DolphinWX/Frame.h"
+#include "DolphinWX/WiimoteConfigDiag.h"
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin)
: wxDialog(parent, -1, _("Dolphin Wiimote Configuration"), wxDefaultPosition, wxDefaultSize)
diff --git a/Source/Core/DolphinWX/WiimoteConfigDiag.h b/Source/Core/DolphinWX/WiimoteConfigDiag.h
index 9329c57..5ae4d88 100644
--- a/Source/Core/DolphinWX/WiimoteConfigDiag.h
+++ b/Source/Core/DolphinWX/WiimoteConfigDiag.h
@@ -1,21 +1,20 @@
#pragma once
-#include <wx/wx.h>
-#include <wx/listbox.h>
-#include <wx/textctrl.h>
+#include <map>
#include <wx/button.h>
-#include <wx/stattext.h>
-#include <wx/combobox.h>
#include <wx/checkbox.h>
+#include <wx/combobox.h>
+#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+#include <wx/wx.h>
-#include "InputConfigDiag.h"
-#include "ConfigManager.h"
-#include <HW/Wiimote.h>
-
-#include <map>
+#include "Core/ConfigManager.h"
+#include "Core/HW/Wiimote.h"
+#include "DolphinWX/InputConfigDiag.h"
class WiimoteConfigDiag : public wxDialog
{
@@ -65,7 +64,7 @@ public:
private:
void Cancel(wxCommandEvent& event);
- InputPlugin& m_plugin;
+ InputPlugin& m_plugin;
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
diff --git a/Source/Core/DolphinWX/WxUtils.cpp b/Source/Core/DolphinWX/WxUtils.cpp
index 617e329..a7ad6d4 100644
--- a/Source/Core/DolphinWX/WxUtils.cpp
+++ b/Source/Core/DolphinWX/WxUtils.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include <wx/wx.h>
#include <wx/string.h>
+#include <wx/wx.h>
-#include "WxUtils.h"
+#include "Common/Common.h"
+#include "DolphinWX/WxUtils.h"
#ifdef __APPLE__
#import <AppKit/AppKit.h>
diff --git a/Source/Core/DolphinWX/X11Utils.cpp b/Source/Core/DolphinWX/X11Utils.cpp
index 71f0e43..8b9971d 100644
--- a/Source/Core/DolphinWX/X11Utils.cpp
+++ b/Source/Core/DolphinWX/X11Utils.cpp
@@ -1,32 +1,20 @@
-// Copyright (C) 2003 Dolphin Project.
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "X11Utils.h"
-
-#include <unistd.h>
#include <spawn.h>
+#include <unistd.h>
#include <sys/wait.h>
+#include "DolphinWX/X11Utils.h"
+
extern char **environ;
#if defined(HAVE_WX) && HAVE_WX
-#include <string>
#include <algorithm>
-#include "WxUtils.h"
+#include <string>
+
+#include "DolphinWX/WxUtils.h"
#endif
namespace X11Utils
diff --git a/Source/Core/DolphinWX/X11Utils.h b/Source/Core/DolphinWX/X11Utils.h
index 27c0442..8139e26 100644
--- a/Source/Core/DolphinWX/X11Utils.h
+++ b/Source/Core/DolphinWX/X11Utils.h
@@ -4,21 +4,29 @@
#pragma once
-#include "Common.h"
+// HACK: Xlib.h (included from gtk/gdk headers and directly) uses #defines on
+// common names such as "Status", "BadRequest" or "Response", causing SFML
+// headers to be completely broken.
+//
+// We work around that issue by including SFML first before X11 headers. This
+// is terrible, but such is the life with Xlib.
+#include <SFML/Network.hpp> // NOLINT
#if defined(HAVE_WX) && HAVE_WX
-#include <wx/wx.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#include <wx/wx.h>
#endif
-#include <X11/Xlib.h>
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
+#include <X11/Xlib.h>
+
+#include "Common/Common.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
-#include "Core.h"
-#include "ConfigManager.h"
// EWMH state actions, see
// http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
diff --git a/Source/Core/DolphinWX/stdafx.cpp b/Source/Core/DolphinWX/stdafx.cpp
index b602b39..accdd5e 100644
--- a/Source/Core/DolphinWX/stdafx.cpp
+++ b/Source/Core/DolphinWX/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "DolphinWX/stdafx.h"
diff --git a/Source/Core/InputCommon/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu.cpp
index 8224e81..34b8695 100644
--- a/Source/Core/InputCommon/ControllerEmu.cpp
+++ b/Source/Core/InputCommon/ControllerEmu.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ControllerEmu.h"
+#include "InputCommon/ControllerEmu.h"
#if defined(HAVE_X11) && HAVE_X11
#include <X11/Xlib.h>
diff --git a/Source/Core/InputCommon/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu.h
index e7ccabd..9f8f2db 100644
--- a/Source/Core/InputCommon/ControllerEmu.h
+++ b/Source/Core/InputCommon/ControllerEmu.h
@@ -7,16 +7,15 @@
// windows crap
#define NOMINMAX
+#include <algorithm>
#include <cmath>
#include <memory>
-#include <vector>
#include <string>
-#include <algorithm>
-
-#include "GCPadStatus.h"
+#include <vector>
-#include "ControllerInterface/ControllerInterface.h"
-#include "IniFile.h"
+#include "Common/IniFile.h"
+#include "InputCommon/GCPadStatus.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
#define sign(x) ((x)?(x)<0?-1:1:0)
diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp
index 6ad7b13..fa97e8f 100644
--- a/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Android.h"
+#include "InputCommon/ControllerInterface/Android/Android.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/Android/Android.h b/Source/Core/InputCommon/ControllerInterface/Android/Android.h
index 992bec8..aea09ac 100644
--- a/Source/Core/InputCommon/ControllerInterface/Android/Android.h
+++ b/Source/Core/InputCommon/ControllerInterface/Android/Android.h
@@ -4,8 +4,8 @@
#pragma once
-#include "../Device.h"
-#include "Android/ButtonManager.h"
+#include "DolphinWX/Android/ButtonManager.h"
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index f1e2136..7153a8d 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -2,36 +2,35 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ControllerInterface.h"
+#include "Common/Thread.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
#if USE_EGL
-#include "GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
#endif
#ifdef CIFACE_USE_XINPUT
- #include "XInput/XInput.h"
+ #include "InputCommon/ControllerInterface/XInput/XInput.h"
#endif
#ifdef CIFACE_USE_DINPUT
- #include "DInput/DInput.h"
+ #include "InputCommon/ControllerInterface/DInput/DInput.h"
#endif
#ifdef CIFACE_USE_XLIB
- #include "Xlib/Xlib.h"
+ #include "InputCommon/ControllerInterface/Xlib/Xlib.h"
#ifdef CIFACE_USE_X11_XINPUT2
- #include "Xlib/XInput2.h"
+ #include "InputCommon/ControllerInterface/Xlib/XInput2.h"
#endif
#endif
#ifdef CIFACE_USE_OSX
- #include "OSX/OSX.h"
+ #include "InputCommon/ControllerInterface/OSX/OSX.h"
#endif
#ifdef CIFACE_USE_SDL
- #include "SDL/SDL.h"
+ #include "InputCommon/ControllerInterface/SDL/SDL.h"
#endif
#ifdef CIFACE_USE_ANDROID
- #include "Android/Android.h"
+ #include "InputCommon/ControllerInterface/Android/Android.h"
#endif
-#include "Thread.h"
-
using namespace ciface::ExpressionParser;
namespace
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
index b63ee9f..affabaf 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
@@ -4,16 +4,16 @@
#pragma once
-#include <vector>
-#include <string>
-#include <sstream>
-#include <map>
#include <algorithm>
+#include <map>
+#include <sstream>
+#include <string>
+#include <vector>
-#include "Common.h"
-#include "Thread.h"
-#include "ExpressionParser.h"
-#include "Device.h"
+#include "Common/Common.h"
+#include "Common/Thread.h"
+#include "InputCommon/ControllerInterface/Device.h"
+#include "InputCommon/ControllerInterface/ExpressionParser.h"
// enable disable sources
#ifdef _WIN32
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
index 7f10781..f2d2460 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DInput.h"
+#include "Common/StringUtil.h"
-#include "StringUtil.h"
+#include "InputCommon/ControllerInterface/DInput/DInput.h"
-#include "DInputJoystick.h"
-#include "DInputKeyboardMouse.h"
+#include "InputCommon/ControllerInterface/DInput/DInputJoystick.h"
+#include "InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h"
#pragma comment(lib, "Dinput8.lib")
#pragma comment(lib, "dxguid.lib")
@@ -17,12 +17,6 @@ namespace ciface
namespace DInput
{
-//BOOL CALLBACK DIEnumEffectsCallback(LPCDIEFFECTINFO pdei, LPVOID pvRef)
-//{
-// ((std::list<DIEFFECTINFO>*)pvRef)->push_back(*pdei);
-// return DIENUM_CONTINUE;
-//}
-
BOOL CALLBACK DIEnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
{
((std::list<DIDEVICEOBJECTINSTANCE>*)pvRef)->push_back(*lpddoi);
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h
index 939f9d6..b4f1b27 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h
@@ -4,17 +4,16 @@
#pragma once
-#include "../Device.h"
-
#define DINPUT_SOURCE_NAME "DInput"
#define DIRECTINPUT_VERSION 0x0800
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
-#include <Windows.h>
#include <dinput.h>
-
#include <list>
+#include <windows.h>
+
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
index 8b11bb1..b524f1f 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
@@ -2,22 +2,21 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DInputJoystick.h"
-#include "DInput.h"
-
+#include <algorithm>
#include <map>
+#include <oleauto.h>
#include <sstream>
-#include <algorithm>
-
#include <wbemidl.h>
-#include <oleauto.h>
+
+#include "InputCommon/ControllerInterface/DInput/DInput.h"
+#include "InputCommon/ControllerInterface/DInput/DInputJoystick.h"
namespace ciface
{
namespace DInput
{
-#define DATA_BUFFER_SIZE 32
+#define DATA_BUFFER_SIZE 32
//-----------------------------------------------------------------------------
// Modified some MSDN code to get all the XInput device GUID.Data1 values in a vector,
@@ -130,7 +129,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices
// this is used to number the joysticks
// multiple joysticks with the same name shall get unique ids starting at 0
- std::map< std::basic_string<TCHAR>, int> name_counts;
+ std::map< std::basic_string<TCHAR>, int> name_counts;
std::vector<DWORD> xinput_guids;
GetXInputGUIDS( xinput_guids );
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
index 045a8fe..0ac535c 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
@@ -4,8 +4,8 @@
#pragma once
-#include "../Device.h"
-#include "../ForceFeedback/ForceFeedbackDevice.h"
+#include "InputCommon/ControllerInterface/Device.h"
+#include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
index c79f4e3..c9dd903 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
@@ -2,8 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DInputKeyboardMouse.h"
-#include "DInput.h"
+#include <algorithm>
+
+#include "InputCommon/ControllerInterface/DInput/DInput.h"
+#include "InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h"
// (lower would be more sensitive) user can lower sensitivity by setting range
// seems decent here ( at 8 ), I don't think anyone would need more sensitive than this
@@ -25,7 +27,7 @@ static const struct
const char* const name;
} named_keys[] =
{
-#include "NamedKeys.h"
+#include "InputCommon/ControllerInterface/DInput/NamedKeys.h" // NOLINT
};
static const struct
@@ -218,12 +220,12 @@ bool KeyboardMouse::UpdateOutput()
{
bool want_on = false;
if (m_state_out[i])
- want_on = m_state_out[i] > GetTickCount() % 255 ; // light should flash when output is 0.5
+ want_on = m_state_out[i] > GetTickCount() % 255 ; // light should flash when output is 0.5
// lights are set to their original state when output is zero
if (want_on ^ m_current_state_out[i])
{
- kbinputs.push_back(KInput(named_lights[i].code)); // press
+ kbinputs.push_back(KInput(named_lights[i].code)); // press
kbinputs.push_back(KInput(named_lights[i].code, true)); // release
m_current_state_out[i] ^= 1;
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
index aeeacca..558917e 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
@@ -4,13 +4,13 @@
#pragma once
-#include "../Device.h"
-
#define DIRECTINPUT_VERSION 0x0800
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
-#include <Windows.h>
#include <dinput.h>
+#include <windows.h>
+
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp
index 1b402e9..295fc10 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Device.h"
-
-#include <string>
#include <sstream>
+#include <string>
+
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h
index f61099f..8b4dc65 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.h
+++ b/Source/Core/InputCommon/ControllerInterface/Device.h
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include "Common.h"
+#include "Common/Common.h"
// idk in case I wanted to change it to double or something, idk what's best
typedef float ControlState;
diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
index 802d1b8..4e2f49f 100644
--- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ExpressionParser.h"
-
+#include <algorithm>
#include <cassert>
#include <iostream>
-#include <string>
#include <map>
+#include <string>
#include <vector>
+#include "InputCommon/ControllerInterface/ExpressionParser.h"
+
using namespace ciface::Core;
namespace ciface
diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h
index deab168..18f972c 100644
--- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h
+++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h
@@ -5,7 +5,7 @@
#pragma once
#include <string>
-#include "Device.h"
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp
index 0c4f026..7a4dfda 100644
--- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ForceFeedbackDevice.h"
+#include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
namespace ciface
{
@@ -61,7 +61,7 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i
memset(&eff, 0, sizeof(eff));
eff.dwSize = sizeof(DIEFFECT);
eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
- eff.dwDuration = INFINITE; // (4 * DI_SECONDS)
+ eff.dwDuration = INFINITE; // (4 * DI_SECONDS)
eff.dwSamplePeriod = 0;
eff.dwGain = DI_FFNOMINALMAX;
eff.dwTriggerButton = DIEB_NOTRIGGER;
@@ -175,7 +175,7 @@ void ForceFeedbackDevice::ForceConstant::SetState(const ControlState state)
if (val != new_val)
{
val = new_val;
- m_state.params = ¶ms; // tells UpdateOutput the state has changed
+ m_state.params = ¶ms; // tells UpdateOutput the state has changed
// tells UpdateOutput to either start or stop the force
m_state.size = new_val ? sizeof(params) : 0;
@@ -190,7 +190,7 @@ void ForceFeedbackDevice::ForceRamp::SetState(const ControlState state)
if (params.lStart != new_val)
{
params.lStart = params.lEnd = new_val;
- m_state.params = ¶ms; // tells UpdateOutput the state has changed
+ m_state.params = ¶ms; // tells UpdateOutput the state has changed
// tells UpdateOutput to either start or stop the force
m_state.size = new_val ? sizeof(params) : 0;
@@ -206,9 +206,9 @@ void ForceFeedbackDevice::ForcePeriodic::SetState(const ControlState state)
if (val != new_val)
{
val = new_val;
- //params.dwPeriod = 0;//DWORD(0.05 * DI_SECONDS); // zero is working fine for me
+ //params.dwPeriod = 0;//DWORD(0.05 * DI_SECONDS); // zero is working fine for me
- m_state.params = ¶ms; // tells UpdateOutput the state has changed
+ m_state.params = ¶ms; // tells UpdateOutput the state has changed
// tells UpdateOutput to either start or stop the force
m_state.size = new_val ? sizeof(params) : 0;
diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h
index 8eea274..9ef5873 100644
--- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h
+++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h
@@ -4,7 +4,9 @@
#pragma once
-#include "../Device.h"
+#include <list>
+
+#include "InputCommon/ControllerInterface/Device.h"
#ifdef _WIN32
#define DIRECTINPUT_VERSION 0x0800
@@ -13,11 +15,9 @@
#include <Windows.h>
#include <dinput.h>
#elif __APPLE__
-#include "OSX/DirectInputAdapter.h"
+#include "InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h"
#endif
-#include <list>
-
namespace ciface
{
namespace ForceFeedback
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h
index 4217ae0..95e685c 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h
@@ -4,7 +4,7 @@
#pragma once
-#include "../Device.h"
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm
index 93100a9..50b568c 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm
@@ -6,9 +6,9 @@
#include <IOKit/hid/IOHIDLib.h>
#include <Cocoa/Cocoa.h>
-#include "OSX.h"
-#include "OSXKeyboard.h"
-#include "OSXJoystick.h"
+#include "InputCommon/ControllerInterface/OSX/OSX.h"
+#include "InputCommon/ControllerInterface/OSX/OSXKeyboard.h"
+#include "InputCommon/ControllerInterface/OSX/OSXJoystick.h"
#include <map>
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h
index 72087f8..ffbe475 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h
@@ -6,8 +6,8 @@
#include <IOKit/hid/IOHIDLib.h>
-#include "../Device.h"
-#include "../ForceFeedback/ForceFeedbackDevice.h"
+#include "InputCommon/ControllerInterface/Device.h"
+#include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
namespace ciface
{
@@ -25,33 +25,36 @@ private:
: m_element(element), m_device(device) {}
ControlState GetState() const;
private:
- const IOHIDElementRef m_element;
- const IOHIDDeviceRef m_device;
+ const IOHIDElementRef m_element;
+ const IOHIDDeviceRef m_device;
};
class Axis : public Input
{
public:
- enum direction {
+ enum direction
+ {
positive = 0,
negative
};
std::string GetName() const;
Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction dir);
ControlState GetState() const;
+
private:
- const IOHIDElementRef m_element;
- const IOHIDDeviceRef m_device;
- std::string m_name;
- const direction m_direction;
- float m_neutral;
- float m_scale;
+ const IOHIDElementRef m_element;
+ const IOHIDDeviceRef m_device;
+ std::string m_name;
+ const direction m_direction;
+ float m_neutral;
+ float m_scale;
};
class Hat : public Input
{
public:
- enum direction {
+ enum direction
+ {
up = 0,
right,
down,
@@ -60,11 +63,12 @@ private:
std::string GetName() const;
Hat(IOHIDElementRef element, IOHIDDeviceRef device, direction dir);
ControlState GetState() const;
+
private:
- const IOHIDElementRef m_element;
- const IOHIDDeviceRef m_device;
- const char* m_name;
- const direction m_direction;
+ const IOHIDElementRef m_element;
+ const IOHIDDeviceRef m_device;
+ const char* m_name;
+ const direction m_direction;
};
public:
@@ -78,9 +82,9 @@ public:
int GetId() const;
private:
- const IOHIDDeviceRef m_device;
- const std::string m_device_name;
- const int m_index;
+ const IOHIDDeviceRef m_device;
+ const std::string m_device_name;
+ const int m_index;
ForceFeedback::FFDeviceAdapterReference m_ff_device;
};
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm
index dbf5bef..6e0623e 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <sstream>
+
#include <Foundation/Foundation.h>
#include <IOKit/hid/IOHIDLib.h>
-#include "OSXJoystick.h"
-
-#include <sstream>
+#include "InputCommon/ControllerInterface/OSX/OSXJoystick.h"
namespace ciface
{
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h
index b18113b..3670507 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h
@@ -6,7 +6,7 @@
#include <IOKit/hid/IOHIDLib.h>
-#include "../Device.h"
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
@@ -23,10 +23,11 @@ private:
Key(IOHIDElementRef element, IOHIDDeviceRef device);
ControlState GetState() const;
private:
- const IOHIDElementRef m_element;
- const IOHIDDeviceRef m_device;
- std::string m_name;
+ const IOHIDElementRef m_element;
+ const IOHIDDeviceRef m_device;
+ std::string m_name;
};
+
class Cursor : public Input
{
public:
@@ -36,9 +37,10 @@ private:
ControlState GetState() const;
private:
const float& m_axis;
- const u8 m_index;
- const bool m_positive;
+ const u8 m_index;
+ const bool m_positive;
};
+
class Button : public Input
{
public:
@@ -66,11 +68,11 @@ private:
float x, y;
} m_cursor;
- const IOHIDDeviceRef m_device;
- const std::string m_device_name;
- int m_index;
- uint32_t m_windowid;
- unsigned char m_mousebuttons[3];
+ const IOHIDDeviceRef m_device;
+ const std::string m_device_name;
+ int m_index;
+ uint32_t m_windowid;
+ unsigned char m_mousebuttons[3];
};
}
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm
index 9fb832c..fc784b8 100644
--- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm
+++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm
@@ -2,14 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <sstream>
+
#include <Foundation/Foundation.h>
#include <IOKit/hid/IOHIDLib.h>
#include <Cocoa/Cocoa.h>
#include <wx/wx.h> // wxWidgets
-#include "OSXKeyboard.h"
-
-#include <sstream>
+#include "InputCommon/ControllerInterface/OSX/OSXKeyboard.h"
namespace ciface
{
@@ -117,8 +117,8 @@ Keyboard::Key::Key(IOHIDElementRef element, IOHIDDeviceRef device)
, m_device(device)
{
static const struct PrettyKeys {
- const uint32_t code;
- const char *const name;
+ const uint32_t code;
+ const char *const name;
} named_keys[] = {
{ kHIDUsage_KeyboardA, "A" },
{ kHIDUsage_KeyboardB, "B" },
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
index c4cdae7..64c012c 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SDL.h"
-#include <StringUtil.h>
-
+#include <algorithm>
#include <map>
#include <sstream>
-#include <algorithm>
+
+#include "Common/StringUtil.h"
+#include "InputCommon/ControllerInterface/SDL/SDL.h"
#ifdef _WIN32
#pragma comment(lib, "SDL2.lib")
@@ -31,7 +31,7 @@ void Init( std::vector<Core::Device*>& devices )
{
// this is used to number the joysticks
// multiple joysticks with the same name shall get unique ids starting at 0
- std::map<std::string, int> name_counts;
+ std::map<std::string, int> name_counts;
if (SDL_Init( SDL_INIT_FLAGS ) >= 0)
{
@@ -319,29 +319,29 @@ bool Joystick::UpdateOutput()
#ifdef USE_SDL_HAPTIC
for (auto &i : m_state_out)
{
- if (i.changed) // if SetState was called on this output
+ if (i.changed) // if SetState was called on this output
{
- if (-1 == i.id) // effect isn't currently uploaded
+ if (-1 == i.id) // effect isn't currently uploaded
{
- if (i.effect.type) // if outputstate is >0 this would be true
+ if (i.effect.type) // if outputstate is >0 this would be true
{
- if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect
+ if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect
{
- SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect
+ SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect
}
}
}
- else // effect is already uploaded
+ else // effect is already uploaded
{
- if (i.effect.type) // if ouputstate >0
+ if (i.effect.type) // if ouputstate >0
{
- SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect
+ SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect
}
else
{
- SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect
+ SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect
SDL_HapticDestroyEffect(m_haptic, i.id);
- i.id = -1; // mark it as not uploaded
+ i.id = -1; // mark it as not uploaded
}
}
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h
index 2d0c1c2..15f3999 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h
@@ -4,21 +4,22 @@
#pragma once
-#include "../Device.h"
-
#include <list>
#include <SDL.h>
+#include "InputCommon/ControllerInterface/Device.h"
+
+
#if SDL_VERSION_ATLEAST(1, 3, 0)
#define USE_SDL_HAPTIC
#endif
#ifdef USE_SDL_HAPTIC
#include <SDL_haptic.h>
- #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC
+ #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC
#else
- #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK
+ #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK
#endif
namespace ciface
diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp
index 0aa639a..7574641 100644
--- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp
@@ -1,5 +1,5 @@
-#include "XInput.h"
+#include "InputCommon/ControllerInterface/XInput/XInput.h"
namespace ciface
{
@@ -121,7 +121,7 @@ Device::Device(const XINPUT_CAPABILITIES& caps, u8 index)
// get supported triggers
for (int i = 0; i != sizeof(named_triggers)/sizeof(*named_triggers); ++i)
{
- //BYTE val = (&caps.Gamepad.bLeftTrigger)[i]; // should be max value / MSDN lies
+ //BYTE val = (&caps.Gamepad.bLeftTrigger)[i]; // should be max value / MSDN lies
if ((&caps.Gamepad.bLeftTrigger)[i])
AddInput(new Trigger(i, (&m_state_in.Gamepad.bLeftTrigger)[i], 255 ));
}
@@ -143,7 +143,7 @@ Device::Device(const XINPUT_CAPABILITIES& caps, u8 index)
// get supported motors
for (int i = 0; i != sizeof(named_motors)/sizeof(*named_motors); ++i)
{
- //WORD val = (&caps.Vibration.wLeftMotorSpeed)[i]; // should be max value / nope, more lies
+ //WORD val = (&caps.Vibration.wLeftMotorSpeed)[i]; // should be max value / nope, more lies
if ((&caps.Vibration.wLeftMotorSpeed)[i])
AddOutput(new Motor(i, (&m_state_out.wLeftMotorSpeed)[i], 65535));
}
diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h
index 3970482..f3dc398 100644
--- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h
+++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h
@@ -5,12 +5,12 @@
#pragma once
-#include "../Device.h"
-
#define NOMINMAX
-#include <Windows.h>
+#include <windows.h>
#include <XInput.h>
+#include "InputCommon/ControllerInterface/Device.h"
+
#ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK
#error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path and/or _WIN32_WINNT is wrong.
#endif
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
index 23cadd3..802346b 100644
--- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp
@@ -2,10 +2,10 @@
// Licensed under the GNU General Public License, version 2 or higher.
// Refer to the license.txt file included.
-
-#include "XInput2.h"
-#include <X11/XKBlib.h>
#include <cmath>
+#include <X11/XKBlib.h>
+
+#include "InputCommon/ControllerInterface/Xlib/XInput2.h"
// This is an input plugin using the XInput 2.0 extension to the X11 protocol,
// loosely based on the old XLib plugin. (Has nothing to do with the XInput
@@ -30,7 +30,7 @@
// Mouse axis control output is simply divided by this number. In practice,
// that just means you can use a smaller "dead zone" if you bind axis controls
// to a joystick. No real need to make this customizable.
-#define MOUSE_AXIS_SENSITIVITY 8.0f
+#define MOUSE_AXIS_SENSITIVITY 8.0f
// The mouse axis controls use a weighted running average. Each frame, the new
// value is the average of the old value and the amount of relative mouse
@@ -38,7 +38,7 @@
// MOUSE_AXIS_SMOOTHING:1 compared to the new value. Increasing
// MOUSE_AXIS_SMOOTHING makes the controls smoother, decreasing it makes them
// more responsive. This might be useful as a user-customizable option.
-#define MOUSE_AXIS_SMOOTHING 1.5f
+#define MOUSE_AXIS_SMOOTHING 1.5f
namespace ciface
{
@@ -48,9 +48,7 @@ namespace XInput2
// This function will add zero or more KeyboardMouse objects to devices.
void Init(std::vector<Core::Device*>& devices, void* const hwnd)
{
- Display* dpy;
-
- dpy = XOpenDisplay(NULL);
+ Display* dpy = XOpenDisplay(NULL);
// xi_opcode is important; it will be used to identify XInput events by
// the polling loop in UpdateInput.
@@ -68,9 +66,9 @@ void Init(std::vector<Core::Device*>& devices, void* const hwnd)
// register all master devices with Dolphin
- XIDeviceInfo* all_masters;
- XIDeviceInfo* current_master;
- int num_masters;
+ XIDeviceInfo* all_masters;
+ XIDeviceInfo* current_master;
+ int num_masters;
all_masters = XIQueryDevice(dpy, XIAllMasterDevices, &num_masters);
@@ -94,7 +92,6 @@ void Init(std::vector<Core::Device*>& devices, void* const hwnd)
void KeyboardMouse::SelectEventsForDevice(Window window, XIEventMask *mask, int deviceid)
{
// Set the event mask for the master device.
-
mask->deviceid = deviceid;
XISelectEvents(m_display, window, mask, 1);
@@ -104,9 +101,9 @@ void KeyboardMouse::SelectEventsForDevice(Window window, XIEventMask *mask, int
// devices) emit those. For keyboard devices, selecting slaves avoids
// dealing with key focus.
- XIDeviceInfo* all_slaves;
- XIDeviceInfo* current_slave;
- int num_slaves;
+ XIDeviceInfo* all_slaves;
+ XIDeviceInfo* current_slave;
+ int num_slaves;
all_slaves = XIQueryDevice(m_display, XIAllDevices, &num_slaves);
@@ -142,8 +139,8 @@ KeyboardMouse::KeyboardMouse(Window window, int opcode, int pointer, int keyboar
name = std::string(pointer_device->name);
XIFreeDeviceInfo(pointer_device);
- XIEventMask mask;
- unsigned char mask_buf[(XI_LASTEVENT + 7)/8];
+ XIEventMask mask;
+ unsigned char mask_buf[(XI_LASTEVENT + 7)/8];
mask.mask_len = sizeof(mask_buf);
mask.mask = mask_buf;
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h
index b5bb844..2714b70 100644
--- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h
+++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h
@@ -6,14 +6,14 @@
#pragma once
-#include "../Device.h"
-
extern "C" {
+#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/extensions/XInput2.h>
-#include <X11/keysym.h>
}
+#include "InputCommon/ControllerInterface/Device.h"
+
namespace ciface
{
namespace XInput2
@@ -44,10 +44,10 @@ private:
ControlState GetState() const;
private:
- std::string m_keyname;
- Display* const m_display;
+ std::string m_keyname;
+ Display* const m_display;
const char* const m_keyboard;
- const KeyCode m_keycode;
+ const KeyCode m_keycode;
};
class Button : public Input
@@ -73,9 +73,9 @@ private:
private:
const float& m_cursor;
- const u8 m_index;
- const bool m_positive;
- std::string name;
+ const u8 m_index;
+ const bool m_positive;
+ std::string name;
};
class Axis : public Input
@@ -88,9 +88,9 @@ private:
private:
const float& m_axis;
- const u8 m_index;
- const bool m_positive;
- std::string name;
+ const u8 m_index;
+ const bool m_positive;
+ std::string name;
};
private:
@@ -109,12 +109,12 @@ public:
int GetId() const;
private:
- Window m_window;
- Display* m_display;
- State m_state;
- int xi_opcode;
- const int pointer_deviceid, keyboard_deviceid;
- std::string name;
+ Window m_window;
+ Display* m_display;
+ State m_state;
+ int xi_opcode;
+ const int pointer_deviceid, keyboard_deviceid;
+ std::string name;
};
}
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp
index e507b88..0d2bdab 100644
--- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp
@@ -1,7 +1,7 @@
-#include "Xlib.h"
-
#include <X11/XKBlib.h>
+#include "InputCommon/ControllerInterface/Xlib/Xlib.h"
+
namespace ciface
{
namespace Xlib
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h
index 6ccdf73..9c506f6 100644
--- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h
+++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h
@@ -1,9 +1,9 @@
#pragma once
-#include "../Device.h"
-
-#include <X11/Xlib.h>
#include <X11/keysym.h>
+#include <X11/Xlib.h>
+
+#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
@@ -35,10 +35,10 @@ private:
ControlState GetState() const;
private:
- std::string m_keyname;
- Display* const m_display;
+ std::string m_keyname;
+ Display* const m_display;
const char* const m_keyboard;
- const KeyCode m_keycode;
+ const KeyCode m_keycode;
};
class Button : public Input
@@ -65,8 +65,8 @@ private:
private:
const float& m_cursor;
- const u8 m_index;
- const bool m_positive;
+ const u8 m_index;
+ const bool m_positive;
};
public:
@@ -81,9 +81,9 @@ public:
int GetId() const;
private:
- Window m_window;
+ Window m_window;
Display* m_display;
- State m_state;
+ State m_state;
};
}
diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp
index e3e6d31..859036c 100644
--- a/Source/Core/InputCommon/InputConfig.cpp
+++ b/Source/Core/InputCommon/InputConfig.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "InputConfig.h"
-#include "CommonPaths.h"
-#include "../Core/ConfigManager.h"
-#include "../Core/HW/Wiimote.h"
+#include "Common/CommonPaths.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/Wiimote.h"
+#include "InputCommon/InputConfig.h"
InputPlugin::~InputPlugin()
{
diff --git a/Source/Core/InputCommon/InputConfig.h b/Source/Core/InputCommon/InputConfig.h
index 8fb284f..42a5b7b 100644
--- a/Source/Core/InputCommon/InputConfig.h
+++ b/Source/Core/InputCommon/InputConfig.h
@@ -4,15 +4,15 @@
#pragma once
-#include "Thread.h"
-#include "FileUtil.h"
-#include "IniFile.h"
+#include <map>
+#include <vector>
-#include "ControllerInterface/ControllerInterface.h"
-#include "ControllerEmu.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Common/Thread.h"
-#include <vector>
-#include <map>
+#include "InputCommon/ControllerEmu.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
// InputPlugin isn't a very good name anymore since it's used by GCPad/Wiimote
// which are not even plugins anymore.
diff --git a/Source/Core/InputCommon/UDPWiimote.cpp b/Source/Core/InputCommon/UDPWiimote.cpp
index 35380a2..a50dbc1 100644
--- a/Source/Core/InputCommon/UDPWiimote.cpp
+++ b/Source/Core/InputCommon/UDPWiimote.cpp
@@ -2,7 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "UDPWiimote.h"
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+#include <functional>
+#include <list>
+#include <string.h>
+
+#include "Common/Thread.h"
+#include "Common/Timer.h"
+
+#include "InputCommon/UDPWiimote.h"
#ifdef _WIN32
@@ -41,15 +51,6 @@
#endif
-#include "Thread.h"
-#include "Timer.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <list>
-#include <functional>
struct UDPWiimote::_d
{
@@ -259,9 +260,9 @@ int UDPWiimote::pharsePacket(u8 * bf, size_t size)
if (bf[0] != 0xde)
return -1;
//if (bf[1]==0)
- // time=0;
+ // time=0;
//if (bf[1]<time) //NOT LONGER NEEDED TO ALLOW MULTIPLE IPHONES ON A SINGLE PORT
- // return -1;
+ // return -1;
//time=bf[1];
u32 *p=(u32*)(&bf[3]);
if (bf[2] & ACCEL_FLAG)
diff --git a/Source/Core/InputCommon/UDPWiimote.h b/Source/Core/InputCommon/UDPWiimote.h
index 8d57c70..82f9635 100644
--- a/Source/Core/InputCommon/UDPWiimote.h
+++ b/Source/Core/InputCommon/UDPWiimote.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
#include <string>
+#include "Common/Common.h"
#define UDPWM_B1 (1<<0)
#define UDPWM_B2 (1<<1)
diff --git a/Source/Core/InputCommon/UDPWrapper.cpp b/Source/Core/InputCommon/UDPWrapper.cpp
index 1db2108..19eb619 100644
--- a/Source/Core/InputCommon/UDPWrapper.cpp
+++ b/Source/Core/InputCommon/UDPWrapper.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "UDPWrapper.h"
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "InputCommon/UDPWrapper.h"
const std::string DefaultPort(const int index)
{
diff --git a/Source/Core/InputCommon/UDPWrapper.h b/Source/Core/InputCommon/UDPWrapper.h
index 42b23f4..11a5ddb 100644
--- a/Source/Core/InputCommon/UDPWrapper.h
+++ b/Source/Core/InputCommon/UDPWrapper.h
@@ -4,13 +4,13 @@
#pragma once
-#include "UDPWiimote.h"
-
-#include "Common.h"
-#include "ControllerEmu.h"
-#include "IniFile.h"
#include <string>
+#include "Common/Common.h"
+#include "Common/IniFile.h"
+#include "InputCommon/ControllerEmu.h"
+#include "InputCommon/UDPWiimote.h"
+
class UDPWrapper : public ControllerEmu::ControlGroup
{
public:
diff --git a/Source/Core/InputCommon/X11InputBase.cpp b/Source/Core/InputCommon/X11InputBase.cpp
index 9b39f31..c6dce96 100644
--- a/Source/Core/InputCommon/X11InputBase.cpp
+++ b/Source/Core/InputCommon/X11InputBase.cpp
@@ -2,10 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "X11InputBase.h"
-#include <string.h>
-#include <stdio.h>
+#include <cstdio>
+#include <cstring>
#include <ctype.h>
+
+#include "InputCommon/X11InputBase.h"
+
namespace InputCommon
{
#if defined(HAVE_WX) && HAVE_WX
diff --git a/Source/Core/InputCommon/X11InputBase.h b/Source/Core/InputCommon/X11InputBase.h
index b2b917a..dce3469 100644
--- a/Source/Core/InputCommon/X11InputBase.h
+++ b/Source/Core/InputCommon/X11InputBase.h
@@ -4,14 +4,14 @@
#pragma once
-#include "Common.h"
-
-#include <X11/X.h>
#include <X11/keysym.h>
+#include <X11/X.h>
#if defined(HAVE_WX) && HAVE_WX
#include <wx/wx.h>
#endif
+#include "Common/Common.h"
+
namespace InputCommon
{
#if defined(HAVE_WX) && HAVE_WX
diff --git a/Source/Core/InputCommon/stdafx.cpp b/Source/Core/InputCommon/stdafx.cpp
index b602b39..d2ad768 100644
--- a/Source/Core/InputCommon/stdafx.cpp
+++ b/Source/Core/InputCommon/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "InputCommon/stdafx.h"
diff --git a/Source/Core/InputCommon/stdafx.h b/Source/Core/InputCommon/stdafx.h
index 498a15a..613c899 100644
--- a/Source/Core/InputCommon/stdafx.h
+++ b/Source/Core/InputCommon/stdafx.h
@@ -9,6 +9,6 @@
#define _WIN32_IE 0x0500 // Default value is 0x0400
#endif
*/
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <algorithm>
diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp
index 5434354..a2ed0f4 100644
--- a/Source/Core/VideoBackends/D3D/D3DBase.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "StringUtil.h"
-#include "VideoConfig.h"
+#include "Common/StringUtil.h"
+#include "VideoCommon/VideoConfig.h"
-#include "D3DBase.h"
-#include "D3DTexture.h"
-#include "GfxState.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DTexture.h"
+#include "VideoBackends/D3D/GfxState.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/D3DBase.h b/Source/Core/VideoBackends/D3D/D3DBase.h
index 7f26cbd..a2afabb 100644
--- a/Source/Core/VideoBackends/D3D/D3DBase.h
+++ b/Source/Core/VideoBackends/D3D/D3DBase.h
@@ -7,9 +7,10 @@
#include <dxgi.h>
#include <d3d11.h>
#include <d3dcompiler.h>
-#include "Common.h"
#include <vector>
+#include "Common/Common.h"
+
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/D3DBlob.cpp b/Source/Core/VideoBackends/D3D/D3DBlob.cpp
index 26c8c8b..79fccd3 100644
--- a/Source/Core/VideoBackends/D3D/D3DBlob.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DBlob.cpp
@@ -3,7 +3,8 @@
// Refer to the license.txt file included.
#include <d3d11.h>
-#include "D3DBlob.h"
+
+#include "VideoBackends/D3D/D3DBlob.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/D3DBlob.h b/Source/Core/VideoBackends/D3D/D3DBlob.h
index b91907a..7e00ba6 100644
--- a/Source/Core/VideoBackends/D3D/D3DBlob.h
+++ b/Source/Core/VideoBackends/D3D/D3DBlob.h
@@ -4,7 +4,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
struct ID3D10Blob;
diff --git a/Source/Core/VideoBackends/D3D/D3DShader.cpp b/Source/Core/VideoBackends/D3D/D3DShader.cpp
index 51a51b7..2159014 100644
--- a/Source/Core/VideoBackends/D3D/D3DShader.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DShader.cpp
@@ -4,10 +4,9 @@
#include <string>
-#include "VideoConfig.h"
-
-#include "D3DBase.h"
-#include "D3DShader.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoCommon/VideoConfig.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/D3DShader.h b/Source/Core/VideoBackends/D3D/D3DShader.h
index 84fb03a..fc0951a 100644
--- a/Source/Core/VideoBackends/D3D/D3DShader.h
+++ b/Source/Core/VideoBackends/D3D/D3DShader.h
@@ -4,8 +4,8 @@
#pragma once
-#include "D3DBase.h"
-#include "D3DBlob.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DBlob.h"
struct ID3D11PixelShader;
struct ID3D11VertexShader;
diff --git a/Source/Core/VideoBackends/D3D/D3DTexture.cpp b/Source/Core/VideoBackends/D3D/D3DTexture.cpp
index abf34b3..f0114ca 100644
--- a/Source/Core/VideoBackends/D3D/D3DTexture.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DTexture.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "D3DBase.h"
-#include "D3DTexture.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DTexture.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
index df965dc..9dd7f23 100644
--- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
@@ -4,12 +4,12 @@
#include <list>
-#include "D3DBase.h"
-#include "D3DUtil.h"
-#include "PixelShaderCache.h"
-#include "VertexShaderCache.h"
-#include "D3DShader.h"
-#include "GfxState.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/GfxState.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
namespace DX11
{
@@ -210,7 +210,7 @@ int CD3DFont::Init()
// Create a new texture for the font
// possible optimization: store the converted data in a buffer and fill the texture on creation.
- // That way, we can use a static texture
+ // That way, we can use a static texture
ID3D11Texture2D* buftex;
D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, m_dwTexWidth, m_dwTexHeight,
1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC,
diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.h b/Source/Core/VideoBackends/D3D/D3DUtil.h
index ff789a1..c3569fd 100644
--- a/Source/Core/VideoBackends/D3D/D3DUtil.h
+++ b/Source/Core/VideoBackends/D3D/D3DUtil.h
@@ -2,10 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#pragma once
+#pragma once
#include <d3d11.h>
-#include <MathUtil.h>
+
+#include "Common/MathUtil.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/FramebufferManager.cpp b/Source/Core/VideoBackends/D3D/FramebufferManager.cpp
index 726037a..6b217fd 100644
--- a/Source/Core/VideoBackends/D3D/FramebufferManager.cpp
+++ b/Source/Core/VideoBackends/D3D/FramebufferManager.cpp
@@ -2,16 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoConfig.h"
-
-#include "D3DBase.h"
-#include "D3DUtil.h"
-#include "FramebufferManager.h"
-#include "PixelShaderCache.h"
-#include "Render.h"
-#include "VertexShaderCache.h"
-#include "XFBEncoder.h"
-#include "HW/Memmap.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/FramebufferManager.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+#include "VideoBackends/D3D/XFBEncoder.h"
+#include "VideoCommon/VideoConfig.h"
namespace DX11 {
diff --git a/Source/Core/VideoBackends/D3D/FramebufferManager.h b/Source/Core/VideoBackends/D3D/FramebufferManager.h
index c55ec3c..28153b5 100644
--- a/Source/Core/VideoBackends/D3D/FramebufferManager.h
+++ b/Source/Core/VideoBackends/D3D/FramebufferManager.h
@@ -6,9 +6,8 @@
#include "d3d11.h"
-#include "FramebufferManagerBase.h"
-
-#include "D3DTexture.h"
+#include "VideoBackends/D3D/D3DTexture.h"
+#include "VideoCommon/FramebufferManagerBase.h"
namespace DX11 {
diff --git a/Source/Core/VideoBackends/D3D/GfxState.cpp b/Source/Core/VideoBackends/D3D/GfxState.cpp
index cc0b74d..c31c45e 100644
--- a/Source/Core/VideoBackends/D3D/GfxState.cpp
+++ b/Source/Core/VideoBackends/D3D/GfxState.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Log.h"
+#include "Common/Log.h"
-#include "D3DBase.h"
-#include "GfxState.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/GfxState.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/Globals.h b/Source/Core/VideoBackends/D3D/Globals.h
index 5717bae..9e761b4 100644
--- a/Source/Core/VideoBackends/D3D/Globals.h
+++ b/Source/Core/VideoBackends/D3D/Globals.h
@@ -4,8 +4,9 @@
#pragma once
-#include "Common.h"
-#include "VideoConfig.h"
-#include "main.h"
+#include "Common/Common.h"
-#include "VideoCommon.h"
+#include "VideoBackends/D3D/main.h"
+
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
diff --git a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
index 1974a71..36f519f 100644
--- a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "LineGeometryShader.h"
-
#include <sstream>
-#include "D3DBase.h"
-#include "D3DShader.h"
-#include "VertexShaderGen.h"
+
+#include "VideoBackends/D3D/LineGeometryShader.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoCommon/VertexShaderGen.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/LineGeometryShader.h b/Source/Core/VideoBackends/D3D/LineGeometryShader.h
index 987016f..4bcb159 100644
--- a/Source/Core/VideoBackends/D3D/LineGeometryShader.h
+++ b/Source/Core/VideoBackends/D3D/LineGeometryShader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
struct ID3D11Buffer;
struct ID3D11GeometryShader;
diff --git a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp
index 824778d..661e1e4 100644
--- a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp
+++ b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "D3DBase.h"
-#include "D3DBlob.h"
-#include "NativeVertexFormat.h"
-#include "VertexManager.h"
-#include "VertexShaderCache.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DBlob.h"
+#include "VideoBackends/D3D/VertexManager.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+#include "VideoCommon/NativeVertexFormat.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
index 0a8243e..fdb54bb 100644
--- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
+++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
@@ -2,16 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "PSTextureEncoder.h"
-
-#include "D3DBase.h"
-#include "D3DShader.h"
-#include "GfxState.h"
-#include "BPMemory.h"
-#include "FramebufferManager.h"
-#include "Render.h"
-#include "HW/Memmap.h"
-#include "TextureCache.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/GfxState.h"
+#include "VideoBackends/D3D/FramebufferManager.h"
+#include "VideoBackends/D3D/PSTextureEncoder.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoBackends/D3D/TextureCache.h"
+#include "VideoCommon/BPMemory.h"
// "Static mode" will compile a new EFB encoder shader for every combination of
// encoding configurations. It's compatible with Shader Model 4.
diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.h b/Source/Core/VideoBackends/D3D/PSTextureEncoder.h
index 4883253..e581775 100644
--- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.h
+++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.h
@@ -4,7 +4,7 @@
#pragma once
-#include "TextureEncoder.h"
+#include "VideoBackends/D3D/TextureEncoder.h"
struct ID3D11Texture2D;
struct ID3D11RenderTargetView;
diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.cpp b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
index b2c77a8..61a501d 100644
--- a/Source/Core/VideoBackends/D3D/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
@@ -1,7 +1,6 @@
-#include "RenderBase.h"
-
-#include "D3DBase.h"
-#include "PerfQuery.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/PerfQuery.h"
+#include "VideoCommon/RenderBase.h"
namespace DX11 {
@@ -9,33 +8,31 @@ PerfQuery::PerfQuery()
: m_query_read_pos()
, m_query_count()
{
- for (int i = 0; i != ArraySize(m_query_buffer); ++i)
+ for (ActiveQuery& entry : m_query_buffer)
{
D3D11_QUERY_DESC qdesc = CD3D11_QUERY_DESC(D3D11_QUERY_OCCLUSION, 0);
- D3D::device->CreateQuery(&qdesc, &m_query_buffer[i].query);
+ D3D::device->CreateQuery(&qdesc, &entry.query);
}
+
ResetQuery();
}
PerfQuery::~PerfQuery()
{
- for (int i = 0; i != ArraySize(m_query_buffer); ++i)
+ for (ActiveQuery& entry : m_query_buffer)
{
// TODO: EndQuery?
- m_query_buffer[i].query->Release();
+ entry.query->Release();
}
}
void PerfQuery::EnableQuery(PerfQueryGroup type)
{
- if (!ShouldEmulate())
- return;
-
// Is this sane?
- if (m_query_count > ArraySize(m_query_buffer) / 2)
+ if (m_query_count > m_query_buffer.size() / 2)
WeakFlush();
- if (ArraySize(m_query_buffer) == m_query_count)
+ if (m_query_buffer.size() == m_query_count)
{
// TODO
FlushOne();
@@ -45,7 +42,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
// start query
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
{
- auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % ArraySize(m_query_buffer)];
+ auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % m_query_buffer.size()];
D3D::context->Begin(entry.query);
entry.query_type = type;
@@ -56,13 +53,10 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
void PerfQuery::DisableQuery(PerfQueryGroup type)
{
- if (!ShouldEmulate())
- return;
-
// stop query
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
{
- auto& entry = m_query_buffer[(m_query_read_pos + m_query_count + ArraySize(m_query_buffer)-1) % ArraySize(m_query_buffer)];
+ auto& entry = m_query_buffer[(m_query_read_pos + m_query_count + m_query_buffer.size()-1) % m_query_buffer.size()];
D3D::context->End(entry.query);
}
}
@@ -75,9 +69,6 @@ void PerfQuery::ResetQuery()
u32 PerfQuery::GetQueryResult(PerfQueryType type)
{
- if (!ShouldEmulate())
- return 0;
-
u32 result = 0;
if (type == PQ_ZCOMP_INPUT_ZCOMPLOC || type == PQ_ZCOMP_OUTPUT_ZCOMPLOC)
@@ -102,9 +93,6 @@ u32 PerfQuery::GetQueryResult(PerfQueryType type)
void PerfQuery::FlushOne()
{
- if (!ShouldEmulate())
- return;
-
auto& entry = m_query_buffer[m_query_read_pos];
UINT64 result = 0;
@@ -118,25 +106,19 @@ void PerfQuery::FlushOne()
// NOTE: Reported pixel metrics should be referenced to native resolution
m_results[entry.query_type] += (u32)(result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
- m_query_read_pos = (m_query_read_pos + 1) % ArraySize(m_query_buffer);
+ m_query_read_pos = (m_query_read_pos + 1) % m_query_buffer.size();
--m_query_count;
}
// TODO: could selectively flush things, but I don't think that will do much
void PerfQuery::FlushResults()
{
- if (!ShouldEmulate())
- return;
-
while (!IsFlushed())
FlushOne();
}
void PerfQuery::WeakFlush()
{
- if (!ShouldEmulate())
- return;
-
while (!IsFlushed())
{
auto& entry = m_query_buffer[m_query_read_pos];
@@ -149,7 +131,7 @@ void PerfQuery::WeakFlush()
// NOTE: Reported pixel metrics should be referenced to native resolution
m_results[entry.query_type] += (u32)(result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
- m_query_read_pos = (m_query_read_pos + 1) % ArraySize(m_query_buffer);
+ m_query_read_pos = (m_query_read_pos + 1) % m_query_buffer.size();
--m_query_count;
}
else
@@ -161,9 +143,6 @@ void PerfQuery::WeakFlush()
bool PerfQuery::IsFlushed() const
{
- if (!ShouldEmulate())
- return true;
-
return 0 == m_query_count;
}
diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.h b/Source/Core/VideoBackends/D3D/PerfQuery.h
index e9c526b..c8f9d08 100644
--- a/Source/Core/VideoBackends/D3D/PerfQuery.h
+++ b/Source/Core/VideoBackends/D3D/PerfQuery.h
@@ -1,6 +1,8 @@
#pragma once
-#include "PerfQueryBase.h"
+#include <array>
+
+#include "VideoCommon/PerfQueryBase.h"
namespace DX11 {
@@ -32,7 +34,7 @@ private:
// when testing in SMS: 64 was too small, 128 was ok
static const int PERF_QUERY_BUFFER_SIZE = 512;
- ActiveQuery m_query_buffer[PERF_QUERY_BUFFER_SIZE];
+ std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer;
int m_query_read_pos;
// TODO: sloppy
diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
index bb87720..4c23451 100644
--- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
@@ -2,21 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileUtil.h"
-#include "LinearDiskCache.h"
+#include "Common/FileUtil.h"
+#include "Common/LinearDiskCache.h"
-#include "Debugger.h"
-#include "Statistics.h"
-#include "VideoConfig.h"
+#include "Core/ConfigManager.h"
-#include "D3DBase.h"
-#include "D3DShader.h"
-#include "Globals.h"
-#include "PixelShaderGen.h"
-#include "PixelShaderCache.h"
-#include "PixelShaderManager.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/Globals.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VideoConfig.h"
-#include "ConfigManager.h"
extern int frameCount;
diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.h b/Source/Core/VideoBackends/D3D/PixelShaderCache.h
index dee930c..55beee1 100644
--- a/Source/Core/VideoBackends/D3D/PixelShaderCache.h
+++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.h
@@ -4,11 +4,10 @@
#pragma once
-#include "PixelShaderGen.h"
-
+#include <map>
#include <d3d11.h>
-#include <map>
+#include "VideoCommon/PixelShaderGen.h"
enum DSTALPHA_MODE;
diff --git a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
index d8dc173..5e7cb5e 100644
--- a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "PointGeometryShader.h"
-
#include <sstream>
-#include "D3DBase.h"
-#include "D3DShader.h"
-#include "VertexShaderGen.h"
+
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/PointGeometryShader.h"
+#include "VideoCommon/VertexShaderGen.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/PointGeometryShader.h b/Source/Core/VideoBackends/D3D/PointGeometryShader.h
index 1b1c581..b24f73d 100644
--- a/Source/Core/VideoBackends/D3D/PointGeometryShader.h
+++ b/Source/Core/VideoBackends/D3D/PointGeometryShader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
struct ID3D11Buffer;
struct ID3D11GeometryShader;
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index 1c1955a..623e5b4 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -4,36 +4,36 @@
#include <cinttypes>
#include <cmath>
-
-#include "Timer.h"
-
-#include "Debugger.h"
-#include "EmuWindow.h"
-#include "Fifo.h"
-#include "OnScreenDisplay.h"
-#include "PixelEngine.h"
-#include "Statistics.h"
-#include "VertexShaderManager.h"
-#include "VideoConfig.h"
-
-#include "D3DBase.h"
-#include "D3DUtil.h"
-#include "FramebufferManager.h"
-#include "GfxState.h"
-#include "PixelShaderCache.h"
-#include "Render.h"
-#include "TextureCache.h"
-#include "VertexShaderCache.h"
-#include "Core.h"
-#include "Movie.h"
-#include "Television.h"
-#include "Host.h"
-#include "BPFunctions.h"
-#include "AVIDump.h"
-#include "FPSCounter.h"
-#include "ConfigManager.h"
#include <strsafe.h>
-#include "ImageWrite.h"
+
+#include "Common/Timer.h"
+
+#include "Core/Core.h"
+#include "Core/ConfigManager.h"
+#include "Core/Host.h"
+#include "Core/Movie.h"
+
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/FramebufferManager.h"
+#include "VideoBackends/D3D/GfxState.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoBackends/D3D/Television.h"
+#include "VideoBackends/D3D/TextureCache.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+
+#include "VideoCommon/AVIDump.h"
+#include "VideoCommon/BPFunctions.h"
+#include "VideoCommon/EmuWindow.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/FPSCounter.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
namespace DX11
{
@@ -81,16 +81,16 @@ void SetupDeviceObjects()
D3D::SetDebugObjectName((ID3D11DeviceChild*)access_efb_cbuf, "constant buffer for Renderer::AccessEFB");
D3D11_DEPTH_STENCIL_DESC ddesc;
- ddesc.DepthEnable = FALSE;
+ ddesc.DepthEnable = FALSE;
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
- ddesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
- ddesc.StencilEnable = FALSE;
+ ddesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ ddesc.StencilEnable = FALSE;
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[0]);
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
- ddesc.DepthEnable = TRUE;
+ ddesc.DepthEnable = TRUE;
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[1]);
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
@@ -130,12 +130,12 @@ void SetupDeviceObjects()
hr = D3D::device->CreateBlendState(&blenddesc, &clearblendstates[3]);
CHECK(hr==S_OK, "Create blend state for Renderer::ClearScreen");
- ddesc.DepthEnable = FALSE;
- ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
- ddesc.DepthFunc = D3D11_COMPARISON_LESS;
- ddesc.StencilEnable = FALSE;
- ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
- ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ ddesc.DepthEnable = FALSE;
+ ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
+ ddesc.DepthFunc = D3D11_COMPARISON_LESS;
+ ddesc.StencilEnable = FALSE;
+ ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
hr = D3D::device->CreateDepthStencilState(&ddesc, &resetdepthstate);
CHECK(hr==S_OK, "Create depth state for Renderer::ResetAPIState");
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState");
@@ -216,12 +216,12 @@ Renderer::Renderer()
gx_state.blenddc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
memset(&gx_state.depthdc, 0, sizeof(gx_state.depthdc));
- gx_state.depthdc.DepthEnable = TRUE;
- gx_state.depthdc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
- gx_state.depthdc.DepthFunc = D3D11_COMPARISON_LESS;
- gx_state.depthdc.StencilEnable = FALSE;
- gx_state.depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
- gx_state.depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ gx_state.depthdc.DepthEnable = TRUE;
+ gx_state.depthdc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ gx_state.depthdc.DepthFunc = D3D11_COMPARISON_LESS;
+ gx_state.depthdc.StencilEnable = FALSE;
+ gx_state.depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ gx_state.depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
// TODO: Do we need to enable multisampling here?
gx_state.rastdc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0, false, true, false, false);
@@ -303,9 +303,10 @@ bool Renderer::CheckForResize()
return false;
}
-void Renderer::SetScissorRect(const TargetRectangle& rc)
+void Renderer::SetScissorRect(const EFBRectangle& rc)
{
- D3D::context->RSSetScissorRects(1, rc.AsRECT());
+ TargetRectangle trc = ConvertEFBRectangle(rc);
+ D3D::context->RSSetScissorRects(1, trc.AsRECT());
}
void Renderer::SetColorMask()
@@ -327,15 +328,15 @@ void Renderer::SetColorMask()
// and EFB pokes (which will change the color or depth of a pixel).
//
// The behavior of EFB peeks can only be modified by:
-// - GX_PokeAlphaRead
+// - GX_PokeAlphaRead
// The behavior of EFB pokes can be modified by:
-// - GX_PokeAlphaMode (TODO)
-// - GX_PokeAlphaUpdate (TODO)
-// - GX_PokeBlendMode (TODO)
-// - GX_PokeColorUpdate (TODO)
-// - GX_PokeDither (TODO)
-// - GX_PokeDstAlpha (TODO)
-// - GX_PokeZMode (TODO)
+// - GX_PokeAlphaMode (TODO)
+// - GX_PokeAlphaUpdate (TODO)
+// - GX_PokeBlendMode (TODO)
+// - GX_PokeColorUpdate (TODO)
+// - GX_PokeDither (TODO)
+// - GX_PokeDstAlpha (TODO)
+// - GX_PokeZMode (TODO)
u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{
// TODO: This function currently is broken if anti-aliasing is enabled
@@ -437,8 +438,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
D3D::context->Unmap(read_tex, 0);
// check what to do with the alpha channel (GX_PokeAlphaRead)
- PixelEngine::UPEAlphaReadReg alpha_read_mode;
- PixelEngine::Read16((u16&)alpha_read_mode, PE_ALPHAREAD);
+ PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode();
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)
{
@@ -466,9 +466,9 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), NULL);
D3D::drawColorQuad(rgbaColor, (float)RectToLock.left * 2.f / (float)Renderer::GetTargetWidth() - 1.f,
- - (float)RectToLock.top * 2.f / (float)Renderer::GetTargetHeight() + 1.f,
- (float)RectToLock.right * 2.f / (float)Renderer::GetTargetWidth() - 1.f,
- - (float)RectToLock.bottom * 2.f / (float)Renderer::GetTargetHeight() + 1.f);
+ - (float)RectToLock.top * 2.f / (float)Renderer::GetTargetHeight() + 1.f,
+ (float)RectToLock.right * 2.f / (float)Renderer::GetTargetWidth() - 1.f,
+ - (float)RectToLock.bottom * 2.f / (float)Renderer::GetTargetHeight() + 1.f);
RestoreAPIState();
return 0;
@@ -476,8 +476,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
}
-// Called from VertexShaderManager
-void Renderer::UpdateViewport()
+void Renderer::SetViewport()
{
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
// [0] = width/2
@@ -487,6 +486,10 @@ void Renderer::UpdateViewport()
// [4] = yorig + height/2 + 342
// [5] = 16777215 * farz
+ // D3D crashes for zero viewports
+ if (xfregs.viewport.wd == 0 || xfregs.viewport.ht == 0)
+ return;
+
int scissorXOff = bpmem.scissorOffset.x * 2;
int scissorYOff = bpmem.scissorOffset.y * 2;
@@ -512,10 +515,9 @@ void Renderer::UpdateViewport()
Ht = (Y + Ht <= GetTargetHeight()) ? Ht : (GetTargetHeight() - Y);
// Some games set invalid values for z-min and z-max so fix them to the max and min allowed and let the shaders do this work
- D3D11_VIEWPORT vp = CD3D11_VIEWPORT(X, Y,
- Wd, Ht,
- 0.f, // (xfregs.viewport.farZ - xfregs.viewport.zRange) / 16777216.0f;
- 1.f); // xfregs.viewport.farZ / 16777216.0f;
+ D3D11_VIEWPORT vp = CD3D11_VIEWPORT(X, Y, Wd, Ht,
+ 0.f, // (xfregs.viewport.farZ - xfregs.viewport.zRange) / 16777216.0f;
+ 1.f); // xfregs.viewport.farZ / 16777216.0f;
D3D::context->RSSetViewports(1, &vp);
}
@@ -725,7 +727,7 @@ void formatBufferDump(const u8* in, u8* out, int w, int h, int p)
}
// This function has the final picture. We adjust the aspect ratio here.
-void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc,float Gamma)
+void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc,float Gamma)
{
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
{
@@ -945,9 +947,6 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
OSD::DrawMessages();
D3D::EndFrame();
- frameCount++;
-
- GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
TextureCache::Cleanup();
@@ -974,11 +973,6 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
if (XFBWrited)
s_fps = UpdateFPSCounter();
- // Begin new frame
- // Set default viewport and scissor, for the clear to work correctly
- // New frame
- stats.ResetFrame();
-
// Flip/present backbuffer to frontbuffer here
D3D::Present();
@@ -1018,10 +1012,7 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
RestoreAPIState();
D3D::BeginFrame();
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
- UpdateViewport();
-
- Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
- XFBWrited = false;
+ SetViewport();
}
// ALWAYS call RestoreAPIState for each ResetAPIState call you're doing
@@ -1038,7 +1029,7 @@ void Renderer::RestoreAPIState()
D3D::stateman->PopBlendState();
D3D::stateman->PopDepthState();
D3D::stateman->PopRasterizerState();
- UpdateViewport();
+ SetViewport();
BPFunctions::SetScissor();
}
@@ -1199,22 +1190,22 @@ void Renderer::SetLogicOpMode()
// D3D11 doesn't support logic blending, so this is a huge hack
// TODO: Make use of D3D11.1's logic blending support
- // 0 0x00
- // 1 Source & destination
- // 2 Source & ~destination
- // 3 Source
- // 4 ~Source & destination
- // 5 Destination
- // 6 Source ^ destination = Source & ~destination | ~Source & destination
- // 7 Source | destination
- // 8 ~(Source | destination)
- // 9 ~(Source ^ destination) = ~Source & ~destination | Source & destination
- // 10 ~Destination
- // 11 Source | ~destination
- // 12 ~Source
- // 13 ~Source | destination
- // 14 ~(Source & destination)
- // 15 0xff
+ // 0 0x00
+ // 1 Source & destination
+ // 2 Source & ~destination
+ // 3 Source
+ // 4 ~Source & destination
+ // 5 Destination
+ // 6 Source ^ destination = Source & ~destination | ~Source & destination
+ // 7 Source | destination
+ // 8 ~(Source | destination)
+ // 9 ~(Source ^ destination) = ~Source & ~destination | Source & destination
+ // 10 ~Destination
+ // 11 Source | ~destination
+ // 12 ~Source
+ // 13 ~Source | destination
+ // 14 ~(Source & destination)
+ // 15 0xff
const D3D11_BLEND_OP d3dLogicOps[16] =
{
D3D11_BLEND_OP_ADD,//0
@@ -1322,7 +1313,8 @@ void Renderer::SetSamplerState(int stage, int texindex)
unsigned int mip = d3dMipFilters[tm0.min_filter & 3];
- if (texindex) stage += 4;
+ if (texindex)
+ stage += 4;
if (g_ActiveConfig.bForceFiltering)
{
diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h
index f391e4b..b594816 100644
--- a/Source/Core/VideoBackends/D3D/Render.h
+++ b/Source/Core/VideoBackends/D3D/Render.h
@@ -1,6 +1,6 @@
#pragma once
-#include "RenderBase.h"
+#include "VideoCommon/RenderBase.h"
namespace DX11
{
@@ -13,7 +13,7 @@ public:
void SetColorMask();
void SetBlendMode(bool forceUpdate);
- void SetScissorRect(const TargetRectangle& rc);
+ void SetScissorRect(const EFBRectangle& rc);
void SetGenerationMode();
void SetDepthMode();
void SetLogicOpMode();
@@ -21,6 +21,7 @@ public:
void SetLineWidth();
void SetSamplerState(int stage,int texindex);
void SetInterlacingMode();
+ void SetViewport();
// TODO: Fix confusing names (see ResetAPIState and RestoreAPIState)
void ApplyState(bool bUseDstAlpha);
@@ -38,14 +39,12 @@ public:
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc);
- void Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma);
+ void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma);
void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z);
void ReinterpretPixelData(unsigned int convtype);
- void UpdateViewport();
-
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
static bool CheckForResize();
diff --git a/Source/Core/VideoBackends/D3D/Television.cpp b/Source/Core/VideoBackends/D3D/Television.cpp
index 0f1cf62..816fe32 100644
--- a/Source/Core/VideoBackends/D3D/Television.cpp
+++ b/Source/Core/VideoBackends/D3D/Television.cpp
@@ -2,16 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Television.h"
-
-#include "VideoConfig.h"
-#include "D3DBase.h"
-#include "D3DShader.h"
-#include "D3DUtil.h"
-#include "VertexShaderCache.h"
-#include "HW/Memmap.h"
#include <vector>
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/Television.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+#include "VideoCommon/VideoConfig.h"
+
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/Television.h b/Source/Core/VideoBackends/D3D/Television.h
index e6f0c42..61f0e3f 100644
--- a/Source/Core/VideoBackends/D3D/Television.h
+++ b/Source/Core/VideoBackends/D3D/Television.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
struct ID3D11Texture2D;
struct ID3D11ShaderResourceView;
diff --git a/Source/Core/VideoBackends/D3D/TextureCache.cpp b/Source/Core/VideoBackends/D3D/TextureCache.cpp
index 27bee72..7fc1ed9 100644
--- a/Source/Core/VideoBackends/D3D/TextureCache.cpp
+++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp
@@ -2,19 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "RenderBase.h"
-
-#include "D3DBase.h"
-#include "D3DUtil.h"
-#include "FramebufferManager.h"
-#include "PixelShaderCache.h"
-#include "TextureCache.h"
-#include "VertexShaderCache.h"
-#include "TextureEncoder.h"
-#include "PSTextureEncoder.h"
-#include "HW/Memmap.h"
-#include "VideoConfig.h"
-#include "ImageWrite.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/FramebufferManager.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/TextureCache.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+#include "VideoBackends/D3D/TextureEncoder.h"
+#include "VideoBackends/D3D/PSTextureEncoder.h"
+
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VideoConfig.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/TextureCache.h b/Source/Core/VideoBackends/D3D/TextureCache.h
index 91603bc..991bbe1 100644
--- a/Source/Core/VideoBackends/D3D/TextureCache.h
+++ b/Source/Core/VideoBackends/D3D/TextureCache.h
@@ -4,9 +4,8 @@
#pragma once
-#include "TextureCacheBase.h"
-
-#include "D3DTexture.h"
+#include "VideoBackends/D3D/D3DTexture.h"
+#include "VideoCommon/TextureCacheBase.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/TextureEncoder.h b/Source/Core/VideoBackends/D3D/TextureEncoder.h
index d43f4ce..56f4092 100644
--- a/Source/Core/VideoBackends/D3D/TextureEncoder.h
+++ b/Source/Core/VideoBackends/D3D/TextureEncoder.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/VertexManager.cpp b/Source/Core/VideoBackends/D3D/VertexManager.cpp
index f8274ee..06ade13 100644
--- a/Source/Core/VideoBackends/D3D/VertexManager.cpp
+++ b/Source/Core/VideoBackends/D3D/VertexManager.cpp
@@ -2,22 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "D3DBase.h"
-#include "PixelShaderCache.h"
-#include "VertexManager.h"
-#include "VertexShaderCache.h"
-
-#include "BPMemory.h"
-#include "Debugger.h"
-#include "IndexGenerator.h"
-#include "MainBase.h"
-#include "PixelShaderManager.h"
-#include "RenderBase.h"
-#include "Render.h"
-#include "Statistics.h"
-#include "TextureCacheBase.h"
-#include "VertexShaderManager.h"
-#include "VideoConfig.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoBackends/D3D/VertexManager.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/MainBase.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
// internal state for loading vertices
extern NativeVertexFormat *g_nativeVertexFmt;
@@ -197,11 +197,8 @@ void VertexManager::Draw(UINT stride)
}
}
-void VertexManager::vFlush()
+void VertexManager::vFlush(bool useDstAlpha)
{
- bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
- bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
-
if (!PixelShaderCache::SetShader(
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE,
g_nativeVertexFmt->m_components))
@@ -219,11 +216,7 @@ void VertexManager::vFlush()
g_nativeVertexFmt->SetupVertexPointers();
g_renderer->ApplyState(useDstAlpha);
- g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
Draw(stride);
- g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
-
- GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
g_renderer->RestoreState();
}
diff --git a/Source/Core/VideoBackends/D3D/VertexManager.h b/Source/Core/VideoBackends/D3D/VertexManager.h
index db8be6d..e74514d 100644
--- a/Source/Core/VideoBackends/D3D/VertexManager.h
+++ b/Source/Core/VideoBackends/D3D/VertexManager.h
@@ -4,9 +4,9 @@
#pragma once
-#include "VertexManagerBase.h"
-#include "LineGeometryShader.h"
-#include "PointGeometryShader.h"
+#include "VideoBackends/D3D/LineGeometryShader.h"
+#include "VideoBackends/D3D/PointGeometryShader.h"
+#include "VideoCommon/VertexManagerBase.h"
namespace DX11
{
@@ -30,7 +30,7 @@ private:
void PrepareDrawBuffers();
void Draw(u32 stride);
// temp
- void vFlush();
+ void vFlush(bool useDstAlpha);
u32 m_vertex_buffer_cursor;
u32 m_vertex_draw_offset;
diff --git a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
index b3a399e..7d35d84 100644
--- a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
@@ -2,19 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileUtil.h"
-#include "LinearDiskCache.h"
+#include "Common/FileUtil.h"
+#include "Common/LinearDiskCache.h"
-#include "Debugger.h"
-#include "Statistics.h"
-#include "VertexShaderGen.h"
+#include "Core/ConfigManager.h"
-#include "D3DShader.h"
-#include "Globals.h"
-#include "VertexShaderCache.h"
-#include "VertexShaderManager.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/Globals.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
-#include "ConfigManager.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VertexShaderManager.h"
namespace DX11 {
diff --git a/Source/Core/VideoBackends/D3D/VertexShaderCache.h b/Source/Core/VideoBackends/D3D/VertexShaderCache.h
index 8b28790..0c9c739 100644
--- a/Source/Core/VideoBackends/D3D/VertexShaderCache.h
+++ b/Source/Core/VideoBackends/D3D/VertexShaderCache.h
@@ -4,12 +4,12 @@
#pragma once
-#include "VertexShaderGen.h"
+#include <map>
-#include "D3DBase.h"
-#include "D3DBlob.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DBlob.h"
-#include <map>
+#include "VideoCommon/VertexShaderGen.h"
namespace DX11 {
diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h
index 15224c4..a158ace 100644
--- a/Source/Core/VideoBackends/D3D/VideoBackend.h
+++ b/Source/Core/VideoBackends/D3D/VideoBackend.h
@@ -1,6 +1,6 @@
#pragma once
-#include "VideoBackendBase.h"
+#include "VideoCommon/VideoBackendBase.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
index bc6c66d..25d69ae 100644
--- a/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
+++ b/Source/Core/VideoBackends/D3D/XFBEncoder.cpp
@@ -2,14 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "XFBEncoder.h"
-
-#include "D3DBase.h"
-#include "D3DBlob.h"
-#include "D3DShader.h"
-#include "Render.h"
-#include "GfxState.h"
-#include "FramebufferManager.h"
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DBlob.h"
+#include "VideoBackends/D3D/D3DShader.h"
+#include "VideoBackends/D3D/FramebufferManager.h"
+#include "VideoBackends/D3D/GfxState.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoBackends/D3D/XFBEncoder.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/XFBEncoder.h b/Source/Core/VideoBackends/D3D/XFBEncoder.h
index 655059c..b5ac520 100644
--- a/Source/Core/VideoBackends/D3D/XFBEncoder.h
+++ b/Source/Core/VideoBackends/D3D/XFBEncoder.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
struct ID3D11Texture2D;
struct ID3D11RenderTargetView;
diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp
index 2c8179c..2fe48f3 100644
--- a/Source/Core/VideoBackends/D3D/main.cpp
+++ b/Source/Core/VideoBackends/D3D/main.cpp
@@ -4,39 +4,39 @@
#include <wx/wx.h>
-#include "LogManager.h"
-
-#include "BPStructs.h"
-#include "CommandProcessor.h"
-#include "Fifo.h"
-#include "OnScreenDisplay.h"
-#include "OpcodeDecoding.h"
-#include "PixelEngine.h"
-#include "PixelShaderManager.h"
-#include "VideoConfig.h"
-#include "VertexLoaderManager.h"
-#include "VertexShaderManager.h"
-#include "Core.h"
-#include "Host.h"
-
-#include "Debugger/DebuggerPanel.h"
-#include "EmuWindow.h"
-#include "IndexGenerator.h"
-#include "FileUtil.h"
-#include "Globals.h"
-#include "IniFile.h"
-#include "VideoConfigDiag.h"
-
-#include "D3DUtil.h"
-#include "D3DBase.h"
-#include "PerfQuery.h"
-#include "PixelShaderCache.h"
-#include "TextureCache.h"
-#include "VertexManager.h"
-#include "VertexShaderCache.h"
-
-#include "VideoBackend.h"
-#include "ConfigManager.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Common/LogManager.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+
+#include "DolphinWX/VideoConfigDiag.h"
+#include "DolphinWX/Debugger/DebuggerPanel.h"
+
+#include "VideoBackends/D3D/D3DBase.h"
+#include "VideoBackends/D3D/D3DUtil.h"
+#include "VideoBackends/D3D/Globals.h"
+#include "VideoBackends/D3D/PerfQuery.h"
+#include "VideoBackends/D3D/PixelShaderCache.h"
+#include "VideoBackends/D3D/TextureCache.h"
+#include "VideoBackends/D3D/VertexManager.h"
+#include "VideoBackends/D3D/VertexShaderCache.h"
+#include "VideoBackends/D3D/VideoBackend.h"
+
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/EmuWindow.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
namespace DX11
{
diff --git a/Source/Core/VideoBackends/D3D/main.h b/Source/Core/VideoBackends/D3D/main.h
index 4932c0e..023ad44 100644
--- a/Source/Core/VideoBackends/D3D/main.h
+++ b/Source/Core/VideoBackends/D3D/main.h
@@ -4,5 +4,5 @@
#pragma once
-#include "Render.h"
-#include "MainBase.h"
+#include "VideoBackends/D3D/Render.h"
+#include "VideoCommon/MainBase.h"
diff --git a/Source/Core/VideoBackends/D3D/stdafx.cpp b/Source/Core/VideoBackends/D3D/stdafx.cpp
index 7c408e1..195c34a 100644
--- a/Source/Core/VideoBackends/D3D/stdafx.cpp
+++ b/Source/Core/VideoBackends/D3D/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
\ No newline at end of file
+#include "VideoBackends/D3D/stdafx.h"
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp
index d2169a7..9913bb2 100644
--- a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp
+++ b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp
@@ -2,15 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-#include "FramebufferManager.h"
-#include "VertexShaderGen.h"
-#include "OnScreenDisplay.h"
-#include "DriverDetails.h"
-
-#include "TextureConverter.h"
-#include "Render.h"
-#include "HW/Memmap.h"
+#include "Core/HW/Memmap.h"
+
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/TextureConverter.h"
+
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/VertexShaderGen.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.h b/Source/Core/VideoBackends/OGL/FramebufferManager.h
index 34c8b80..db63955 100644
--- a/Source/Core/VideoBackends/OGL/FramebufferManager.h
+++ b/Source/Core/VideoBackends/OGL/FramebufferManager.h
@@ -4,10 +4,11 @@
#pragma once
-#include "GLUtil.h"
-#include "FramebufferManagerBase.h"
-#include "ProgramShaderCache.h"
-#include "Render.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+
+#include "VideoCommon/FramebufferManagerBase.h"
// On the GameCube, the game sends a request for the graphics processor to
// transfer its internal EFB (Embedded Framebuffer) to an area in GameCube RAM
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h
index e765d6d..32ebf8b 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLCLEARDEPTHFPROC glClearDepthf;
extern PFNGLDEPTHRANGEFPROC glDepthRangef;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h
index 4e80990..990dc72 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glBindFragDataLocationIndexed;
extern PFNGLGETFRAGDATAINDEXPROC glGetFragDataIndex;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h
index 328f926..02644c1 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBUFFERSTORAGEPROC glBufferStorage;
extern PFNGLNAMEDBUFFERSTORAGEEXTPROC glNamedBufferStorageEXT;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_debug_output.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_debug_output.h
index 75ab8c7..1615299 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_debug_output.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_debug_output.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h
index 3604090..bec2598 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex;
extern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glDrawElementsInstancedBaseVertex;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_framebuffer_object.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_framebuffer_object.h
index d3ac931..96841a2 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_framebuffer_object.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_framebuffer_object.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
extern PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_get_program_binary.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_get_program_binary.h
index 88bed77..fc4214b 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_get_program_binary.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_get_program_binary.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLGETPROGRAMBINARYPROC glGetProgramBinary;
extern PFNGLPROGRAMBINARYPROC glProgramBinary;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_map_buffer_range.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_map_buffer_range.h
index 61ce3b0..6cde034 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_map_buffer_range.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_map_buffer_range.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange;
extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sample_shading.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sample_shading.h
index 7afdb0d..b2d3b15 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sample_shading.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sample_shading.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLMINSAMPLESHADINGARBPROC glMinSampleShadingARB;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sampler_objects.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sampler_objects.h
index 5bcba28..75031aa 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sampler_objects.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sampler_objects.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBINDSAMPLERPROC glBindSampler;
extern PFNGLDELETESAMPLERSPROC glDeleteSamplers;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sync.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sync.h
index 154ae14..bbdf2f2 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sync.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_sync.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLCLIENTWAITSYNCPROC glClientWaitSync;
extern PFNGLDELETESYNCPROC glDeleteSync;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_uniform_buffer_object.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_uniform_buffer_object.h
index 2840732..0fd26ba 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_uniform_buffer_object.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_uniform_buffer_object.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_vertex_array_object.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_vertex_array_object.h
index 5807814..a8ef567 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_vertex_array_object.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_vertex_array_object.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_viewport_array.h b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_viewport_array.h
index 9b81bed..4c6b734 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/ARB_viewport_array.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/ARB_viewport_array.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLDEPTHRANGEARRAYVPROC glDepthRangeArrayv;
extern PFNGLDEPTHRANGEINDEXEDPROC glDepthRangeIndexed;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
index db6d758..3e690cc 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
@@ -2,14 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GLExtensions.h"
-#include "Log.h"
+#include <sstream>
+#include <unordered_map>
+
+#include "Common/Log.h"
+#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#if defined(__linux__) || defined(__APPLE__)
#include <dlfcn.h>
#endif
-#include <unordered_map>
-#include <sstream>
// gl_1_1
PFNGLCLEARINDEXPROC glClearIndex;
@@ -771,41 +772,810 @@ PFNGLPUSHDEBUGGROUPPROC glPushDebugGroup;
PFNGLBUFFERSTORAGEPROC glBufferStorage;
PFNGLNAMEDBUFFERSTORAGEEXTPROC glNamedBufferStorageEXT;
+// Creates a GLFunc object that requires a feature
+#define GLFUNC_REQUIRES(x, y) { (void**)&x, #x, y }
+// Creates a GLFunc object with a different function suffix
+// For when we want to use the same function pointer, but different function name
+#define GLFUNC_SUFFIX(x, y, z) { (void**)&x, #x #y, z }
+// Creates a GLFunc object that should always be able to get grabbed
+// Used for OpenGL functions that should /always/ be provided.
+// aka GL 1.1/1.2/1.3/1.4
+#define GLFUNC_ALWAYS_REQUIRED(x) { (void**)&x, #x, "" }
+
+struct GLFunc
+{
+ void** function_ptr;
+ const std::string function_name;
+ const std::string requirements;
+};
+
+const GLFunc gl_function_array[] =
+{
+ // gl_1_1
+ GLFUNC_ALWAYS_REQUIRED(glClearIndex),
+ GLFUNC_ALWAYS_REQUIRED(glClearColor),
+ GLFUNC_ALWAYS_REQUIRED(glClear),
+ GLFUNC_ALWAYS_REQUIRED(glIndexMask),
+ GLFUNC_ALWAYS_REQUIRED(glColorMask),
+ GLFUNC_ALWAYS_REQUIRED(glAlphaFunc),
+ GLFUNC_ALWAYS_REQUIRED(glBlendFunc),
+ GLFUNC_ALWAYS_REQUIRED(glLogicOp),
+ GLFUNC_ALWAYS_REQUIRED(glCullFace),
+ GLFUNC_ALWAYS_REQUIRED(glFrontFace),
+ GLFUNC_ALWAYS_REQUIRED(glPointSize),
+ GLFUNC_ALWAYS_REQUIRED(glLineWidth),
+ GLFUNC_ALWAYS_REQUIRED(glLineStipple),
+ GLFUNC_ALWAYS_REQUIRED(glPolygonMode),
+ GLFUNC_ALWAYS_REQUIRED(glPolygonOffset),
+ GLFUNC_ALWAYS_REQUIRED(glPolygonStipple),
+ GLFUNC_ALWAYS_REQUIRED(glGetPolygonStipple),
+ GLFUNC_ALWAYS_REQUIRED(glEdgeFlag),
+ GLFUNC_ALWAYS_REQUIRED(glEdgeFlagv),
+ GLFUNC_ALWAYS_REQUIRED(glScissor),
+ GLFUNC_ALWAYS_REQUIRED(glClipPlane),
+ GLFUNC_ALWAYS_REQUIRED(glGetClipPlane),
+ GLFUNC_ALWAYS_REQUIRED(glDrawBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glReadBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glEnable),
+ GLFUNC_ALWAYS_REQUIRED(glDisable),
+ GLFUNC_ALWAYS_REQUIRED(glIsEnabled),
+ GLFUNC_ALWAYS_REQUIRED(glEnableClientState),
+ GLFUNC_ALWAYS_REQUIRED(glDisableClientState),
+ GLFUNC_ALWAYS_REQUIRED(glGetBooleanv),
+ GLFUNC_ALWAYS_REQUIRED(glGetDoublev),
+ GLFUNC_ALWAYS_REQUIRED(glGetFloatv),
+ GLFUNC_ALWAYS_REQUIRED(glPushAttrib),
+ GLFUNC_ALWAYS_REQUIRED(glPopAttrib),
+ GLFUNC_ALWAYS_REQUIRED(glPushClientAttrib),
+ GLFUNC_ALWAYS_REQUIRED(glPopClientAttrib),
+ GLFUNC_ALWAYS_REQUIRED(glRenderMode),
+ GLFUNC_ALWAYS_REQUIRED(glFinish),
+ GLFUNC_ALWAYS_REQUIRED(glFlush),
+ GLFUNC_ALWAYS_REQUIRED(glHint),
+ GLFUNC_ALWAYS_REQUIRED(glClearDepth),
+ GLFUNC_ALWAYS_REQUIRED(glDepthFunc),
+ GLFUNC_ALWAYS_REQUIRED(glDepthMask),
+ GLFUNC_ALWAYS_REQUIRED(glDepthRange),
+ GLFUNC_ALWAYS_REQUIRED(glClearAccum),
+ GLFUNC_ALWAYS_REQUIRED(glAccum),
+ GLFUNC_ALWAYS_REQUIRED(glMatrixMode),
+ GLFUNC_ALWAYS_REQUIRED(glOrtho),
+ GLFUNC_ALWAYS_REQUIRED(glFrustum),
+ GLFUNC_ALWAYS_REQUIRED(glViewport),
+ GLFUNC_ALWAYS_REQUIRED(glPushMatrix),
+ GLFUNC_ALWAYS_REQUIRED(glPopMatrix),
+ GLFUNC_ALWAYS_REQUIRED(glLoadIdentity),
+ GLFUNC_ALWAYS_REQUIRED(glLoadMatrixd),
+ GLFUNC_ALWAYS_REQUIRED(glLoadMatrixf),
+ GLFUNC_ALWAYS_REQUIRED(glMultMatrixd),
+ GLFUNC_ALWAYS_REQUIRED(glMultMatrixf),
+ GLFUNC_ALWAYS_REQUIRED(glRotated),
+ GLFUNC_ALWAYS_REQUIRED(glRotatef),
+ GLFUNC_ALWAYS_REQUIRED(glScaled),
+ GLFUNC_ALWAYS_REQUIRED(glScalef),
+ GLFUNC_ALWAYS_REQUIRED(glTranslated),
+ GLFUNC_ALWAYS_REQUIRED(glTranslatef),
+ GLFUNC_ALWAYS_REQUIRED(glIsList),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteLists),
+ GLFUNC_ALWAYS_REQUIRED(glGenLists),
+ GLFUNC_ALWAYS_REQUIRED(glNewList),
+ GLFUNC_ALWAYS_REQUIRED(glEndList),
+ GLFUNC_ALWAYS_REQUIRED(glCallList),
+ GLFUNC_ALWAYS_REQUIRED(glCallLists),
+ GLFUNC_ALWAYS_REQUIRED(glListBase),
+ GLFUNC_ALWAYS_REQUIRED(glBegin),
+ GLFUNC_ALWAYS_REQUIRED(glEnd),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2d),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2f),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2i),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2s),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3d),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3f),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3i),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3s),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4d),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4f),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4i),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4s),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2iv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex2sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3iv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex3sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4iv),
+ GLFUNC_ALWAYS_REQUIRED(glVertex4sv),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3b),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3d),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3f),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3i),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3s),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3bv),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3dv),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3fv),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3iv),
+ GLFUNC_ALWAYS_REQUIRED(glNormal3sv),
+ GLFUNC_ALWAYS_REQUIRED(glIndexd),
+ GLFUNC_ALWAYS_REQUIRED(glIndexf),
+ GLFUNC_ALWAYS_REQUIRED(glIndexi),
+ GLFUNC_ALWAYS_REQUIRED(glIndexs),
+ GLFUNC_ALWAYS_REQUIRED(glIndexub),
+ GLFUNC_ALWAYS_REQUIRED(glIndexdv),
+ GLFUNC_ALWAYS_REQUIRED(glIndexfv),
+ GLFUNC_ALWAYS_REQUIRED(glIndexiv),
+ GLFUNC_ALWAYS_REQUIRED(glIndexsv),
+ GLFUNC_ALWAYS_REQUIRED(glIndexubv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3b),
+ GLFUNC_ALWAYS_REQUIRED(glColor3d),
+ GLFUNC_ALWAYS_REQUIRED(glColor3f),
+ GLFUNC_ALWAYS_REQUIRED(glColor3i),
+ GLFUNC_ALWAYS_REQUIRED(glColor3s),
+ GLFUNC_ALWAYS_REQUIRED(glColor3ub),
+ GLFUNC_ALWAYS_REQUIRED(glColor3ui),
+ GLFUNC_ALWAYS_REQUIRED(glColor3us),
+ GLFUNC_ALWAYS_REQUIRED(glColor4b),
+ GLFUNC_ALWAYS_REQUIRED(glColor4d),
+ GLFUNC_ALWAYS_REQUIRED(glColor4f),
+ GLFUNC_ALWAYS_REQUIRED(glColor4i),
+ GLFUNC_ALWAYS_REQUIRED(glColor4s),
+ GLFUNC_ALWAYS_REQUIRED(glColor4ub),
+ GLFUNC_ALWAYS_REQUIRED(glColor4ui),
+ GLFUNC_ALWAYS_REQUIRED(glColor4us),
+ GLFUNC_ALWAYS_REQUIRED(glColor3bv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3dv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3fv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3iv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3sv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3ubv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3uiv),
+ GLFUNC_ALWAYS_REQUIRED(glColor3usv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4bv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4dv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4fv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4iv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4sv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4ubv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4uiv),
+ GLFUNC_ALWAYS_REQUIRED(glColor4usv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1d),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1f),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1i),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1s),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2d),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2f),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2i),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2s),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3d),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3f),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3i),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3s),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4d),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4f),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4i),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4s),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1dv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1fv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1iv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord1sv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2dv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2fv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2iv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord2sv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3dv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3fv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3iv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord3sv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4dv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4fv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4iv),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoord4sv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2d),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2f),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2i),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2s),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3d),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3f),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3i),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3s),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4d),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4f),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4i),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4s),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2dv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2fv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2iv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos2sv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3dv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3fv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3iv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos3sv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4dv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4fv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4iv),
+ GLFUNC_ALWAYS_REQUIRED(glRasterPos4sv),
+ GLFUNC_ALWAYS_REQUIRED(glRectd),
+ GLFUNC_ALWAYS_REQUIRED(glRectf),
+ GLFUNC_ALWAYS_REQUIRED(glRecti),
+ GLFUNC_ALWAYS_REQUIRED(glRects),
+ GLFUNC_ALWAYS_REQUIRED(glRectdv),
+ GLFUNC_ALWAYS_REQUIRED(glRectfv),
+ GLFUNC_ALWAYS_REQUIRED(glRectiv),
+ GLFUNC_ALWAYS_REQUIRED(glRectsv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexPointer),
+ GLFUNC_ALWAYS_REQUIRED(glNormalPointer),
+ GLFUNC_ALWAYS_REQUIRED(glColorPointer),
+ GLFUNC_ALWAYS_REQUIRED(glIndexPointer),
+ GLFUNC_ALWAYS_REQUIRED(glTexCoordPointer),
+ GLFUNC_ALWAYS_REQUIRED(glEdgeFlagPointer),
+ GLFUNC_ALWAYS_REQUIRED(glGetPointerv),
+ GLFUNC_ALWAYS_REQUIRED(glArrayElement),
+ GLFUNC_ALWAYS_REQUIRED(glDrawArrays),
+ GLFUNC_ALWAYS_REQUIRED(glDrawElements),
+ GLFUNC_ALWAYS_REQUIRED(glInterleavedArrays),
+ GLFUNC_ALWAYS_REQUIRED(glShadeModel),
+ GLFUNC_ALWAYS_REQUIRED(glLightf),
+ GLFUNC_ALWAYS_REQUIRED(glLighti),
+ GLFUNC_ALWAYS_REQUIRED(glLightfv),
+ GLFUNC_ALWAYS_REQUIRED(glLightiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetLightfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetLightiv),
+ GLFUNC_ALWAYS_REQUIRED(glLightModelf),
+ GLFUNC_ALWAYS_REQUIRED(glLightModeli),
+ GLFUNC_ALWAYS_REQUIRED(glLightModelfv),
+ GLFUNC_ALWAYS_REQUIRED(glLightModeliv),
+ GLFUNC_ALWAYS_REQUIRED(glMaterialf),
+ GLFUNC_ALWAYS_REQUIRED(glMateriali),
+ GLFUNC_ALWAYS_REQUIRED(glMaterialfv),
+ GLFUNC_ALWAYS_REQUIRED(glMaterialiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetMaterialfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetMaterialiv),
+ GLFUNC_ALWAYS_REQUIRED(glColorMaterial),
+ GLFUNC_ALWAYS_REQUIRED(glPixelZoom),
+ GLFUNC_ALWAYS_REQUIRED(glPixelStoref),
+ GLFUNC_ALWAYS_REQUIRED(glPixelStorei),
+ GLFUNC_ALWAYS_REQUIRED(glPixelTransferf),
+ GLFUNC_ALWAYS_REQUIRED(glPixelTransferi),
+ GLFUNC_ALWAYS_REQUIRED(glPixelMapfv),
+ GLFUNC_ALWAYS_REQUIRED(glPixelMapuiv),
+ GLFUNC_ALWAYS_REQUIRED(glPixelMapusv),
+ GLFUNC_ALWAYS_REQUIRED(glGetPixelMapfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetPixelMapuiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetPixelMapusv),
+ GLFUNC_ALWAYS_REQUIRED(glBitmap),
+ GLFUNC_ALWAYS_REQUIRED(glReadPixels),
+ GLFUNC_ALWAYS_REQUIRED(glDrawPixels),
+ GLFUNC_ALWAYS_REQUIRED(glCopyPixels),
+ GLFUNC_ALWAYS_REQUIRED(glStencilFunc),
+ GLFUNC_ALWAYS_REQUIRED(glStencilMask),
+ GLFUNC_ALWAYS_REQUIRED(glStencilOp),
+ GLFUNC_ALWAYS_REQUIRED(glClearStencil),
+ GLFUNC_ALWAYS_REQUIRED(glTexGend),
+ GLFUNC_ALWAYS_REQUIRED(glTexGenf),
+ GLFUNC_ALWAYS_REQUIRED(glTexGeni),
+ GLFUNC_ALWAYS_REQUIRED(glTexGendv),
+ GLFUNC_ALWAYS_REQUIRED(glTexGenfv),
+ GLFUNC_ALWAYS_REQUIRED(glTexGeniv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexGendv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexGenfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexGeniv),
+ GLFUNC_ALWAYS_REQUIRED(glTexEnvf),
+ GLFUNC_ALWAYS_REQUIRED(glTexEnvi),
+ GLFUNC_ALWAYS_REQUIRED(glTexEnvfv),
+ GLFUNC_ALWAYS_REQUIRED(glTexEnviv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexEnvfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexEnviv),
+ GLFUNC_ALWAYS_REQUIRED(glTexParameterf),
+ GLFUNC_ALWAYS_REQUIRED(glTexParameteri),
+ GLFUNC_ALWAYS_REQUIRED(glTexParameterfv),
+ GLFUNC_ALWAYS_REQUIRED(glTexParameteriv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexParameterfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexParameteriv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexLevelParameterfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexLevelParameteriv),
+ GLFUNC_ALWAYS_REQUIRED(glTexImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glTexImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glGetTexImage),
+ GLFUNC_ALWAYS_REQUIRED(glGenTextures),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteTextures),
+ GLFUNC_ALWAYS_REQUIRED(glBindTexture),
+ GLFUNC_ALWAYS_REQUIRED(glPrioritizeTextures),
+ GLFUNC_ALWAYS_REQUIRED(glAreTexturesResident),
+ GLFUNC_ALWAYS_REQUIRED(glIsTexture),
+ GLFUNC_ALWAYS_REQUIRED(glTexSubImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glTexSubImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glCopyTexImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glCopyTexImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glCopyTexSubImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glCopyTexSubImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glMap1d),
+ GLFUNC_ALWAYS_REQUIRED(glMap1f),
+ GLFUNC_ALWAYS_REQUIRED(glMap2d),
+ GLFUNC_ALWAYS_REQUIRED(glMap2f),
+ GLFUNC_ALWAYS_REQUIRED(glGetMapdv),
+ GLFUNC_ALWAYS_REQUIRED(glGetMapfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetMapiv),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord1d),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord1f),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord1dv),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord1fv),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord2d),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord2f),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord2dv),
+ GLFUNC_ALWAYS_REQUIRED(glEvalCoord2fv),
+ GLFUNC_ALWAYS_REQUIRED(glMapGrid1d),
+ GLFUNC_ALWAYS_REQUIRED(glMapGrid1f),
+ GLFUNC_ALWAYS_REQUIRED(glMapGrid2d),
+ GLFUNC_ALWAYS_REQUIRED(glMapGrid2f),
+ GLFUNC_ALWAYS_REQUIRED(glEvalPoint1),
+ GLFUNC_ALWAYS_REQUIRED(glEvalPoint2),
+ GLFUNC_ALWAYS_REQUIRED(glEvalMesh1),
+ GLFUNC_ALWAYS_REQUIRED(glEvalMesh2),
+ GLFUNC_ALWAYS_REQUIRED(glFogf),
+ GLFUNC_ALWAYS_REQUIRED(glFogi),
+ GLFUNC_ALWAYS_REQUIRED(glFogfv),
+ GLFUNC_ALWAYS_REQUIRED(glFogiv),
+ GLFUNC_ALWAYS_REQUIRED(glFeedbackBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glPassThrough),
+ GLFUNC_ALWAYS_REQUIRED(glSelectBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glInitNames),
+ GLFUNC_ALWAYS_REQUIRED(glLoadName),
+ GLFUNC_ALWAYS_REQUIRED(glPushName),
+ GLFUNC_ALWAYS_REQUIRED(glPopName),
+
+ // gl_1_2
+ GLFUNC_ALWAYS_REQUIRED(glCopyTexSubImage3D),
+ GLFUNC_ALWAYS_REQUIRED(glDrawRangeElements),
+ GLFUNC_ALWAYS_REQUIRED(glTexImage3D),
+ GLFUNC_ALWAYS_REQUIRED(glTexSubImage3D),
+
+ // gl_1_3
+ GLFUNC_ALWAYS_REQUIRED(glActiveTexture),
+ GLFUNC_ALWAYS_REQUIRED(glClientActiveTexture),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexImage3D),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexSubImage1D),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexSubImage2D),
+ GLFUNC_ALWAYS_REQUIRED(glCompressedTexSubImage3D),
+ GLFUNC_ALWAYS_REQUIRED(glGetCompressedTexImage),
+ GLFUNC_ALWAYS_REQUIRED(glLoadTransposeMatrixd),
+ GLFUNC_ALWAYS_REQUIRED(glLoadTransposeMatrixf),
+ GLFUNC_ALWAYS_REQUIRED(glMultTransposeMatrixd),
+ GLFUNC_ALWAYS_REQUIRED(glMultTransposeMatrixf),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1d),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1dv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1f),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1fv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1i),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1iv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1s),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1sv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2d),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2dv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2f),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2fv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2i),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2iv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2s),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2sv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3d),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3dv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3f),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3fv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3i),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3iv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3s),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3sv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4d),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4dv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4f),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4fv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4i),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4iv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4s),
+ GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4sv),
+ GLFUNC_ALWAYS_REQUIRED(glSampleCoverage),
+
+ // gl_1_4
+ GLFUNC_ALWAYS_REQUIRED(glBlendColor),
+ GLFUNC_ALWAYS_REQUIRED(glBlendEquation),
+ GLFUNC_ALWAYS_REQUIRED(glBlendFuncSeparate),
+ GLFUNC_ALWAYS_REQUIRED(glFogCoordPointer),
+ GLFUNC_ALWAYS_REQUIRED(glFogCoordd),
+ GLFUNC_ALWAYS_REQUIRED(glFogCoorddv),
+ GLFUNC_ALWAYS_REQUIRED(glFogCoordf),
+ GLFUNC_ALWAYS_REQUIRED(glFogCoordfv),
+ GLFUNC_ALWAYS_REQUIRED(glMultiDrawArrays),
+ GLFUNC_ALWAYS_REQUIRED(glMultiDrawElements),
+ GLFUNC_ALWAYS_REQUIRED(glPointParameterf),
+ GLFUNC_ALWAYS_REQUIRED(glPointParameterfv),
+ GLFUNC_ALWAYS_REQUIRED(glPointParameteri),
+ GLFUNC_ALWAYS_REQUIRED(glPointParameteriv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3b),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3bv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3d),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3dv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3f),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3fv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3i),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3iv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3s),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3sv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ub),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ubv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ui),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3uiv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3us),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3usv),
+ GLFUNC_ALWAYS_REQUIRED(glSecondaryColorPointer),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2d),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2dv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2f),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2fv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2i),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2iv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2s),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos2sv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3d),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3dv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3f),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3fv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3i),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3iv),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3s),
+ GLFUNC_ALWAYS_REQUIRED(glWindowPos3sv),
+
+ // gl_1_5
+ GLFUNC_ALWAYS_REQUIRED(glBeginQuery),
+ GLFUNC_ALWAYS_REQUIRED(glBindBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glBufferData),
+ GLFUNC_ALWAYS_REQUIRED(glBufferSubData),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteBuffers),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteQueries),
+ GLFUNC_ALWAYS_REQUIRED(glEndQuery),
+ GLFUNC_ALWAYS_REQUIRED(glGenBuffers),
+ GLFUNC_ALWAYS_REQUIRED(glGenQueries),
+ GLFUNC_ALWAYS_REQUIRED(glGetBufferParameteriv),
+ GLFUNC_ALWAYS_REQUIRED(glGetBufferPointerv),
+ GLFUNC_ALWAYS_REQUIRED(glGetBufferSubData),
+ GLFUNC_ALWAYS_REQUIRED(glGetQueryObjectiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetQueryObjectuiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetQueryiv),
+ GLFUNC_ALWAYS_REQUIRED(glIsBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glIsQuery),
+ GLFUNC_ALWAYS_REQUIRED(glMapBuffer),
+ GLFUNC_ALWAYS_REQUIRED(glUnmapBuffer),
+
+ // gl_2_0
+ GLFUNC_ALWAYS_REQUIRED(glAttachShader),
+ GLFUNC_ALWAYS_REQUIRED(glBindAttribLocation),
+ GLFUNC_ALWAYS_REQUIRED(glBlendEquationSeparate),
+ GLFUNC_ALWAYS_REQUIRED(glCompileShader),
+ GLFUNC_ALWAYS_REQUIRED(glCreateProgram),
+ GLFUNC_ALWAYS_REQUIRED(glCreateShader),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteProgram),
+ GLFUNC_ALWAYS_REQUIRED(glDeleteShader),
+ GLFUNC_ALWAYS_REQUIRED(glDetachShader),
+ GLFUNC_ALWAYS_REQUIRED(glDisableVertexAttribArray),
+ GLFUNC_ALWAYS_REQUIRED(glDrawBuffers),
+ GLFUNC_ALWAYS_REQUIRED(glEnableVertexAttribArray),
+ GLFUNC_ALWAYS_REQUIRED(glGetActiveAttrib),
+ GLFUNC_ALWAYS_REQUIRED(glGetActiveUniform),
+ GLFUNC_ALWAYS_REQUIRED(glGetAttachedShaders),
+ GLFUNC_ALWAYS_REQUIRED(glGetAttribLocation),
+ GLFUNC_ALWAYS_REQUIRED(glGetProgramInfoLog),
+ GLFUNC_ALWAYS_REQUIRED(glGetProgramiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetShaderInfoLog),
+ GLFUNC_ALWAYS_REQUIRED(glGetShaderSource),
+ GLFUNC_ALWAYS_REQUIRED(glGetShaderiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetUniformLocation),
+ GLFUNC_ALWAYS_REQUIRED(glGetUniformfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetUniformiv),
+ GLFUNC_ALWAYS_REQUIRED(glGetVertexAttribPointerv),
+ GLFUNC_ALWAYS_REQUIRED(glGetVertexAttribdv),
+ GLFUNC_ALWAYS_REQUIRED(glGetVertexAttribfv),
+ GLFUNC_ALWAYS_REQUIRED(glGetVertexAttribiv),
+ GLFUNC_ALWAYS_REQUIRED(glIsProgram),
+ GLFUNC_ALWAYS_REQUIRED(glIsShader),
+ GLFUNC_ALWAYS_REQUIRED(glLinkProgram),
+ GLFUNC_ALWAYS_REQUIRED(glShaderSource),
+ GLFUNC_ALWAYS_REQUIRED(glStencilFuncSeparate),
+ GLFUNC_ALWAYS_REQUIRED(glStencilMaskSeparate),
+ GLFUNC_ALWAYS_REQUIRED(glStencilOpSeparate),
+ GLFUNC_ALWAYS_REQUIRED(glUniform1f),
+ GLFUNC_ALWAYS_REQUIRED(glUniform1fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform1i),
+ GLFUNC_ALWAYS_REQUIRED(glUniform1iv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform2f),
+ GLFUNC_ALWAYS_REQUIRED(glUniform2fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform2i),
+ GLFUNC_ALWAYS_REQUIRED(glUniform2iv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform3f),
+ GLFUNC_ALWAYS_REQUIRED(glUniform3fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform3i),
+ GLFUNC_ALWAYS_REQUIRED(glUniform3iv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform4f),
+ GLFUNC_ALWAYS_REQUIRED(glUniform4fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniform4i),
+ GLFUNC_ALWAYS_REQUIRED(glUniform4iv),
+ GLFUNC_ALWAYS_REQUIRED(glUniformMatrix2fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniformMatrix3fv),
+ GLFUNC_ALWAYS_REQUIRED(glUniformMatrix4fv),
+ GLFUNC_ALWAYS_REQUIRED(glUseProgram),
+ GLFUNC_ALWAYS_REQUIRED(glValidateProgram),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1d),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1f),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1s),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2d),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2f),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2s),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3d),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3f),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3s),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nbv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Niv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nsv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nub),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nubv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nuiv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nusv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4bv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4d),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4dv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4f),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4fv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4iv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4s),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4sv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4ubv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4uiv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4usv),
+ GLFUNC_ALWAYS_REQUIRED(glVertexAttribPointer),
+
+ // gl_3_0
+ GLFUNC_REQUIRES(glBeginConditionalRender, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glBeginTransformFeedback, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glBindFragDataLocation, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glClampColor, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glClearBufferfi, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glClearBufferfv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glClearBufferiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glClearBufferuiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glColorMaski, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glDisablei, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glEnablei, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glEndConditionalRender, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glEndTransformFeedback, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetBooleani_v, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetFragDataLocation, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetStringi, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetTexParameterIiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetTexParameterIuiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetTransformFeedbackVarying, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetUniformuiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetVertexAttribIiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glGetVertexAttribIuiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glIsEnabledi, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glTexParameterIiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glTexParameterIuiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glTransformFeedbackVaryings, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform1ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform1uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform2ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform2uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform3ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform3uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform4ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glUniform4uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI1i, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI1iv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI1ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI1uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI2i, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI2iv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI2ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI2uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI3i, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI3iv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI3ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI3uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4bv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4i, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4iv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4sv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4ubv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4ui, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4uiv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribI4usv, "VERSION_3_0"),
+ GLFUNC_REQUIRES(glVertexAttribIPointer, "VERSION_3_0"),
+
+ // gl_3_1
+ GLFUNC_REQUIRES(glDrawArraysInstanced, "VERSION_3_1"),
+ GLFUNC_REQUIRES(glDrawElementsInstanced, "VERSION_3_1"),
+ GLFUNC_REQUIRES(glPrimitiveRestartIndex, "VERSION_3_1"),
+ GLFUNC_REQUIRES(glTexBuffer, "VERSION_3_1"),
+
+ // gl_3_2
+ GLFUNC_REQUIRES(glFramebufferTexture, "VERSION_3_2"),
+ GLFUNC_REQUIRES(glGetBufferParameteri64v, "VERSION_3_2"),
+ GLFUNC_REQUIRES(glGetInteger64i_v, "VERSION_3_2"),
+
+ // ARB_uniform_buffer_object
+ GLFUNC_REQUIRES(glBindBufferBase, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glBindBufferRange, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetActiveUniformBlockName, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetActiveUniformBlockiv, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetActiveUniformName, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetActiveUniformsiv, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetIntegeri_v, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetUniformBlockIndex, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glGetUniformIndices, "GL_ARB_uniform_buffer_object"),
+ GLFUNC_REQUIRES(glUniformBlockBinding, "GL_ARB_uniform_buffer_object"),
+
+ // ARB_sampler_objects
+ GLFUNC_REQUIRES(glBindSampler, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glDeleteSamplers, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glGenSamplers, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glGetSamplerParameterIiv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glGetSamplerParameterIuiv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glGetSamplerParameterfv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glGetSamplerParameteriv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glIsSampler, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameterIiv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameterIuiv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameterf, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameterfv, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameteri, "GL_ARB_sampler_objects"),
+ GLFUNC_REQUIRES(glSamplerParameteriv, "GL_ARB_sampler_objects"),
+
+ // ARB_map_buffer_range
+ GLFUNC_REQUIRES(glFlushMappedBufferRange, "GL_ARB_map_buffer_range"),
+ GLFUNC_REQUIRES(glMapBufferRange, "GL_ARB_map_buffer_range"),
+
+ // ARB_vertex_array_object
+ GLFUNC_REQUIRES(glBindVertexArray, "GL_ARB_vertex_array_object"),
+ GLFUNC_REQUIRES(glDeleteVertexArrays, "GL_ARB_vertex_array_object"),
+ GLFUNC_REQUIRES(glGenVertexArrays, "GL_ARB_vertex_array_object"),
+ GLFUNC_REQUIRES(glIsVertexArray, "GL_ARB_vertex_array_object"),
+
+ // APPLE_vertex_array_object
+ GLFUNC_SUFFIX(glBindVertexArray, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"),
+ GLFUNC_SUFFIX(glDeleteVertexArrays, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"),
+ GLFUNC_SUFFIX(glGenVertexArrays, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"),
+ GLFUNC_SUFFIX(glIsVertexArray, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"),
+
+ // ARB_framebuffer_object
+ GLFUNC_REQUIRES(glBindFramebuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glBindRenderbuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glBlitFramebuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glCheckFramebufferStatus, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glDeleteFramebuffers, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glDeleteRenderbuffers, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glFramebufferRenderbuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glFramebufferTexture1D, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glFramebufferTexture2D, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glFramebufferTexture3D, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glFramebufferTextureLayer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glGenFramebuffers, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glGenRenderbuffers, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glGenerateMipmap, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glGetFramebufferAttachmentParameteriv, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glGetRenderbufferParameteriv, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glIsFramebuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glIsRenderbuffer, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glRenderbufferStorage, "GL_ARB_framebuffer_object"),
+ GLFUNC_REQUIRES(glRenderbufferStorageMultisample, "GL_ARB_framebuffer_object"),
+
+ // ARB_get_program_binary
+ GLFUNC_REQUIRES(glGetProgramBinary, "GL_ARB_get_program_binary"),
+ GLFUNC_REQUIRES(glProgramBinary, "GL_ARB_get_program_binary"),
+ GLFUNC_REQUIRES(glProgramParameteri, "GL_ARB_get_program_binary"),
+
+ // ARB_sync
+ GLFUNC_REQUIRES(glClientWaitSync, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glDeleteSync, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glFenceSync, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glGetInteger64v, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glGetSynciv, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glIsSync, "GL_ARB_sync"),
+ GLFUNC_REQUIRES(glWaitSync, "GL_ARB_sync"),
+
+ // ARB_ES2_compatibility
+ GLFUNC_REQUIRES(glClearDepthf, "GL_ARB_ES2_compatibility"),
+ GLFUNC_REQUIRES(glDepthRangef, "GL_ARB_ES2_compatibility"),
+ GLFUNC_REQUIRES(glGetShaderPrecisionFormat, "GL_ARB_ES2_compatibility"),
+ GLFUNC_REQUIRES(glReleaseShaderCompiler, "GL_ARB_ES2_compatibility"),
+ GLFUNC_REQUIRES(glShaderBinary, "GL_ARB_ES2_compatibility"),
+
+ // NV_primitive_restart
+ GLFUNC_REQUIRES(glPrimitiveRestartIndexNV, "GL_NV_primitive_restart"),
+ GLFUNC_REQUIRES(glPrimitiveRestartNV, "GL_NV_primitive_restart"),
+
+ // ARB_blend_func_extended
+ GLFUNC_REQUIRES(glBindFragDataLocationIndexed, "GL_ARB_blend_func_extended"),
+ GLFUNC_REQUIRES(glGetFragDataIndex, "GL_ARB_blend_func_extended"),
+
+ // ARB_viewport_array
+ GLFUNC_REQUIRES(glDepthRangeArrayv, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glDepthRangeIndexed, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glGetDoublei_v, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glGetFloati_v, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glScissorArrayv, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glScissorIndexed, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glScissorIndexedv, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glViewportArrayv, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glViewportIndexedf, "GL_ARB_viewport_array"),
+ GLFUNC_REQUIRES(glViewportIndexedfv, "GL_ARB_viewport_array"),
+
+ // ARB_draw_elements_base_vertex
+ GLFUNC_REQUIRES(glDrawElementsBaseVertex, "GL_ARB_draw_elements_base_vertex"),
+ GLFUNC_REQUIRES(glDrawElementsInstancedBaseVertex, "GL_ARB_draw_elements_base_vertex"),
+ GLFUNC_REQUIRES(glDrawRangeElementsBaseVertex, "GL_ARB_draw_elements_base_vertex"),
+ GLFUNC_REQUIRES(glMultiDrawElementsBaseVertex, "GL_ARB_draw_elements_base_vertex"),
+
+ // NV_framebuffer_multisample_coverage
+ GLFUNC_REQUIRES(glRenderbufferStorageMultisampleCoverageNV, "GL_NV_framebuffer_multisample_coverage"),
+
+ // ARB_sample_shading
+ GLFUNC_REQUIRES(glMinSampleShadingARB, "GL_ARB_sample_shading"),
+
+ // ARB_debug_output
+ GLFUNC_REQUIRES(glDebugMessageCallbackARB, "GL_ARB_debug_output"),
+ GLFUNC_REQUIRES(glDebugMessageControlARB, "GL_ARB_debug_output"),
+ GLFUNC_REQUIRES(glDebugMessageInsertARB, "GL_ARB_debug_output"),
+ GLFUNC_REQUIRES(glGetDebugMessageLogARB, "GL_ARB_debug_output"),
+
+ // KHR_debug
+ GLFUNC_SUFFIX(glDebugMessageCallback, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glDebugMessageControl, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glDebugMessageInsert, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glGetDebugMessageLog, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glGetObjectLabel, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glGetObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glObjectLabel, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glPopDebugGroup, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_SUFFIX(glPushDebugGroup, KHR, "GL_KHR_debug VERSION_GLES3"),
+ GLFUNC_REQUIRES(glDebugMessageCallback, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glDebugMessageControl, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glDebugMessageInsert, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glGetDebugMessageLog, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glGetObjectLabel, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glGetObjectPtrLabel, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glObjectLabel, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glObjectPtrLabel, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glPopDebugGroup, "GL_KHR_debug !VERSION_GLES3"),
+ GLFUNC_REQUIRES(glPushDebugGroup, "GL_KHR_debug !VERSION_GLES3"),
+
+ // ARB_buffer_storage
+ GLFUNC_REQUIRES(glBufferStorage, "GL_ARB_buffer_storage"),
+ GLFUNC_REQUIRES(glNamedBufferStorageEXT, "GL_ARB_buffer_storage GL_EXT_direct_state_access"),
+};
+
namespace GLExtensions
{
// Private members and functions
bool _isES3;
bool _isES;
u32 _GLVersion;
- std::unordered_map<std::string, bool> _extensionlist;
- // Forward declared init functions
- bool init_gl_1_1();
- bool init_gl_1_2();
- bool init_gl_1_3();
- bool init_gl_1_4();
- bool init_gl_1_5();
- bool init_gl_2_0();
- bool init_gl_3_0();
- bool init_gl_3_1();
- bool init_gl_3_2();
- bool init_arb_uniform_buffer_object();
- bool init_arb_sampler_objects();
- bool init_arb_map_buffer_range();
- bool init_arb_vertex_array_object();
- bool init_arb_framebuffer_object();
- bool init_arb_get_program_binary();
- bool init_arb_sync();
- bool init_arb_es2_compatibility();
- bool init_nv_primitive_restart();
- bool init_arb_blend_func_extended();
- bool init_arb_viewport_array();
- bool init_arb_draw_elements_base_vertex();
- bool init_nv_framebuffer_multisample_coverage();
- bool init_arb_sample_shading();
- bool init_arb_debug_output();
- bool init_khr_debug();
- bool init_arb_buffer_storage();
-
+ std::unordered_map<std::string, bool> m_extension_list;
+
+ // Private initialization functions
+ bool InitFunctionPointers();
+
// Initializes the extension list the old way
void InitExtensionList21()
{
@@ -814,12 +1584,12 @@ namespace GLExtensions
std::istringstream buffer(tmp);
while (buffer >> tmp)
- _extensionlist[tmp] = true;
+ m_extension_list[tmp] = true;
}
void InitExtensionList()
{
- _extensionlist.clear();
+ m_extension_list.clear();
if (_isES3)
{
// XXX: Add all extensions that a base ES3 implementation supports
@@ -833,9 +1603,10 @@ namespace GLExtensions
"GL_ARB_get_program_binary",
"GL_ARB_sync",
"GL_ARB_ES2_compatibility",
+ "VERSION_GLES3",
};
for (auto it : gles3exts)
- _extensionlist[it] = true;
+ m_extension_list[it] = true;
}
else if (!_isES)
{
@@ -861,9 +1632,10 @@ namespace GLExtensions
"GL_ARB_instanced_arrays",
"GL_ARB_texture_rgb10_a2ui",
"GL_ARB_vertex_type_2_10_10_10_rev",
+ "VERSION_3_3",
};
for (auto it : gl330exts)
- _extensionlist[it] = true;
+ m_extension_list[it] = true;
}
case 320:
{
@@ -877,9 +1649,10 @@ namespace GLExtensions
"GL_ARB_fragment_coord_conventions",
"GL_ARB_provoking_vertex",
"GL_ARB_depth_clamp",
+ "VERSION_3_2",
};
for (auto it : gl320exts)
- _extensionlist[it] = true;
+ m_extension_list[it] = true;
}
case 310:
{
@@ -891,9 +1664,10 @@ namespace GLExtensions
"GL_ARB_texture_rectangle",
"GL_ARB_uniform_buffer_object",
//"GL_NV_primitive_restart",
+ "VERSION_3_1",
};
for (auto it : gl310exts)
- _extensionlist[it] = true;
+ m_extension_list[it] = true;
}
case 300:
{
@@ -921,9 +1695,10 @@ namespace GLExtensions
//"GL_EXT_transform_feedback",
"GL_ARB_vertex_array_object",
//"GL_NV_conditional_render",
+ "VERSION_3_0",
};
for (auto it : gl300exts)
- _extensionlist[it] = true;
+ m_extension_list[it] = true;
}
case 210:
case 200:
@@ -937,6 +1712,7 @@ namespace GLExtensions
break;
}
}
+
if (_GLVersion < 300)
{
InitExtensionList21();
@@ -945,7 +1721,7 @@ namespace GLExtensions
GLint NumExtension = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtension);
for (GLint i = 0; i < NumExtension; ++i)
- _extensionlist[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true;
+ m_extension_list[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true;
}
void InitVersion()
{
@@ -977,32 +1753,22 @@ namespace GLExtensions
return *func;
}
- void Disable(std::string names)
- {
- std::string tmp;
- std::istringstream buffer(names);
-
- while (buffer >> tmp)
- _extensionlist[tmp] = false;
- }
-
// Public members
u32 Version() { return _GLVersion; }
bool Supports(std::string name)
{
- return _extensionlist.find(name) != _extensionlist.end();
+ return m_extension_list[name];
}
bool Init()
{
- bool success = true;
_isES3 = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3;
_isES = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 || GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES2;
// Grab a few functions for initial checking
// We need them to grab the extension list
// Also to check if there is an error grabbing the version
- // If it fails then the user's drivers don't support GL 3.0
+ // If it fails then the user's drivers don't support GL 3.0
if (GetFuncAddress ("glGetIntegerv", (void**)&glGetIntegerv) == NULL)
return false;
if (GetFuncAddress("glGetString", (void**)&glGetString) == NULL)
@@ -1015,923 +1781,32 @@ namespace GLExtensions
InitVersion();
InitExtensionList();
- if (success && !init_gl_1_1()) success = false;
- if (success && !init_gl_1_2()) success = false;
- if (success && !init_gl_1_3()) success = false;
- if (success && !init_gl_1_4()) success = false;
- if (success && !init_gl_1_5()) success = false;
- if (success && !init_gl_2_0()) success = false;
- if (success && !init_gl_3_0()) success = false;
- if (success && !init_gl_3_1()) success = false;
- if (success && !init_gl_3_2()) success = false;
- if (success)
- {
- if (!init_arb_uniform_buffer_object()) Disable("GL_ARB_uniform_buffer_object");
- if (!init_arb_sampler_objects()) Disable("GL_ARB_sampler_objects");
- if (!init_arb_map_buffer_range()) Disable("GL_ARB_map_buffer_range");
- if (!init_arb_vertex_array_object()) Disable("GL_ARB_vertex_array_object GL_APPLE_vertex_array_object");
- if (!init_arb_framebuffer_object()) Disable("GL_ARB_framebuffer_object");
- if (!init_arb_get_program_binary()) Disable("GL_ARB_get_program_binary");
- if (!init_arb_sync()) Disable("GL_ARB_sync");
- if (!init_arb_es2_compatibility()) Disable("GL_ARB_ES2_compatibility");
- if (!init_nv_primitive_restart()) Disable("GL_NV_primitive_restart");
- if (!init_arb_blend_func_extended()) Disable("GL_ARB_blend_func_extended");
- if (!init_arb_viewport_array()) Disable("GL_ARB_viewport_array");
- if (!init_arb_draw_elements_base_vertex()) Disable("GL_ARB_draw_elements_base_vertex");
- if (!init_arb_sample_shading()) Disable("GL_ARB_sample_shading");
- if (!init_arb_debug_output()) Disable("GL_ARB_debug_output");
- if (!init_nv_framebuffer_multisample_coverage()) Disable("GL_NV_framebuffer_multisample_coverage");
- if (!init_khr_debug()) Disable("GL_KHR_debug");
- if (!init_arb_buffer_storage()) Disable("GL_ARB_buffer_storage");
- }
- return success;
+ return InitFunctionPointers();
}
// Private initialization functions
-
- // These defines are slightly evil and used in all of the init_* functions
- // Pass the function name in, it'll use it as both the string to grab, and the function pointer name
- // Suffix edition adds a string suffix to the end of the function string as well
- // Upon loading the function pointer, it checks if it is NULL so we can do a simple conditional to see if it is loaded
- // eg if (GrabFunction(glGetStringi)) return true;
-
-#define GrabFunction(x) \
- (!!GetFuncAddress(#x, (void**)&x))
-#define GrabFunctionSuffix(x, y) \
- (!!GetFuncAddress(#x #y, (void**)&x))
-
- bool init_gl_1_1()
- {
- return GrabFunction(glClearIndex)
- & GrabFunction(glClearColor)
- & GrabFunction(glClear)
- & GrabFunction(glIndexMask)
- & GrabFunction(glColorMask)
- & GrabFunction(glAlphaFunc)
- & GrabFunction(glBlendFunc)
- & GrabFunction(glLogicOp)
- & GrabFunction(glCullFace)
- & GrabFunction(glFrontFace)
- & GrabFunction(glPointSize)
- & GrabFunction(glLineWidth)
- & GrabFunction(glLineStipple)
- & GrabFunction(glPolygonMode)
- & GrabFunction(glPolygonOffset)
- & GrabFunction(glPolygonStipple)
- & GrabFunction(glGetPolygonStipple)
- & GrabFunction(glEdgeFlag)
- & GrabFunction(glEdgeFlagv)
- & GrabFunction(glScissor)
- & GrabFunction(glClipPlane)
- & GrabFunction(glGetClipPlane)
- & GrabFunction(glDrawBuffer)
- & GrabFunction(glReadBuffer)
- & GrabFunction(glEnable)
- & GrabFunction(glDisable)
- & GrabFunction(glIsEnabled)
- & GrabFunction(glEnableClientState)
- & GrabFunction(glDisableClientState)
- & GrabFunction(glGetBooleanv)
- & GrabFunction(glGetDoublev)
- & GrabFunction(glGetFloatv)
- & GrabFunction(glPushAttrib)
- & GrabFunction(glPopAttrib)
- & GrabFunction(glPushClientAttrib)
- & GrabFunction(glPopClientAttrib)
- & GrabFunction(glRenderMode)
- & GrabFunction(glFinish)
- & GrabFunction(glFlush)
- & GrabFunction(glHint)
- & GrabFunction(glClearDepth)
- & GrabFunction(glDepthFunc)
- & GrabFunction(glDepthMask)
- & GrabFunction(glDepthRange)
- & GrabFunction(glClearAccum)
- & GrabFunction(glAccum)
- & GrabFunction(glMatrixMode)
- & GrabFunction(glOrtho)
- & GrabFunction(glFrustum)
- & GrabFunction(glViewport)
- & GrabFunction(glPushMatrix)
- & GrabFunction(glPopMatrix)
- & GrabFunction(glLoadIdentity)
- & GrabFunction(glLoadMatrixd)
- & GrabFunction(glLoadMatrixf)
- & GrabFunction(glMultMatrixd)
- & GrabFunction(glMultMatrixf)
- & GrabFunction(glRotated)
- & GrabFunction(glRotatef)
- & GrabFunction(glScaled)
- & GrabFunction(glScalef)
- & GrabFunction(glTranslated)
- & GrabFunction(glTranslatef)
- & GrabFunction(glIsList)
- & GrabFunction(glDeleteLists)
- & GrabFunction(glGenLists)
- & GrabFunction(glNewList)
- & GrabFunction(glEndList)
- & GrabFunction(glCallList)
- & GrabFunction(glCallLists)
- & GrabFunction(glListBase)
- & GrabFunction(glBegin)
- & GrabFunction(glEnd)
- & GrabFunction(glVertex2d)
- & GrabFunction(glVertex2f)
- & GrabFunction(glVertex2i)
- & GrabFunction(glVertex2s)
- & GrabFunction(glVertex3d)
- & GrabFunction(glVertex3f)
- & GrabFunction(glVertex3i)
- & GrabFunction(glVertex3s)
- & GrabFunction(glVertex4d)
- & GrabFunction(glVertex4f)
- & GrabFunction(glVertex4i)
- & GrabFunction(glVertex4s)
- & GrabFunction(glVertex2dv)
- & GrabFunction(glVertex2fv)
- & GrabFunction(glVertex2iv)
- & GrabFunction(glVertex2sv)
- & GrabFunction(glVertex3dv)
- & GrabFunction(glVertex3fv)
- & GrabFunction(glVertex3iv)
- & GrabFunction(glVertex3sv)
- & GrabFunction(glVertex4dv)
- & GrabFunction(glVertex4fv)
- & GrabFunction(glVertex4iv)
- & GrabFunction(glVertex4sv)
- & GrabFunction(glNormal3b)
- & GrabFunction(glNormal3d)
- & GrabFunction(glNormal3f)
- & GrabFunction(glNormal3i)
- & GrabFunction(glNormal3s)
- & GrabFunction(glNormal3bv)
- & GrabFunction(glNormal3dv)
- & GrabFunction(glNormal3fv)
- & GrabFunction(glNormal3iv)
- & GrabFunction(glNormal3sv)
- & GrabFunction(glIndexd)
- & GrabFunction(glIndexf)
- & GrabFunction(glIndexi)
- & GrabFunction(glIndexs)
- & GrabFunction(glIndexub)
- & GrabFunction(glIndexdv)
- & GrabFunction(glIndexfv)
- & GrabFunction(glIndexiv)
- & GrabFunction(glIndexsv)
- & GrabFunction(glIndexubv)
- & GrabFunction(glColor3b)
- & GrabFunction(glColor3d)
- & GrabFunction(glColor3f)
- & GrabFunction(glColor3i)
- & GrabFunction(glColor3s)
- & GrabFunction(glColor3ub)
- & GrabFunction(glColor3ui)
- & GrabFunction(glColor3us)
- & GrabFunction(glColor4b)
- & GrabFunction(glColor4d)
- & GrabFunction(glColor4f)
- & GrabFunction(glColor4i)
- & GrabFunction(glColor4s)
- & GrabFunction(glColor4ub)
- & GrabFunction(glColor4ui)
- & GrabFunction(glColor4us)
- & GrabFunction(glColor3bv)
- & GrabFunction(glColor3dv)
- & GrabFunction(glColor3fv)
- & GrabFunction(glColor3iv)
- & GrabFunction(glColor3sv)
- & GrabFunction(glColor3ubv)
- & GrabFunction(glColor3uiv)
- & GrabFunction(glColor3usv)
- & GrabFunction(glColor4bv)
- & GrabFunction(glColor4dv)
- & GrabFunction(glColor4fv)
- & GrabFunction(glColor4iv)
- & GrabFunction(glColor4sv)
- & GrabFunction(glColor4ubv)
- & GrabFunction(glColor4uiv)
- & GrabFunction(glColor4usv)
- & GrabFunction(glTexCoord1d)
- & GrabFunction(glTexCoord1f)
- & GrabFunction(glTexCoord1i)
- & GrabFunction(glTexCoord1s)
- & GrabFunction(glTexCoord2d)
- & GrabFunction(glTexCoord2f)
- & GrabFunction(glTexCoord2i)
- & GrabFunction(glTexCoord2s)
- & GrabFunction(glTexCoord3d)
- & GrabFunction(glTexCoord3f)
- & GrabFunction(glTexCoord3i)
- & GrabFunction(glTexCoord3s)
- & GrabFunction(glTexCoord4d)
- & GrabFunction(glTexCoord4f)
- & GrabFunction(glTexCoord4i)
- & GrabFunction(glTexCoord4s)
- & GrabFunction(glTexCoord1dv)
- & GrabFunction(glTexCoord1fv)
- & GrabFunction(glTexCoord1iv)
- & GrabFunction(glTexCoord1sv)
- & GrabFunction(glTexCoord2dv)
- & GrabFunction(glTexCoord2fv)
- & GrabFunction(glTexCoord2iv)
- & GrabFunction(glTexCoord2sv)
- & GrabFunction(glTexCoord3dv)
- & GrabFunction(glTexCoord3fv)
- & GrabFunction(glTexCoord3iv)
- & GrabFunction(glTexCoord3sv)
- & GrabFunction(glTexCoord4dv)
- & GrabFunction(glTexCoord4fv)
- & GrabFunction(glTexCoord4iv)
- & GrabFunction(glTexCoord4sv)
- & GrabFunction(glRasterPos2d)
- & GrabFunction(glRasterPos2f)
- & GrabFunction(glRasterPos2i)
- & GrabFunction(glRasterPos2s)
- & GrabFunction(glRasterPos3d)
- & GrabFunction(glRasterPos3f)
- & GrabFunction(glRasterPos3i)
- & GrabFunction(glRasterPos3s)
- & GrabFunction(glRasterPos4d)
- & GrabFunction(glRasterPos4f)
- & GrabFunction(glRasterPos4i)
- & GrabFunction(glRasterPos4s)
- & GrabFunction(glRasterPos2dv)
- & GrabFunction(glRasterPos2fv)
- & GrabFunction(glRasterPos2iv)
- & GrabFunction(glRasterPos2sv)
- & GrabFunction(glRasterPos3dv)
- & GrabFunction(glRasterPos3fv)
- & GrabFunction(glRasterPos3iv)
- & GrabFunction(glRasterPos3sv)
- & GrabFunction(glRasterPos4dv)
- & GrabFunction(glRasterPos4fv)
- & GrabFunction(glRasterPos4iv)
- & GrabFunction(glRasterPos4sv)
- & GrabFunction(glRectd)
- & GrabFunction(glRectf)
- & GrabFunction(glRecti)
- & GrabFunction(glRects)
- & GrabFunction(glRectdv)
- & GrabFunction(glRectfv)
- & GrabFunction(glRectiv)
- & GrabFunction(glRectsv)
- & GrabFunction(glVertexPointer)
- & GrabFunction(glNormalPointer)
- & GrabFunction(glColorPointer)
- & GrabFunction(glIndexPointer)
- & GrabFunction(glTexCoordPointer)
- & GrabFunction(glEdgeFlagPointer)
- & GrabFunction(glGetPointerv)
- & GrabFunction(glArrayElement)
- & GrabFunction(glDrawArrays)
- & GrabFunction(glDrawElements)
- & GrabFunction(glInterleavedArrays)
- & GrabFunction(glShadeModel)
- & GrabFunction(glLightf)
- & GrabFunction(glLighti)
- & GrabFunction(glLightfv)
- & GrabFunction(glLightiv)
- & GrabFunction(glGetLightfv)
- & GrabFunction(glGetLightiv)
- & GrabFunction(glLightModelf)
- & GrabFunction(glLightModeli)
- & GrabFunction(glLightModelfv)
- & GrabFunction(glLightModeliv)
- & GrabFunction(glMaterialf)
- & GrabFunction(glMateriali)
- & GrabFunction(glMaterialfv)
- & GrabFunction(glMaterialiv)
- & GrabFunction(glGetMaterialfv)
- & GrabFunction(glGetMaterialiv)
- & GrabFunction(glColorMaterial)
- & GrabFunction(glPixelZoom)
- & GrabFunction(glPixelStoref)
- & GrabFunction(glPixelStorei)
- & GrabFunction(glPixelTransferf)
- & GrabFunction(glPixelTransferi)
- & GrabFunction(glPixelMapfv)
- & GrabFunction(glPixelMapuiv)
- & GrabFunction(glPixelMapusv)
- & GrabFunction(glGetPixelMapfv)
- & GrabFunction(glGetPixelMapuiv)
- & GrabFunction(glGetPixelMapusv)
- & GrabFunction(glBitmap)
- & GrabFunction(glReadPixels)
- & GrabFunction(glDrawPixels)
- & GrabFunction(glCopyPixels)
- & GrabFunction(glStencilFunc)
- & GrabFunction(glStencilMask)
- & GrabFunction(glStencilOp)
- & GrabFunction(glClearStencil)
- & GrabFunction(glTexGend)
- & GrabFunction(glTexGenf)
- & GrabFunction(glTexGeni)
- & GrabFunction(glTexGendv)
- & GrabFunction(glTexGenfv)
- & GrabFunction(glTexGeniv)
- & GrabFunction(glGetTexGendv)
- & GrabFunction(glGetTexGenfv)
- & GrabFunction(glGetTexGeniv)
- & GrabFunction(glTexEnvf)
- & GrabFunction(glTexEnvi)
- & GrabFunction(glTexEnvfv)
- & GrabFunction(glTexEnviv)
- & GrabFunction(glGetTexEnvfv)
- & GrabFunction(glGetTexEnviv)
- & GrabFunction(glTexParameterf)
- & GrabFunction(glTexParameteri)
- & GrabFunction(glTexParameterfv)
- & GrabFunction(glTexParameteriv)
- & GrabFunction(glGetTexParameterfv)
- & GrabFunction(glGetTexParameteriv)
- & GrabFunction(glGetTexLevelParameterfv)
- & GrabFunction(glGetTexLevelParameteriv)
- & GrabFunction(glTexImage1D)
- & GrabFunction(glTexImage2D)
- & GrabFunction(glGetTexImage)
- & GrabFunction(glGenTextures)
- & GrabFunction(glDeleteTextures)
- & GrabFunction(glBindTexture)
- & GrabFunction(glPrioritizeTextures)
- & GrabFunction(glAreTexturesResident)
- & GrabFunction(glIsTexture)
- & GrabFunction(glTexSubImage1D)
- & GrabFunction(glTexSubImage2D)
- & GrabFunction(glCopyTexImage1D)
- & GrabFunction(glCopyTexImage2D)
- & GrabFunction(glCopyTexSubImage1D)
- & GrabFunction(glCopyTexSubImage2D)
- & GrabFunction(glMap1d)
- & GrabFunction(glMap1f)
- & GrabFunction(glMap2d)
- & GrabFunction(glMap2f)
- & GrabFunction(glGetMapdv)
- & GrabFunction(glGetMapfv)
- & GrabFunction(glGetMapiv)
- & GrabFunction(glEvalCoord1d)
- & GrabFunction(glEvalCoord1f)
- & GrabFunction(glEvalCoord1dv)
- & GrabFunction(glEvalCoord1fv)
- & GrabFunction(glEvalCoord2d)
- & GrabFunction(glEvalCoord2f)
- & GrabFunction(glEvalCoord2dv)
- & GrabFunction(glEvalCoord2fv)
- & GrabFunction(glMapGrid1d)
- & GrabFunction(glMapGrid1f)
- & GrabFunction(glMapGrid2d)
- & GrabFunction(glMapGrid2f)
- & GrabFunction(glEvalPoint1)
- & GrabFunction(glEvalPoint2)
- & GrabFunction(glEvalMesh1)
- & GrabFunction(glEvalMesh2)
- & GrabFunction(glFogf)
- & GrabFunction(glFogi)
- & GrabFunction(glFogfv)
- & GrabFunction(glFogiv)
- & GrabFunction(glFeedbackBuffer)
- & GrabFunction(glPassThrough)
- & GrabFunction(glSelectBuffer)
- & GrabFunction(glInitNames)
- & GrabFunction(glLoadName)
- & GrabFunction(glPushName)
- & GrabFunction(glPopName);
- }
-
- bool init_gl_1_2()
- {
- return GrabFunction(glCopyTexSubImage3D)
- & GrabFunction(glDrawRangeElements)
- & GrabFunction(glTexImage3D)
- & GrabFunction(glTexSubImage3D);
- }
-
- bool init_gl_1_3()
- {
- return GrabFunction(glActiveTexture)
- & GrabFunction(glClientActiveTexture)
- & GrabFunction(glCompressedTexImage1D)
- & GrabFunction(glCompressedTexImage2D)
- & GrabFunction(glCompressedTexImage3D)
- & GrabFunction(glCompressedTexSubImage1D)
- & GrabFunction(glCompressedTexSubImage2D)
- & GrabFunction(glCompressedTexSubImage3D)
- & GrabFunction(glGetCompressedTexImage)
- & GrabFunction(glLoadTransposeMatrixd)
- & GrabFunction(glLoadTransposeMatrixf)
- & GrabFunction(glMultTransposeMatrixd)
- & GrabFunction(glMultTransposeMatrixf)
- & GrabFunction(glMultiTexCoord1d)
- & GrabFunction(glMultiTexCoord1dv)
- & GrabFunction(glMultiTexCoord1f)
- & GrabFunction(glMultiTexCoord1fv)
- & GrabFunction(glMultiTexCoord1i)
- & GrabFunction(glMultiTexCoord1iv)
- & GrabFunction(glMultiTexCoord1s)
- & GrabFunction(glMultiTexCoord1sv)
- & GrabFunction(glMultiTexCoord2d)
- & GrabFunction(glMultiTexCoord2dv)
- & GrabFunction(glMultiTexCoord2f)
- & GrabFunction(glMultiTexCoord2fv)
- & GrabFunction(glMultiTexCoord2i)
- & GrabFunction(glMultiTexCoord2iv)
- & GrabFunction(glMultiTexCoord2s)
- & GrabFunction(glMultiTexCoord2sv)
- & GrabFunction(glMultiTexCoord3d)
- & GrabFunction(glMultiTexCoord3dv)
- & GrabFunction(glMultiTexCoord3f)
- & GrabFunction(glMultiTexCoord3fv)
- & GrabFunction(glMultiTexCoord3i)
- & GrabFunction(glMultiTexCoord3iv)
- & GrabFunction(glMultiTexCoord3s)
- & GrabFunction(glMultiTexCoord3sv)
- & GrabFunction(glMultiTexCoord4d)
- & GrabFunction(glMultiTexCoord4dv)
- & GrabFunction(glMultiTexCoord4f)
- & GrabFunction(glMultiTexCoord4fv)
- & GrabFunction(glMultiTexCoord4i)
- & GrabFunction(glMultiTexCoord4iv)
- & GrabFunction(glMultiTexCoord4s)
- & GrabFunction(glMultiTexCoord4sv)
- & GrabFunction(glSampleCoverage);
- }
-
- bool init_gl_1_4()
- {
- return GrabFunction(glBlendColor)
- & GrabFunction(glBlendEquation)
- & GrabFunction(glBlendFuncSeparate)
- & GrabFunction(glFogCoordPointer)
- & GrabFunction(glFogCoordd)
- & GrabFunction(glFogCoorddv)
- & GrabFunction(glFogCoordf)
- & GrabFunction(glFogCoordfv)
- & GrabFunction(glMultiDrawArrays)
- & GrabFunction(glMultiDrawElements)
- & GrabFunction(glPointParameterf)
- & GrabFunction(glPointParameterfv)
- & GrabFunction(glPointParameteri)
- & GrabFunction(glPointParameteriv)
- & GrabFunction(glSecondaryColor3b)
- & GrabFunction(glSecondaryColor3bv)
- & GrabFunction(glSecondaryColor3d)
- & GrabFunction(glSecondaryColor3dv)
- & GrabFunction(glSecondaryColor3f)
- & GrabFunction(glSecondaryColor3fv)
- & GrabFunction(glSecondaryColor3i)
- & GrabFunction(glSecondaryColor3iv)
- & GrabFunction(glSecondaryColor3s)
- & GrabFunction(glSecondaryColor3sv)
- & GrabFunction(glSecondaryColor3ub)
- & GrabFunction(glSecondaryColor3ubv)
- & GrabFunction(glSecondaryColor3ui)
- & GrabFunction(glSecondaryColor3uiv)
- & GrabFunction(glSecondaryColor3us)
- & GrabFunction(glSecondaryColor3usv)
- & GrabFunction(glSecondaryColorPointer)
- & GrabFunction(glWindowPos2d)
- & GrabFunction(glWindowPos2dv)
- & GrabFunction(glWindowPos2f)
- & GrabFunction(glWindowPos2fv)
- & GrabFunction(glWindowPos2i)
- & GrabFunction(glWindowPos2iv)
- & GrabFunction(glWindowPos2s)
- & GrabFunction(glWindowPos2sv)
- & GrabFunction(glWindowPos3d)
- & GrabFunction(glWindowPos3dv)
- & GrabFunction(glWindowPos3f)
- & GrabFunction(glWindowPos3fv)
- & GrabFunction(glWindowPos3i)
- & GrabFunction(glWindowPos3iv)
- & GrabFunction(glWindowPos3s)
- & GrabFunction(glWindowPos3sv);
- }
-
- bool init_gl_1_5()
- {
- return GrabFunction(glBeginQuery)
- & GrabFunction(glBindBuffer)
- & GrabFunction(glBufferData)
- & GrabFunction(glBufferSubData)
- & GrabFunction(glDeleteBuffers)
- & GrabFunction(glDeleteQueries)
- & GrabFunction(glEndQuery)
- & GrabFunction(glGenBuffers)
- & GrabFunction(glGenQueries)
- & GrabFunction(glGetBufferParameteriv)
- & GrabFunction(glGetBufferPointerv)
- & GrabFunction(glGetBufferSubData)
- & GrabFunction(glGetQueryObjectiv)
- & GrabFunction(glGetQueryObjectuiv)
- & GrabFunction(glGetQueryiv)
- & GrabFunction(glIsBuffer)
- & GrabFunction(glIsQuery)
- & GrabFunction(glMapBuffer)
- & GrabFunction(glUnmapBuffer);
- }
- bool init_gl_2_0()
- {
- return GrabFunction(glAttachShader)
- & GrabFunction(glBindAttribLocation)
- & GrabFunction(glBlendEquationSeparate)
- & GrabFunction(glCompileShader)
- & GrabFunction(glCreateProgram)
- & GrabFunction(glCreateShader)
- & GrabFunction(glDeleteProgram)
- & GrabFunction(glDeleteShader)
- & GrabFunction(glDetachShader)
- & GrabFunction(glDisableVertexAttribArray)
- & GrabFunction(glDrawBuffers)
- & GrabFunction(glEnableVertexAttribArray)
- & GrabFunction(glGetActiveAttrib)
- & GrabFunction(glGetActiveUniform)
- & GrabFunction(glGetAttachedShaders)
- & GrabFunction(glGetAttribLocation)
- & GrabFunction(glGetProgramInfoLog)
- & GrabFunction(glGetProgramiv)
- & GrabFunction(glGetShaderInfoLog)
- & GrabFunction(glGetShaderSource)
- & GrabFunction(glGetShaderiv)
- & GrabFunction(glGetUniformLocation)
- & GrabFunction(glGetUniformfv)
- & GrabFunction(glGetUniformiv)
- & GrabFunction(glGetVertexAttribPointerv)
- & GrabFunction(glGetVertexAttribdv)
- & GrabFunction(glGetVertexAttribfv)
- & GrabFunction(glGetVertexAttribiv)
- & GrabFunction(glIsProgram)
- & GrabFunction(glIsShader)
- & GrabFunction(glLinkProgram)
- & GrabFunction(glShaderSource)
- & GrabFunction(glStencilFuncSeparate)
- & GrabFunction(glStencilMaskSeparate)
- & GrabFunction(glStencilOpSeparate)
- & GrabFunction(glUniform1f)
- & GrabFunction(glUniform1fv)
- & GrabFunction(glUniform1i)
- & GrabFunction(glUniform1iv)
- & GrabFunction(glUniform2f)
- & GrabFunction(glUniform2fv)
- & GrabFunction(glUniform2i)
- & GrabFunction(glUniform2iv)
- & GrabFunction(glUniform3f)
- & GrabFunction(glUniform3fv)
- & GrabFunction(glUniform3i)
- & GrabFunction(glUniform3iv)
- & GrabFunction(glUniform4f)
- & GrabFunction(glUniform4fv)
- & GrabFunction(glUniform4i)
- & GrabFunction(glUniform4iv)
- & GrabFunction(glUniformMatrix2fv)
- & GrabFunction(glUniformMatrix3fv)
- & GrabFunction(glUniformMatrix4fv)
- & GrabFunction(glUseProgram)
- & GrabFunction(glValidateProgram)
- & GrabFunction(glVertexAttrib1d)
- & GrabFunction(glVertexAttrib1dv)
- & GrabFunction(glVertexAttrib1f)
- & GrabFunction(glVertexAttrib1fv)
- & GrabFunction(glVertexAttrib1s)
- & GrabFunction(glVertexAttrib1sv)
- & GrabFunction(glVertexAttrib2d)
- & GrabFunction(glVertexAttrib2dv)
- & GrabFunction(glVertexAttrib2f)
- & GrabFunction(glVertexAttrib2fv)
- & GrabFunction(glVertexAttrib2s)
- & GrabFunction(glVertexAttrib2sv)
- & GrabFunction(glVertexAttrib3d)
- & GrabFunction(glVertexAttrib3dv)
- & GrabFunction(glVertexAttrib3f)
- & GrabFunction(glVertexAttrib3fv)
- & GrabFunction(glVertexAttrib3s)
- & GrabFunction(glVertexAttrib3sv)
- & GrabFunction(glVertexAttrib4Nbv)
- & GrabFunction(glVertexAttrib4Niv)
- & GrabFunction(glVertexAttrib4Nsv)
- & GrabFunction(glVertexAttrib4Nub)
- & GrabFunction(glVertexAttrib4Nubv)
- & GrabFunction(glVertexAttrib4Nuiv)
- & GrabFunction(glVertexAttrib4Nusv)
- & GrabFunction(glVertexAttrib4bv)
- & GrabFunction(glVertexAttrib4d)
- & GrabFunction(glVertexAttrib4dv)
- & GrabFunction(glVertexAttrib4f)
- & GrabFunction(glVertexAttrib4fv)
- & GrabFunction(glVertexAttrib4iv)
- & GrabFunction(glVertexAttrib4s)
- & GrabFunction(glVertexAttrib4sv)
- & GrabFunction(glVertexAttrib4ubv)
- & GrabFunction(glVertexAttrib4uiv)
- & GrabFunction(glVertexAttrib4usv)
- & GrabFunction(glVertexAttribPointer);
- }
-
- bool init_gl_3_0()
- {
- if (Version() < 300)
- return true;
- return GrabFunction(glBeginConditionalRender)
- & GrabFunction(glBeginTransformFeedback)
- & GrabFunction(glBindFragDataLocation)
- & GrabFunction(glClampColor)
- & GrabFunction(glClearBufferfi)
- & GrabFunction(glClearBufferfv)
- & GrabFunction(glClearBufferiv)
- & GrabFunction(glClearBufferuiv)
- & GrabFunction(glColorMaski)
- & GrabFunction(glDisablei)
- & GrabFunction(glEnablei)
- & GrabFunction(glEndConditionalRender)
- & GrabFunction(glEndTransformFeedback)
- & GrabFunction(glGetBooleani_v)
- & GrabFunction(glGetFragDataLocation)
- & GrabFunction(glGetStringi)
- & GrabFunction(glGetTexParameterIiv)
- & GrabFunction(glGetTexParameterIuiv)
- & GrabFunction(glGetTransformFeedbackVarying)
- & GrabFunction(glGetUniformuiv)
- & GrabFunction(glGetVertexAttribIiv)
- & GrabFunction(glGetVertexAttribIuiv)
- & GrabFunction(glIsEnabledi)
- & GrabFunction(glTexParameterIiv)
- & GrabFunction(glTexParameterIuiv)
- & GrabFunction(glTransformFeedbackVaryings)
- & GrabFunction(glUniform1ui)
- & GrabFunction(glUniform1uiv)
- & GrabFunction(glUniform2ui)
- & GrabFunction(glUniform2uiv)
- & GrabFunction(glUniform3ui)
- & GrabFunction(glUniform3uiv)
- & GrabFunction(glUniform4ui)
- & GrabFunction(glUniform4uiv)
- & GrabFunction(glVertexAttribI1i)
- & GrabFunction(glVertexAttribI1iv)
- & GrabFunction(glVertexAttribI1ui)
- & GrabFunction(glVertexAttribI1uiv)
- & GrabFunction(glVertexAttribI2i)
- & GrabFunction(glVertexAttribI2iv)
- & GrabFunction(glVertexAttribI2ui)
- & GrabFunction(glVertexAttribI2uiv)
- & GrabFunction(glVertexAttribI3i)
- & GrabFunction(glVertexAttribI3iv)
- & GrabFunction(glVertexAttribI3ui)
- & GrabFunction(glVertexAttribI3uiv)
- & GrabFunction(glVertexAttribI4bv)
- & GrabFunction(glVertexAttribI4i)
- & GrabFunction(glVertexAttribI4iv)
- & GrabFunction(glVertexAttribI4sv)
- & GrabFunction(glVertexAttribI4ubv)
- & GrabFunction(glVertexAttribI4ui)
- & GrabFunction(glVertexAttribI4uiv)
- & GrabFunction(glVertexAttribI4usv)
- & GrabFunction(glVertexAttribIPointer);
- }
-
- bool init_gl_3_1()
- {
- if (Version() < 310)
- return true;
- return GrabFunction(glDrawArraysInstanced)
- & GrabFunction(glDrawElementsInstanced)
- & GrabFunction(glPrimitiveRestartIndex)
- & GrabFunction(glTexBuffer);
- }
-
- bool init_gl_3_2()
- {
- if (Version() < 320)
- return true;
- return GrabFunction(glFramebufferTexture)
- & GrabFunction(glGetBufferParameteri64v)
- & GrabFunction(glGetInteger64i_v);
- }
-
- bool init_arb_uniform_buffer_object()
- {
- if (!Supports("GL_ARB_uniform_buffer_object"))
- return true;
- return GrabFunction(glBindBufferBase)
- & GrabFunction(glBindBufferRange)
- & GrabFunction(glGetActiveUniformBlockName)
- & GrabFunction(glGetActiveUniformBlockiv)
- & GrabFunction(glGetActiveUniformName)
- & GrabFunction(glGetActiveUniformsiv)
- & GrabFunction(glGetIntegeri_v)
- & GrabFunction(glGetUniformBlockIndex)
- & GrabFunction(glGetUniformIndices)
- & GrabFunction(glUniformBlockBinding);
- }
-
- bool init_arb_sampler_objects()
- {
- if (!Supports("GL_ARB_sampler_objects"))
- return true;
- return GrabFunction(glBindSampler)
- & GrabFunction(glDeleteSamplers)
- & GrabFunction(glGenSamplers)
- & GrabFunction(glGetSamplerParameterIiv)
- & GrabFunction(glGetSamplerParameterIuiv)
- & GrabFunction(glGetSamplerParameterfv)
- & GrabFunction(glGetSamplerParameteriv)
- & GrabFunction(glIsSampler)
- & GrabFunction(glSamplerParameterIiv)
- & GrabFunction(glSamplerParameterIuiv)
- & GrabFunction(glSamplerParameterf)
- & GrabFunction(glSamplerParameterfv)
- & GrabFunction(glSamplerParameteri)
- & GrabFunction(glSamplerParameteriv);
- }
-
- bool init_arb_map_buffer_range()
+ bool HasFeatures(const std::string& extensions)
{
- if (!Supports("GL_ARB_map_buffer_range"))
- return true;
- return GrabFunction(glFlushMappedBufferRange)
- & GrabFunction(glMapBufferRange);
- }
+ bool result = true;
+ std::string tmp;
+ std::istringstream buffer(extensions);
- bool init_arb_vertex_array_object()
- {
- if (!(Supports("GL_ARB_vertex_array_object") ||
- Supports("GL_APPLE_vertex_array_object")))
- return true;
- if (Supports("GL_ARB_vertex_array_object"))
- {
- return GrabFunction(glBindVertexArray)
- & GrabFunction(glDeleteVertexArrays)
- & GrabFunction(glGenVertexArrays)
- & GrabFunction(glIsVertexArray);
- }
- else if (Supports("GL_APPLE_vertex_array_object"))
+ while (buffer >> tmp)
{
- return GrabFunctionSuffix(glBindVertexArray, APPLE)
- & GrabFunctionSuffix(glDeleteVertexArrays, APPLE)
- & GrabFunctionSuffix(glGenVertexArrays, APPLE)
- & GrabFunctionSuffix(glIsVertexArray, APPLE);
+ if (tmp[0] == '!')
+ result &= !m_extension_list[tmp.erase(0)];
+ else
+ result &= m_extension_list[tmp];
}
- return true; // Quell compiler warning. Won't ever be reached
- }
-
- bool init_arb_framebuffer_object()
- {
- if (!Supports("GL_ARB_framebuffer_object"))
- return true;
- return GrabFunction(glBindFramebuffer)
- & GrabFunction(glBindRenderbuffer)
- & GrabFunction(glBlitFramebuffer)
- & GrabFunction(glCheckFramebufferStatus)
- & GrabFunction(glDeleteFramebuffers)
- & GrabFunction(glDeleteRenderbuffers)
- & GrabFunction(glFramebufferRenderbuffer)
- & GrabFunction(glFramebufferTexture1D)
- & GrabFunction(glFramebufferTexture2D)
- & GrabFunction(glFramebufferTexture3D)
- & GrabFunction(glFramebufferTextureLayer)
- & GrabFunction(glGenFramebuffers)
- & GrabFunction(glGenRenderbuffers)
- & GrabFunction(glGenerateMipmap)
- & GrabFunction(glGetFramebufferAttachmentParameteriv)
- & GrabFunction(glGetRenderbufferParameteriv)
- & GrabFunction(glIsFramebuffer)
- & GrabFunction(glIsRenderbuffer)
- & GrabFunction(glRenderbufferStorage)
- & GrabFunction(glRenderbufferStorageMultisample);
- }
-
- bool init_arb_get_program_binary()
- {
- if (!Supports("GL_ARB_get_program_binary"))
- return true;
- return GrabFunction(glGetProgramBinary)
- & GrabFunction(glProgramBinary)
- & GrabFunction(glProgramParameteri);
+ return result;
}
-
- bool init_arb_sync()
- {
- if (!(Supports("GL_ARB_sync") ||
- Version() >= 320))
- return true;
- return GrabFunction(glClientWaitSync)
- & GrabFunction(glDeleteSync)
- & GrabFunction(glFenceSync)
- & GrabFunction(glGetInteger64v)
- & GrabFunction(glGetSynciv)
- & GrabFunction(glIsSync)
- & GrabFunction(glWaitSync);
- }
-
- bool init_arb_es2_compatibility()
- {
- if (!Supports("GL_ARB_ES2_compatibility"))
- return true;
- return GrabFunction(glClearDepthf)
- & GrabFunction(glDepthRangef)
- & GrabFunction(glGetShaderPrecisionFormat)
- & GrabFunction(glReleaseShaderCompiler)
- & GrabFunction(glShaderBinary);
- }
-
- bool init_nv_primitive_restart()
- {
- if (!Supports("GL_NV_primitive_restart"))
- return true;
- return GrabFunction(glPrimitiveRestartIndexNV)
- & GrabFunction(glPrimitiveRestartNV);
- }
-
- bool init_arb_blend_func_extended()
- {
- if (!Supports("GL_ARB_blend_func_extended"))
- return true;
- return GrabFunction(glBindFragDataLocationIndexed)
- & GrabFunction(glGetFragDataIndex);
- }
-
- bool init_arb_viewport_array()
- {
- if (!Supports("GL_ARB_viewport_array"))
- return true;
- return GrabFunction(glDepthRangeArrayv)
- & GrabFunction(glDepthRangeIndexed)
- & GrabFunction(glGetDoublei_v)
- & GrabFunction(glGetFloati_v)
- & GrabFunction(glScissorArrayv)
- & GrabFunction(glScissorIndexed)
- & GrabFunction(glScissorIndexedv)
- & GrabFunction(glViewportArrayv)
- & GrabFunction(glViewportIndexedf)
- & GrabFunction(glViewportIndexedfv);
- }
-
- bool init_arb_draw_elements_base_vertex()
- {
- if (!Supports("GL_ARB_draw_elements_base_vertex"))
- return true;
- return GrabFunction(glDrawElementsBaseVertex)
- & GrabFunction(glDrawElementsInstancedBaseVertex)
- & GrabFunction(glDrawRangeElementsBaseVertex)
- & GrabFunction(glMultiDrawElementsBaseVertex);
- }
-
- bool init_nv_framebuffer_multisample_coverage()
- {
- if (!Supports("GL_NV_framebuffer_multisample_coverage"))
- return true;
- return GrabFunction(glRenderbufferStorageMultisampleCoverageNV);
- }
-
- bool init_arb_sample_shading()
- {
- if (!Supports("GL_ARB_sample_shading"))
- return true;
- return GrabFunction(glMinSampleShadingARB);
- }
-
- bool init_arb_debug_output()
+ bool InitFunctionPointers()
{
- if (!Supports("GL_ARB_debug_output"))
- return true;
- return GrabFunction(glDebugMessageCallbackARB)
- & GrabFunction(glDebugMessageControlARB)
- & GrabFunction(glDebugMessageInsertARB)
- & GrabFunction(glGetDebugMessageLogARB);
- }
-
- bool init_khr_debug()
- {
- if (!Supports("GL_KHR_debug"))
- return true;
- if (_isES3)
- return GrabFunctionSuffix(glDebugMessageCallback, KHR)
- & GrabFunctionSuffix(glDebugMessageControl, KHR)
- & GrabFunctionSuffix(glDebugMessageInsert, KHR)
- & GrabFunctionSuffix(glGetDebugMessageLog, KHR)
- & GrabFunctionSuffix(glGetObjectLabel, KHR)
- & GrabFunctionSuffix(glGetObjectPtrLabel, KHR)
- & GrabFunctionSuffix(glObjectLabel, KHR)
- & GrabFunctionSuffix(glObjectPtrLabel, KHR)
- & GrabFunctionSuffix(glPopDebugGroup, KHR)
- & GrabFunctionSuffix(glPushDebugGroup, KHR);
- else
- return GrabFunction(glDebugMessageCallback)
- & GrabFunction(glDebugMessageControl)
- & GrabFunction(glDebugMessageInsert)
- & GrabFunction(glGetDebugMessageLog)
- & GrabFunction(glGetObjectLabel)
- & GrabFunction(glGetObjectPtrLabel)
- & GrabFunction(glObjectLabel)
- & GrabFunction(glObjectPtrLabel)
- & GrabFunction(glPopDebugGroup)
- & GrabFunction(glPushDebugGroup);
- }
-
- bool init_arb_buffer_storage()
- {
- if (!Supports("GL_ARB_buffer_storage"))
- return true;
- bool res = GrabFunction(glBufferStorage);
- if (Supports("GL_EXT_direct_state_access"))
- res &= GrabFunction(glNamedBufferStorageEXT);
- return res;
+ bool result = true;
+ for (const auto &it : gl_function_array)
+ if (HasFeatures(it.requirements))
+ result &= !!GetFuncAddress(it.function_name, it.function_ptr);
+ return result;
}
}
+
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
index caf88ef..7c3c22c 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
@@ -4,34 +4,34 @@
#include <string>
-#include "GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
-#include "gl_1_1.h"
-#include "gl_1_2.h"
-#include "gl_1_3.h"
-#include "gl_1_4.h"
-#include "gl_1_5.h"
-#include "gl_2_0.h"
-#include "gl_3_0.h"
-#include "gl_3_1.h"
-#include "gl_3_2.h"
-#include "ARB_uniform_buffer_object.h"
-#include "ARB_sampler_objects.h"
-#include "ARB_map_buffer_range.h"
-#include "ARB_vertex_array_object.h"
-#include "ARB_framebuffer_object.h"
-#include "ARB_get_program_binary.h"
-#include "ARB_sync.h"
-#include "ARB_ES2_compatibility.h"
-#include "NV_primitive_restart.h"
-#include "ARB_blend_func_extended.h"
-#include "ARB_viewport_array.h"
-#include "ARB_draw_elements_base_vertex.h"
-#include "NV_framebuffer_multisample_coverage.h"
-#include "ARB_sample_shading.h"
-#include "ARB_debug_output.h"
-#include "KHR_debug.h"
-#include "ARB_buffer_storage.h"
+#include "VideoBackends/OGL/GLExtensions/gl_1_1.h"
+#include "VideoBackends/OGL/GLExtensions/gl_1_2.h"
+#include "VideoBackends/OGL/GLExtensions/gl_1_3.h"
+#include "VideoBackends/OGL/GLExtensions/gl_1_4.h"
+#include "VideoBackends/OGL/GLExtensions/gl_1_5.h"
+#include "VideoBackends/OGL/GLExtensions/gl_2_0.h"
+#include "VideoBackends/OGL/GLExtensions/gl_3_0.h"
+#include "VideoBackends/OGL/GLExtensions/gl_3_1.h"
+#include "VideoBackends/OGL/GLExtensions/gl_3_2.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_debug_output.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_draw_elements_base_vertex.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_ES2_compatibility.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_framebuffer_object.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_get_program_binary.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_map_buffer_range.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_sample_shading.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_sampler_objects.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_sync.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_uniform_buffer_object.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_vertex_array_object.h"
+#include "VideoBackends/OGL/GLExtensions/ARB_viewport_array.h"
+#include "VideoBackends/OGL/GLExtensions/KHR_debug.h"
+#include "VideoBackends/OGL/GLExtensions/NV_primitive_restart.h"
+#include "VideoBackends/OGL/GLExtensions/NV_framebuffer_multisample_coverage.h"
namespace GLExtensions
{
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/KHR_debug.h b/Source/Core/VideoBackends/OGL/GLExtensions/KHR_debug.h
index 71cda10..e85776c 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/KHR_debug.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/KHR_debug.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
#ifndef GL_VERSION_4_3
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/NV_framebuffer_multisample_coverage.h b/Source/Core/VideoBackends/OGL/GLExtensions/NV_framebuffer_multisample_coverage.h
index 0db71cd..7a1747d 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/NV_framebuffer_multisample_coverage.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/NV_framebuffer_multisample_coverage.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/NV_primitive_restart.h b/Source/Core/VideoBackends/OGL/GLExtensions/NV_primitive_restart.h
index 3645f49..09b0921 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/NV_primitive_restart.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/NV_primitive_restart.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
#define GL_PRIMITIVE_RESTART_NV 0x8558
#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_1.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_1.h
index ec5e37b..0efd21f 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_1.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_1.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
typedef void (GLAPIENTRY * PFNGLCLEARINDEXPROC) ( GLfloat c );
typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_2.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_2.h
index 4023ade..d502bcd 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_2.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_2.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D;
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_3.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_3.h
index 4e4c7dd..2c1cd78 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_3.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_3.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLACTIVETEXTUREARBPROC glActiveTexture;
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_4.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_4.h
index d9870d0..d88c0f3 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_4.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_4.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
// These two are provided by ARB_imaging as well
extern PFNGLBLENDCOLORPROC glBlendColor;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_5.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_5.h
index 09a252f..fc74193 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_5.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_1_5.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBEGINQUERYPROC glBeginQuery;
extern PFNGLBINDBUFFERPROC glBindBuffer;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_2_0.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_2_0.h
index 9fc4628..93a4896 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_2_0.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_2_0.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLATTACHSHADERPROC glAttachShader;
extern PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_0.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_0.h
index 27f4678..ce6ece3 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_0.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_0.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLBEGINCONDITIONALRENDERPROC glBeginConditionalRender;
extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_1.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_1.h
index ff2ff10..1822dd5 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_1.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_1.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_2.h b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_2.h
index 90a9d5d..18386f7 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_2.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/gl_3_2.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "gl_common.h"
+#include "VideoBackends/OGL/GLExtensions/gl_common.h"
extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
extern PFNGLGETBUFFERPARAMETERI64VPROC glGetBufferParameteri64v;
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp
index 73df973..abe2505 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.cpp
+++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-#include "VideoConfig.h"
-#include "IniFile.h"
-#include "Core.h"
-#include "VideoBackend.h"
-#include "ConfigManager.h"
+#include "Common/IniFile.h"
-#include "Render.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
-#include "GLUtil.h"
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/VideoBackend.h"
+
+#include "VideoCommon/VideoConfig.h"
GLWindow GLWin;
cInterfaceBase *GLInterface;
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.h b/Source/Core/VideoBackends/OGL/GLUtil.h
index 67fa8f2..a46e381 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.h
+++ b/Source/Core/VideoBackends/OGL/GLUtil.h
@@ -4,10 +4,10 @@
#pragma once
-#include "VideoConfig.h"
-#include "MathUtil.h"
-#include "GLInterface/GLInterface.h"
-#include "GLExtensions/GLExtensions.h"
+#include "Common/MathUtil.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
+#include "VideoCommon/VideoConfig.h"
#ifndef _WIN32
diff --git a/Source/Core/VideoBackends/OGL/Globals.h b/Source/Core/VideoBackends/OGL/Globals.h
index 2683223..d1f9012 100644
--- a/Source/Core/VideoBackends/OGL/Globals.h
+++ b/Source/Core/VideoBackends/OGL/Globals.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
-#include "VideoConfig.h"
+#include "Common/Common.h"
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp
index 4f3f2ad..6b6a46b 100644
--- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp
+++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GLUtil.h"
-#include "x64Emitter.h"
-#include "x64ABI.h"
-#include "MemoryUtil.h"
-#include "ProgramShaderCache.h"
-#include "VertexShaderGen.h"
-
-#include "CPMemory.h"
-#include "NativeVertexFormat.h"
-#include "VertexManager.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Emitter.h"
+#include "Common/MemoryUtil.h"
+
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/VertexManager.h"
+
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/VertexShaderGen.h"
// Here's some global state. We only use this to keep track of what we've sent to the OpenGL state
// machine.
diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.cpp b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
index 0dd97d9..8e2de6d 100644
--- a/Source/Core/VideoBackends/OGL/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GLInterface/GLInterface.h"
-#include "RenderBase.h"
-#include "GLUtil.h"
-#include "PerfQuery.h"
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/PerfQuery.h"
+#include "VideoCommon/RenderBase.h"
namespace OGL
{
@@ -14,28 +14,25 @@ PerfQuery::PerfQuery()
: m_query_read_pos()
, m_query_count()
{
- for (u32 i = 0; i != ArraySize(m_query_buffer); ++i)
- glGenQueries(1, &m_query_buffer[i].query_id);
+ for (ActiveQuery& query : m_query_buffer)
+ glGenQueries(1, &query.query_id);
ResetQuery();
}
PerfQuery::~PerfQuery()
{
- for (u32 i = 0; i != ArraySize(m_query_buffer); ++i)
- glDeleteQueries(1, &m_query_buffer[i].query_id);
+ for (ActiveQuery& query : m_query_buffer)
+ glDeleteQueries(1, &query.query_id);
}
void PerfQuery::EnableQuery(PerfQueryGroup type)
{
- if (!ShouldEmulate())
- return;
-
// Is this sane?
- if (m_query_count > ArraySize(m_query_buffer) / 2)
+ if (m_query_count > m_query_buffer.size() / 2)
WeakFlush();
- if (ArraySize(m_query_buffer) == m_query_count)
+ if (m_query_buffer.size() == m_query_count)
{
FlushOne();
//ERROR_LOG(VIDEO, "Flushed query buffer early!");
@@ -44,7 +41,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
// start query
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
{
- auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % ArraySize(m_query_buffer)];
+ auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % m_query_buffer.size()];
glBeginQuery(GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL ? GL_SAMPLES_PASSED : GL_ANY_SAMPLES_PASSED, entry.query_id);
entry.query_type = type;
@@ -55,9 +52,6 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
void PerfQuery::DisableQuery(PerfQueryGroup type)
{
- if (!ShouldEmulate())
- return;
-
// stop query
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
{
@@ -67,17 +61,11 @@ void PerfQuery::DisableQuery(PerfQueryGroup type)
bool PerfQuery::IsFlushed() const
{
- if (!ShouldEmulate())
- return true;
-
return 0 == m_query_count;
}
void PerfQuery::FlushOne()
{
- if (!ShouldEmulate())
- return;
-
auto& entry = m_query_buffer[m_query_read_pos];
GLuint result = 0;
@@ -86,25 +74,19 @@ void PerfQuery::FlushOne()
// NOTE: Reported pixel metrics should be referenced to native resolution
m_results[entry.query_type] += (u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight();
- m_query_read_pos = (m_query_read_pos + 1) % ArraySize(m_query_buffer);
+ m_query_read_pos = (m_query_read_pos + 1) % m_query_buffer.size();
--m_query_count;
}
// TODO: could selectively flush things, but I don't think that will do much
void PerfQuery::FlushResults()
{
- if (!ShouldEmulate())
- return;
-
while (!IsFlushed())
FlushOne();
}
void PerfQuery::WeakFlush()
{
- if (!ShouldEmulate())
- return;
-
while (!IsFlushed())
{
auto& entry = m_query_buffer[m_query_read_pos];
@@ -131,9 +113,6 @@ void PerfQuery::ResetQuery()
u32 PerfQuery::GetQueryResult(PerfQueryType type)
{
- if (!ShouldEmulate())
- return 0;
-
u32 result = 0;
if (type == PQ_ZCOMP_INPUT_ZCOMPLOC || type == PQ_ZCOMP_OUTPUT_ZCOMPLOC)
diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.h b/Source/Core/VideoBackends/OGL/PerfQuery.h
index 1f93c99..4353485 100644
--- a/Source/Core/VideoBackends/OGL/PerfQuery.h
+++ b/Source/Core/VideoBackends/OGL/PerfQuery.h
@@ -1,6 +1,7 @@
#pragma once
-#include "PerfQueryBase.h"
+#include <array>
+#include "VideoCommon/PerfQueryBase.h"
namespace OGL {
@@ -32,7 +33,7 @@ private:
void FlushOne();
// This contains gl query objects with unretrieved results.
- ActiveQuery m_query_buffer[PERF_QUERY_BUFFER_SIZE];
+ std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer;
u32 m_query_read_pos;
// TODO: sloppy
diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/PostProcessing.cpp
index c0460e4..211cf5d 100644
--- a/Source/Core/VideoBackends/OGL/PostProcessing.cpp
+++ b/Source/Core/VideoBackends/OGL/PostProcessing.cpp
@@ -2,14 +2,16 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "VideoCommon.h"
-#include "VideoConfig.h"
-#include "GLUtil.h"
-#include "PostProcessing.h"
-#include "ProgramShaderCache.h"
-#include "FramebufferManager.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/PostProcessing.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.h b/Source/Core/VideoBackends/OGL/PostProcessing.h
index 0cd9311..1a6f015 100644
--- a/Source/Core/VideoBackends/OGL/PostProcessing.h
+++ b/Source/Core/VideoBackends/OGL/PostProcessing.h
@@ -4,8 +4,8 @@
#pragma once
-#include "VideoCommon.h"
-#include "GLUtil.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoCommon/VideoCommon.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index 6804417..a701158 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -2,16 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "ProgramShaderCache.h"
-#include "DriverDetails.h"
-#include "MathUtil.h"
-#include "StreamBuffer.h"
-#include "Debugger.h"
-#include "Statistics.h"
-#include "ImageWrite.h"
-#include "Render.h"
-#include "PixelShaderManager.h"
-#include "VertexShaderManager.h"
+#include "Common/MathUtil.h"
+
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/StreamBuffer.h"
+
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/VertexShaderManager.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
index ee3c174..93ac124 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
@@ -4,13 +4,11 @@
#pragma once
-#include "GLUtil.h"
-
-#include "PixelShaderGen.h"
-#include "VertexShaderGen.h"
-
-#include "LinearDiskCache.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Common/LinearDiskCache.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/VertexShaderGen.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/RasterFont.cpp b/Source/Core/VideoBackends/OGL/RasterFont.cpp
index d3e4272..e5458ee 100644
--- a/Source/Core/VideoBackends/OGL/RasterFont.cpp
+++ b/Source/Core/VideoBackends/OGL/RasterFont.cpp
@@ -2,10 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "GLUtil.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/RasterFont.h"
-#include "RasterFont.h"
-#include "ProgramShaderCache.h"
// globals
namespace OGL {
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index 6d4d73d..4640543 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -2,64 +2,64 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-#include "Thread.h"
-#include "Atomic.h"
-
-#include <vector>
+#include <cinttypes>
#include <cmath>
#include <cstdio>
-#include <cinttypes>
+#include <vector>
+
+#include "Common/Atomic.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+#include "Common/Timer.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/main.h"
+#include "VideoBackends/OGL/PostProcessing.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/RasterFont.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/SamplerCache.h"
+#include "VideoBackends/OGL/StreamBuffer.h"
+#include "VideoBackends/OGL/TextureCache.h"
+#include "VideoBackends/OGL/TextureConverter.h"
+#include "VideoBackends/OGL/VertexManager.h"
+
+#include "VideoCommon/BPFunctions.h"
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/FPSCounter.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
-#include "GLUtil.h"
#if defined(HAVE_WX) && HAVE_WX
-#include "WxUtils.h"
+#include "DolphinWX/WxUtils.h"
#endif
-#include "FileUtil.h"
-
#ifdef _WIN32
#include <mmsystem.h>
#endif
-#include "CommonPaths.h"
-#include "DriverDetails.h"
-#include "VideoConfig.h"
-#include "Statistics.h"
-#include "ImageWrite.h"
-#include "PixelEngine.h"
-#include "Render.h"
-#include "BPStructs.h"
-#include "TextureCache.h"
-#include "RasterFont.h"
-#include "VertexShaderGen.h"
-#include "ProgramShaderCache.h"
-#include "VertexShaderManager.h"
-#include "VertexLoaderManager.h"
-#include "VertexLoader.h"
-#include "PostProcessing.h"
-#include "TextureConverter.h"
-#include "OnScreenDisplay.h"
-#include "Timer.h"
-#include "StringUtil.h"
-#include "FramebufferManager.h"
-#include "Fifo.h"
-#include "Debugger.h"
-#include "Core.h"
-#include "Movie.h"
-#include "BPFunctions.h"
-#include "FPSCounter.h"
-#include "ConfigManager.h"
-#include "VertexManager.h"
-#include "SamplerCache.h"
-#include "StreamBuffer.h"
-
-#include "main.h" // Local
#ifdef _WIN32
-#include "EmuWindow.h"
+#include "VideoCommon/EmuWindow.h"
#endif
#if defined _WIN32 || defined HAVE_LIBAV
-#include "AVIDump.h"
+#include "VideoCommon/AVIDump.h"
#endif
@@ -862,9 +862,10 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
// Renderer::GetTargetHeight() = the fixed ini file setting
// donkopunchstania - it appears scissorBR is the bottom right pixel inside the scissor box
// therefore the width and height are (scissorBR + 1) - scissorTL
-void Renderer::SetScissorRect(const TargetRectangle& rc)
+void Renderer::SetScissorRect(const EFBRectangle& rc)
{
- glScissor(rc.left, rc.bottom, rc.GetWidth(), rc.GetHeight());
+ TargetRectangle trc = g_renderer->ConvertEFBRectangle(rc);
+ glScissor(trc.left, trc.bottom, trc.GetWidth(), trc.GetHeight());
}
void Renderer::SetColorMask()
@@ -924,15 +925,15 @@ void Renderer::UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRec
// and EFB pokes (which will change the color or depth of a pixel).
//
// The behavior of EFB peeks can only be modified by:
-// - GX_PokeAlphaRead
+// - GX_PokeAlphaRead
// The behavior of EFB pokes can be modified by:
-// - GX_PokeAlphaMode (TODO)
-// - GX_PokeAlphaUpdate (TODO)
-// - GX_PokeBlendMode (TODO)
-// - GX_PokeColorUpdate (TODO)
-// - GX_PokeDither (TODO)
-// - GX_PokeDstAlpha (TODO)
-// - GX_PokeZMode (TODO)
+// - GX_PokeAlphaMode (TODO)
+// - GX_PokeAlphaUpdate (TODO)
+// - GX_PokeBlendMode (TODO)
+// - GX_PokeColorUpdate (TODO)
+// - GX_PokeDither (TODO)
+// - GX_PokeDstAlpha (TODO)
+// - GX_PokeZMode (TODO)
u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{
u32 cacheRectIdx = (y / EFB_CACHE_RECT_SIZE) * EFB_CACHE_WIDTH
@@ -1043,8 +1044,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
color = s_efbCache[1][cacheRectIdx][yRect * EFB_CACHE_RECT_SIZE + xRect];
// check what to do with the alpha channel (GX_PokeAlphaRead)
- PixelEngine::UPEAlphaReadReg alpha_read_mode;
- PixelEngine::Read16((u16&)alpha_read_mode, PE_ALPHAREAD);
+ PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode();
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)
{
@@ -1078,8 +1078,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
return 0;
}
-// Called from VertexShaderManager
-void Renderer::UpdateViewport()
+void Renderer::SetViewport()
{
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
// [0] = width/2
@@ -1277,7 +1276,7 @@ void DumpFrame(const std::vector<u8>& data, int w, int h)
}
// This function has the final picture. We adjust the aspect ratio here.
-void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc,float Gamma)
+void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc,float Gamma)
{
static int w = 0, h = 0;
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
@@ -1593,15 +1592,6 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
// Clean out old stuff from caches. It's not worth it to clean out the shader caches.
TextureCache::Cleanup();
- frameCount++;
-
- GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
-
- // Begin new frame
- // Set default viewport and scissor, for the clear to work correctly
- // New frame
- stats.ResetFrame();
-
// Render to the framebuffer.
FramebufferManager::SetFramebuffer(0);
@@ -1619,8 +1609,6 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangle& r
// Renderer::SetZBufferRender();
// SaveTexture("tex.png", GL_TEXTURE_2D, s_FakeZTarget,
// GetTargetWidth(), GetTargetHeight());
- Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
- XFBWrited = false;
// Invalidate EFB cache
ClearEFBCache();
@@ -1651,7 +1639,7 @@ void Renderer::RestoreAPIState()
SetDepthMode();
SetBlendMode(true);
SetLogicOpMode();
- UpdateViewport();
+ SetViewport();
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
glPolygonMode(GL_FRONT_AND_BACK, g_ActiveConfig.bWireFrame ? GL_LINE : GL_FILL);
diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h
index feaad32..d6486c6 100644
--- a/Source/Core/VideoBackends/OGL/Render.h
+++ b/Source/Core/VideoBackends/OGL/Render.h
@@ -1,6 +1,6 @@
#pragma once
-#include "RenderBase.h"
+#include "VideoCommon/RenderBase.h"
namespace OGL
{
@@ -46,7 +46,7 @@ public:
void SetColorMask() override;
void SetBlendMode(bool forceUpdate) override;
- void SetScissorRect(const TargetRectangle& rc) override;
+ void SetScissorRect(const EFBRectangle& rc) override;
void SetGenerationMode() override;
void SetDepthMode() override;
void SetLogicOpMode() override;
@@ -54,6 +54,7 @@ public:
void SetLineWidth() override;
void SetSamplerState(int stage,int texindex) override;
void SetInterlacingMode() override;
+ void SetViewport() override;
// TODO: Implement and use these
void ApplyState(bool bUseDstAlpha) override {}
@@ -70,14 +71,12 @@ public:
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override;
- void Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma) override;
+ void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma) override;
void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override;
void ReinterpretPixelData(unsigned int convtype) override;
- void UpdateViewport() override;
-
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
private:
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
index 01f5959..c9bf699 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DriverDetails.h"
-#include "SamplerCache.h"
+#include "VideoBackends/OGL/SamplerCache.h"
+#include "VideoCommon/DriverDetails.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.h b/Source/Core/VideoBackends/OGL/SamplerCache.h
index ef470e0..ec357c0 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.h
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.h
@@ -2,8 +2,8 @@
#include <map>
-#include "Render.h"
-#include "GLUtil.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/GLUtil.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
index f21ab60..7c9348d 100644
--- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
+++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp
@@ -2,13 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-#include "GLUtil.h"
-#include "StreamBuffer.h"
-#include "MemoryUtil.h"
-#include "Render.h"
-#include "DriverDetails.h"
-#include "OnScreenDisplay.h"
+#include "Common/MemoryUtil.h"
+
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/StreamBuffer.h"
+
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/OnScreenDisplay.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.h b/Source/Core/VideoBackends/OGL/StreamBuffer.h
index 00e8579..78b73e1 100644
--- a/Source/Core/VideoBackends/OGL/StreamBuffer.h
+++ b/Source/Core/VideoBackends/OGL/StreamBuffer.h
@@ -5,9 +5,9 @@
#pragma once
#include <utility>
-#include "VideoCommon.h"
-#include "FramebufferManager.h"
-#include "GLUtil.h"
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoCommon/VideoCommon.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp
index c4a89b0..628c9a9 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp
@@ -2,11 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <vector>
+#include <fstream>
#include <cmath>
+#include <vector>
-
-#include <fstream>
#ifdef _WIN32
#define _interlockedbittestandset workaround_ms_header_bug_platform_sdk6_set
#define _interlockedbittestandreset workaround_ms_header_bug_platform_sdk6_reset
@@ -19,24 +18,27 @@
#undef _interlockedbittestandreset64
#endif
-#include "BPStructs.h"
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "FramebufferManager.h"
-#include "Globals.h"
-#include "Hash.h"
-#include "HiresTextures.h"
-#include "HW/Memmap.h"
-#include "ImageWrite.h"
-#include "MemoryUtil.h"
-#include "ProgramShaderCache.h"
-#include "Render.h"
-#include "Statistics.h"
-#include "StringUtil.h"
-#include "TextureCache.h"
-#include "TextureConverter.h"
-#include "TextureDecoder.h"
-#include "VideoConfig.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/Hash.h"
+#include "Common/MemoryUtil.h"
+#include "Common/StringUtil.h"
+
+#include "Core/HW/Memmap.h"
+
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/TextureCache.h"
+#include "VideoBackends/OGL/TextureConverter.h"
+
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/HiresTextures.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoConfig.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.h b/Source/Core/VideoBackends/OGL/TextureCache.h
index 3c0e421..b358695 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.h
+++ b/Source/Core/VideoBackends/OGL/TextureCache.h
@@ -6,11 +6,10 @@
#include <map>
-#include "VideoCommon.h"
-#include "GLUtil.h"
-#include "BPStructs.h"
-
-#include "TextureCacheBase.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VideoCommon.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/TextureConverter.cpp b/Source/Core/VideoBackends/OGL/TextureConverter.cpp
index bf36523..753bd64 100644
--- a/Source/Core/VideoBackends/OGL/TextureConverter.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureConverter.cpp
@@ -4,18 +4,22 @@
// Fast image conversion using OpenGL shaders.
-#include "TextureConverter.h"
-#include "TextureConversionShader.h"
-#include "TextureCache.h"
-#include "ProgramShaderCache.h"
-#include "FramebufferManager.h"
-#include "Globals.h"
-#include "VideoConfig.h"
-#include "ImageWrite.h"
-#include "Render.h"
-#include "FileUtil.h"
-#include "HW/Memmap.h"
-#include "DriverDetails.h"
+#include "Common/FileUtil.h"
+
+#include "Core/HW/Memmap.h"
+
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/TextureCache.h"
+#include "VideoBackends/OGL/TextureConverter.h"
+
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/TextureConversionShader.h"
+#include "VideoCommon/VideoConfig.h"
+
namespace OGL
{
@@ -26,8 +30,8 @@ namespace TextureConverter
using OGL::TextureCache;
static GLuint s_texConvFrameBuffer[2] = {0,0};
-static GLuint s_srcTexture = 0; // for decoding from RAM
-static GLuint s_dstTexture = 0; // for encoding to RAM
+static GLuint s_srcTexture = 0; // for decoding from RAM
+static GLuint s_dstTexture = 0; // for encoding to RAM
const int renderBufferWidth = 1024;
const int renderBufferHeight = 1024;
diff --git a/Source/Core/VideoBackends/OGL/TextureConverter.h b/Source/Core/VideoBackends/OGL/TextureConverter.h
index f86241e..4917528 100644
--- a/Source/Core/VideoBackends/OGL/TextureConverter.h
+++ b/Source/Core/VideoBackends/OGL/TextureConverter.h
@@ -4,8 +4,8 @@
#pragma once
-#include "VideoCommon.h"
-#include "GLUtil.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoCommon/VideoCommon.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp
index aed97e2..4af1a48 100644
--- a/Source/Core/VideoBackends/OGL/VertexManager.cpp
+++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp
@@ -2,35 +2,31 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Globals.h"
-
#include <fstream>
#include <vector>
-#include "Fifo.h"
-
-#include "DriverDetails.h"
-#include "VideoConfig.h"
-#include "Statistics.h"
-#include "MemoryUtil.h"
-#include "Render.h"
-#include "ImageWrite.h"
-#include "BPMemory.h"
-#include "TextureCache.h"
-#include "PixelShaderManager.h"
-#include "VertexShaderManager.h"
-#include "ProgramShaderCache.h"
-#include "VertexShaderGen.h"
-#include "VertexLoader.h"
-#include "VertexManager.h"
-#include "IndexGenerator.h"
-#include "FileUtil.h"
-#include "Debugger.h"
-#include "StreamBuffer.h"
-#include "PerfQueryBase.h"
-#include "Render.h"
-
-#include "main.h"
+#include "Common/FileUtil.h"
+#include "Common/MemoryUtil.h"
+
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/main.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/StreamBuffer.h"
+#include "VideoBackends/OGL/TextureCache.h"
+#include "VideoBackends/OGL/VertexManager.h"
+
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
// internal state for loading vertices
extern NativeVertexFormat *g_nativeVertexFmt;
@@ -131,7 +127,7 @@ void VertexManager::Draw(u32 stride)
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
-void VertexManager::vFlush()
+void VertexManager::vFlush(bool useDstAlpha)
{
GLVertexFormat *nativeVertexFmt = (GLVertexFormat*)g_nativeVertexFmt;
u32 stride = nativeVertexFmt->GetVertexStride();
@@ -144,9 +140,6 @@ void VertexManager::vFlush()
PrepareDrawBuffers(stride);
GL_REPORT_ERRORD();
- bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
- && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
-
// Makes sure we can actually do Dual source blending
bool dualSourcePossible = g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
@@ -177,10 +170,7 @@ void VertexManager::vFlush()
g_nativeVertexFmt->SetupVertexPointers();
GL_REPORT_ERRORD();
- g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
Draw(stride);
- g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
- //ERROR_LOG(VIDEO, "PerfQuery result: %d", g_perf_query->GetQueryResult(bpmem.zcontrol.early_ztest ? PQ_ZCOMP_OUTPUT_ZCOMPLOC : PQ_ZCOMP_OUTPUT));
// run through vertex groups again to set alpha
if (useDstAlpha && !dualSourcePossible)
@@ -200,7 +190,6 @@ void VertexManager::vFlush()
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
}
- GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS)
diff --git a/Source/Core/VideoBackends/OGL/VertexManager.h b/Source/Core/VideoBackends/OGL/VertexManager.h
index db0573e..aec0712 100644
--- a/Source/Core/VideoBackends/OGL/VertexManager.h
+++ b/Source/Core/VideoBackends/OGL/VertexManager.h
@@ -4,9 +4,8 @@
#pragma once
-#include "CPMemory.h"
-
-#include "VertexManagerBase.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/VertexManagerBase.h"
namespace OGL
{
@@ -43,7 +42,7 @@ protected:
virtual void ResetBuffer(u32 stride);
private:
void Draw(u32 stride);
- void vFlush() override;
+ void vFlush(bool useDstAlpha) override;
void PrepareDrawBuffers(u32 stride);
NativeVertexFormat *m_CurrentVertexFmt;
};
diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h
index 761772a..8b41b00 100644
--- a/Source/Core/VideoBackends/OGL/VideoBackend.h
+++ b/Source/Core/VideoBackends/OGL/VideoBackend.h
@@ -1,6 +1,6 @@
#pragma once
-#include "VideoBackendBase.h"
+#include "VideoCommon/VideoBackendBase.h"
namespace OGL
{
diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp
index ba7f1a0..b37f428 100644
--- a/Source/Core/VideoBackends/OGL/main.cpp
+++ b/Source/Core/VideoBackends/OGL/main.cpp
@@ -36,57 +36,59 @@ Make AA apply instantly during gameplay if possible
*/
-#include "Globals.h"
-#include "Atomic.h"
-#include "CommonPaths.h"
-#include "Thread.h"
-#include "LogManager.h"
-
-#include <cstdarg>
#include <algorithm>
+#include <cstdarg>
+
+#include "Common/Atomic.h"
+#include "Common/CommonPaths.h"
+#include "Common/LogManager.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+
+#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/Globals.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/OGL/PerfQuery.h"
+#include "VideoBackends/OGL/PostProcessing.h"
+#include "VideoBackends/OGL/ProgramShaderCache.h"
+#include "VideoBackends/OGL/Render.h"
+#include "VideoBackends/OGL/SamplerCache.h"
+#include "VideoBackends/OGL/TextureCache.h"
+#include "VideoBackends/OGL/TextureConverter.h"
+#include "VideoBackends/OGL/VertexManager.h"
+#include "VideoBackends/OGL/VideoBackend.h"
+
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/MainBase.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/VideoState.h"
+
#ifdef _WIN32
-#include "EmuWindow.h"
-#include "IniFile.h"
+#include "Common/IniFile.h"
+#include "VideoCommon/EmuWindow.h"
#endif
#if defined(HAVE_WX) && HAVE_WX
-#include "VideoConfigDiag.h"
-#include "Debugger/DebuggerPanel.h"
+#include "DolphinWX/VideoConfigDiag.h"
+#include "DolphinWX/Debugger/DebuggerPanel.h"
#endif // HAVE_WX
-#include "MainBase.h"
-#include "VideoConfig.h"
-#include "LookUpTables.h"
-#include "ImageWrite.h"
-#include "Render.h"
-#include "GLUtil.h"
-#include "Fifo.h"
-#include "OpcodeDecoding.h"
-#include "TextureCache.h"
-#include "BPStructs.h"
-#include "VertexLoader.h"
-#include "VertexLoaderManager.h"
-#include "VertexManager.h"
-#include "PixelShaderManager.h"
-#include "VertexShaderManager.h"
-#include "ProgramShaderCache.h"
-#include "CommandProcessor.h"
-#include "PixelEngine.h"
-#include "TextureConverter.h"
-#include "PostProcessing.h"
-#include "OnScreenDisplay.h"
-#include "FramebufferManager.h"
-#include "Core.h"
-#include "Host.h"
-#include "SamplerCache.h"
-#include "PerfQuery.h"
-
-#include "VideoState.h"
-#include "IndexGenerator.h"
-#include "VideoBackend.h"
-#include "ConfigManager.h"
-
namespace OGL
{
@@ -97,7 +99,7 @@ std::string VideoBackend::GetName()
std::string VideoBackend::GetDisplayName()
{
- if (g_renderer && GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
+ if (GLInterface != nullptr && GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
return "OpenGLES";
else
return "OpenGL";
diff --git a/Source/Core/VideoBackends/OGL/main.h b/Source/Core/VideoBackends/OGL/main.h
index 7ea6077..0866e82 100644
--- a/Source/Core/VideoBackends/OGL/main.h
+++ b/Source/Core/VideoBackends/OGL/main.h
@@ -4,4 +4,4 @@
#pragma once
-#include "MainBase.h"
+#include "VideoCommon/MainBase.h"
diff --git a/Source/Core/VideoBackends/OGL/stdafx.cpp b/Source/Core/VideoBackends/OGL/stdafx.cpp
index 7c408e1..a4735a1 100644
--- a/Source/Core/VideoBackends/OGL/stdafx.cpp
+++ b/Source/Core/VideoBackends/OGL/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
\ No newline at end of file
+#include "VideoBackends/OGL/stdafx.h"
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/Software/BPMemLoader.cpp b/Source/Core/VideoBackends/Software/BPMemLoader.cpp
index f6f8107..b62776f 100644
--- a/Source/Core/VideoBackends/Software/BPMemLoader.cpp
+++ b/Source/Core/VideoBackends/Software/BPMemLoader.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoCommon.h"
-#include "TextureDecoder.h"
+#include "Core/Core.h"
+#include "Core/HW/Memmap.h"
-#include "BPMemLoader.h"
-#include "EfbCopy.h"
-#include "Rasterizer.h"
-#include "SWPixelEngine.h"
-#include "Tev.h"
-#include "HW/Memmap.h"
-#include "Core.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/EfbCopy.h"
+#include "VideoBackends/Software/Rasterizer.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
+#include "VideoBackends/Software/Tev.h"
+
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/TextureDecoder.h"
void InitBPMemory()
@@ -151,7 +152,7 @@ void SWBPWritten(int address, int newvalue)
}
}
}
- break;
+ break;
case BPMEM_TEV_REGISTER_L: // Reg 1
case BPMEM_TEV_REGISTER_L+2: // Reg 2
diff --git a/Source/Core/VideoBackends/Software/BPMemLoader.h b/Source/Core/VideoBackends/Software/BPMemLoader.h
index 6ea0929..5046e3d 100644
--- a/Source/Core/VideoBackends/Software/BPMemLoader.h
+++ b/Source/Core/VideoBackends/Software/BPMemLoader.h
@@ -5,8 +5,8 @@
#pragma once
-#include "Common.h"
-#include "BPMemory.h"
+#include "Common/Common.h"
+#include "VideoCommon/BPMemory.h"
void InitBPMemory();
void SWBPWritten(int address, int newvalue);
diff --git a/Source/Core/VideoBackends/Software/CPMemLoader.cpp b/Source/Core/VideoBackends/Software/CPMemLoader.cpp
index 98734de..cb57ea5 100644
--- a/Source/Core/VideoBackends/Software/CPMemLoader.cpp
+++ b/Source/Core/VideoBackends/Software/CPMemLoader.cpp
@@ -2,10 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoCommon.h"
-
-#include "CPMemLoader.h"
-#include "HW/Memmap.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoCommon/VideoCommon.h"
void SWLoadCPReg(u32 sub_cmd, u32 value)
diff --git a/Source/Core/VideoBackends/Software/CPMemLoader.h b/Source/Core/VideoBackends/Software/CPMemLoader.h
index a08fac2..4606a9b 100644
--- a/Source/Core/VideoBackends/Software/CPMemLoader.h
+++ b/Source/Core/VideoBackends/Software/CPMemLoader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
-#include "CPMemory.h"
+#include "Common/Common.h"
+#include "VideoCommon/CPMemory.h"
void SWLoadCPReg(u32 sub_cmd, u32 value);
diff --git a/Source/Core/VideoBackends/Software/Clipper.cpp b/Source/Core/VideoBackends/Software/Clipper.cpp
index 6d6069b..976bbeb 100644
--- a/Source/Core/VideoBackends/Software/Clipper.cpp
+++ b/Source/Core/VideoBackends/Software/Clipper.cpp
@@ -35,12 +35,12 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "Clipper.h"
-#include "Rasterizer.h"
-#include "NativeVertexFormat.h"
-#include "XFMemLoader.h"
-#include "BPMemLoader.h"
-#include "SWStatistics.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/Clipper.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
+#include "VideoBackends/Software/Rasterizer.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/XFMemLoader.h"
namespace Clipper
diff --git a/Source/Core/VideoBackends/Software/Clipper.h b/Source/Core/VideoBackends/Software/Clipper.h
index acf32b3..a7e7527 100644
--- a/Source/Core/VideoBackends/Software/Clipper.h
+++ b/Source/Core/VideoBackends/Software/Clipper.h
@@ -4,10 +4,9 @@
#pragma once
-#include "Common.h"
-#include "NativeVertexFormat.h"
-#include "ChunkFile.h"
-
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
namespace Clipper
{
diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp
index 75c6c08..80259a4 100644
--- a/Source/Core/VideoBackends/Software/DebugUtil.cpp
+++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp
@@ -2,19 +2,21 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include "DebugUtil.h"
-#include "BPMemLoader.h"
-#include "TextureSampler.h"
-#include "SWVideoConfig.h"
-#include "EfbInterface.h"
-#include "SWStatistics.h"
-#include "HwRasterizer.h"
-#include "StringUtil.h"
-#include "SWCommandProcessor.h"
-#include "ImageWrite.h"
-#include "FileUtil.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/HwRasterizer.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/TextureSampler.h"
+
+#include "VideoCommon/ImageWrite.h"
+
namespace DebugUtil
{
diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp
index 1f042b8..b800ba8 100644
--- a/Source/Core/VideoBackends/Software/EfbCopy.cpp
+++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "BPMemLoader.h"
-#include "EfbCopy.h"
-#include "EfbInterface.h"
-#include "SWRenderer.h"
-#include "TextureEncoder.h"
-#include "SWStatistics.h"
-#include "SWVideoConfig.h"
-#include "DebugUtil.h"
-#include "HwRasterizer.h"
-#include "SWCommandProcessor.h"
-#include "HW/Memmap.h"
-#include "Core.h"
+#include "Core/Core.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/EfbCopy.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/HwRasterizer.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWRenderer.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/TextureEncoder.h"
static const float s_gammaLUT[] =
{
diff --git a/Source/Core/VideoBackends/Software/EfbCopy.h b/Source/Core/VideoBackends/Software/EfbCopy.h
index 3a8d7d7..9c77862 100644
--- a/Source/Core/VideoBackends/Software/EfbCopy.h
+++ b/Source/Core/VideoBackends/Software/EfbCopy.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace EfbCopy
{
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp
index 8fdcb5f..9da56f3 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.cpp
+++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp
@@ -2,13 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include "Common/Common.h"
+#include "Core/HW/Memmap.h"
-#include "EfbInterface.h"
-#include "BPMemLoader.h"
-#include "LookUpTables.h"
-#include "SWPixelEngine.h"
-#include "HW/Memmap.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
+
+#include "VideoCommon/LookUpTables.h"
u8 efb[EFB_WIDTH*EFB_HEIGHT*6];
@@ -72,9 +73,9 @@ namespace EfbInterface
u32 src = *(u32*)rgb;
u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff00003f;
- val |= (src >> 4) & 0x00000fc0; // blue
- val |= (src >> 6) & 0x0003f000; // green
- val |= (src >> 8) & 0x00fc0000; // red
+ val |= (src >> 4) & 0x00000fc0; // blue
+ val |= (src >> 6) & 0x0003f000; // green
+ val |= (src >> 8) & 0x00fc0000; // red
*dst = val;
}
break;
@@ -112,10 +113,10 @@ namespace EfbInterface
u32 src = *(u32*)color;
u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000;
- val |= (src >> 2) & 0x0000003f; // alpha
- val |= (src >> 4) & 0x00000fc0; // blue
- val |= (src >> 6) & 0x0003f000; // green
- val |= (src >> 8) & 0x00fc0000; // red
+ val |= (src >> 2) & 0x0000003f; // alpha
+ val |= (src >> 4) & 0x00000fc0; // blue
+ val |= (src >> 6) & 0x0003f000; // green
+ val |= (src >> 8) & 0x00fc0000; // red
*dst = val;
}
break;
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.h b/Source/Core/VideoBackends/Software/EfbInterface.h
index 59ef834..da37bef 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.h
+++ b/Source/Core/VideoBackends/Software/EfbInterface.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
namespace EfbInterface
{
diff --git a/Source/Core/VideoBackends/Software/HwRasterizer.cpp b/Source/Core/VideoBackends/Software/HwRasterizer.cpp
index 131b3df..9efc2a6 100644
--- a/Source/Core/VideoBackends/Software/HwRasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/HwRasterizer.cpp
@@ -2,15 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "MemoryUtil.h"
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
-#include <VideoCommon.h>
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/HwRasterizer.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
-#include "BPMemLoader.h"
-#include "HwRasterizer.h"
-#include "NativeVertexFormat.h"
-#include "DebugUtil.h"
+#include "VideoCommon/VideoCommon.h"
#define TEMP_SIZE (1024*1024*4)
diff --git a/Source/Core/VideoBackends/Software/HwRasterizer.h b/Source/Core/VideoBackends/Software/HwRasterizer.h
index f9c5810..cad3fe0 100644
--- a/Source/Core/VideoBackends/Software/HwRasterizer.h
+++ b/Source/Core/VideoBackends/Software/HwRasterizer.h
@@ -6,8 +6,8 @@
#include <map>
-#include "BPMemLoader.h"
-#include "../OGL/GLUtil.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/Software/BPMemLoader.h"
struct OutputVertexData;
diff --git a/Source/Core/VideoBackends/Software/NativeVertexFormat.h b/Source/Core/VideoBackends/Software/NativeVertexFormat.h
index a6e22f9..fe6d336 100644
--- a/Source/Core/VideoBackends/Software/NativeVertexFormat.h
+++ b/Source/Core/VideoBackends/Software/NativeVertexFormat.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Vec3.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "VideoBackends/Software/Vec3.h"
#ifdef WIN32
#define LOADERDECL __cdecl
diff --git a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp
index 21f0a97..0698767 100644
--- a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp
+++ b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp
@@ -2,21 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include "DataReader.h"
-
-#include "OpcodeDecoder.h"
-#include "BPMemLoader.h"
-#include "CPMemLoader.h"
-#include "XFMemLoader.h"
-#include "SWVertexLoader.h"
-#include "SWStatistics.h"
-#include "DebugUtil.h"
-#include "SWCommandProcessor.h"
-#include "CPMemLoader.h"
-#include "SWVideoConfig.h"
-#include "HW/Memmap.h"
+#include "Common/Common.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/OpcodeDecoder.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVertexLoader.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/XFMemLoader.h"
+#include "VideoCommon/DataReader.h"
typedef void (*DecodingFunction)(u32);
@@ -191,8 +188,8 @@ void DecodeStandard(u32 bufferSize)
// zelda 4 swords calls it and checks the metrics registers after that
break;
- case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
- DEBUG_LOG(VIDEO, "Invalidate (vertex cache?)");
+ case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
+ DEBUG_LOG(VIDEO, "Invalidate (vertex cache?)");
break;
case GX_LOAD_BP_REG: //0x61
diff --git a/Source/Core/VideoBackends/Software/OpcodeDecoder.h b/Source/Core/VideoBackends/Software/OpcodeDecoder.h
index 4ba8350..3d33b18 100644
--- a/Source/Core/VideoBackends/Software/OpcodeDecoder.h
+++ b/Source/Core/VideoBackends/Software/OpcodeDecoder.h
@@ -4,8 +4,8 @@
#pragma once
-#include "CommonTypes.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/CommonTypes.h"
namespace OpcodeDecoder
{
diff --git a/Source/Core/VideoBackends/Software/RasterFont.cpp b/Source/Core/VideoBackends/Software/RasterFont.cpp
index 461ce7d..7876ac4 100644
--- a/Source/Core/VideoBackends/Software/RasterFont.cpp
+++ b/Source/Core/VideoBackends/Software/RasterFont.cpp
@@ -2,12 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "../OGL/GLUtil.h"
-
#include <string.h>
-#include "RasterFont.h"
-// globals
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/Software/RasterFont.h"
const GLubyte rasters[][13] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp
index 377a437..8c59455 100644
--- a/Source/Core/VideoBackends/Software/Rasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp
@@ -2,17 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include "Rasterizer.h"
-#include "HwRasterizer.h"
-#include "EfbInterface.h"
-#include "BPMemLoader.h"
-#include "XFMemLoader.h"
-#include "Tev.h"
-#include "SWPixelEngine.h"
-#include "SWStatistics.h"
-#include "SWVideoConfig.h"
+#include "Common/Common.h"
+
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/HwRasterizer.h"
+#include "VideoBackends/Software/Rasterizer.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/Tev.h"
+#include "VideoBackends/Software/XFMemLoader.h"
#define BLOCK_SIZE 2
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.h b/Source/Core/VideoBackends/Software/Rasterizer.h
index a459914..7d64b8a 100644
--- a/Source/Core/VideoBackends/Software/Rasterizer.h
+++ b/Source/Core/VideoBackends/Software/Rasterizer.h
@@ -4,8 +4,8 @@
#pragma once
-#include "NativeVertexFormat.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
namespace Rasterizer
{
diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
index 06876a2..bf37b47 100644
--- a/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
+++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.cpp
@@ -2,20 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "Thread.h"
-#include "Atomic.h"
-#include "ConfigManager.h"
-#include "Core.h"
-#include "CoreTiming.h"
-#include "HW/Memmap.h"
-#include "HW/ProcessorInterface.h"
-
-#include "VideoBackend.h"
-#include "SWCommandProcessor.h"
-#include "ChunkFile.h"
-#include "MathUtil.h"
-#include "OpcodeDecoder.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "Common/Thread.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+
+#include "VideoBackends/Software/OpcodeDecoder.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/VideoBackend.h"
namespace SWCommandProcessor
@@ -124,147 +126,53 @@ void RunGpu()
}
}
-void Read16(u16& _rReturnValue, const u32 _Address)
-{
- u32 regAddr = (_Address & 0xFFF) >> 1;
-
- DEBUG_LOG(COMMANDPROCESSOR, "(r): 0x%08x : 0x%08x", _Address, ((u16*)&cpreg)[regAddr]);
-
- if (regAddr < 0x20)
- _rReturnValue = ((u16*)&cpreg)[regAddr];
- else
- _rReturnValue = 0;
-}
-
-void Write16(const u16 _Value, const u32 _Address)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- INFO_LOG(COMMANDPROCESSOR, "(write16): 0x%04x @ 0x%08x",_Value,_Address);
+ // Directly map reads and writes to the cpreg structure.
+ for (size_t i = 0; i < sizeof (cpreg) / sizeof (u16); ++i)
+ {
+ u16* ptr = ((u16*)&cpreg) + i;
+ mmio->Register(base | (i * 2),
+ MMIO::DirectRead<u16>(ptr),
+ MMIO::DirectWrite<u16>(ptr)
+ );
+ }
- switch (_Address & 0xFFF)
+ // Bleh. Apparently SWCommandProcessor does not know about regs 0x40 to
+ // 0x64...
+ for (size_t i = 0x40; i < 0x64; ++i)
{
- case STATUS_REGISTER:
- {
- ERROR_LOG(COMMANDPROCESSOR,"\t write to STATUS_REGISTER : %04x", _Value);
- }
- break;
+ mmio->Register(base | i,
+ MMIO::Constant<u16>(0),
+ MMIO::Nop<u16>()
+ );
+ }
- case CTRL_REGISTER:
- {
- cpreg.ctrl.Hex = _Value;
-
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to CTRL_REGISTER : %04x", _Value);
- DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | CPULINK %s | BP %s || BPIntEnable %s | OvF %s | UndF %s"
- , cpreg.ctrl.GPReadEnable ? "ON" : "OFF"
- , cpreg.ctrl.GPLinkEnable ? "ON" : "OFF"
- , cpreg.ctrl.BPEnable ? "ON" : "OFF"
- , cpreg.ctrl.BreakPointIntEnable ? "ON" : "OFF"
- , cpreg.ctrl.FifoOverflowIntEnable ? "ON" : "OFF"
- , cpreg.ctrl.FifoUnderflowIntEnable ? "ON" : "OFF"
- );
- }
- break;
+ // The low part of MMIO regs for FIFO addresses needs to be aligned to 32
+ // bytes.
+ u32 fifo_addr_lo_regs[] = {
+ FIFO_BASE_LO, FIFO_END_LO, FIFO_WRITE_POINTER_LO,
+ FIFO_READ_POINTER_LO, FIFO_BP_LO, FIFO_RW_DISTANCE_LO,
+ };
+ for (u32 reg : fifo_addr_lo_regs)
+ {
+ mmio->RegisterWrite(base | reg,
+ MMIO::DirectWrite<u16>(((u16*)&cpreg) + (reg / 2), 0xFFE0)
+ );
+ }
- case CLEAR_REGISTER:
- {
- UCPClearReg tmpClear(_Value);
+ // The clear register needs to perform some more complicated operations on
+ // writes.
+ mmio->RegisterWrite(base | CLEAR_REGISTER,
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UCPClearReg tmpClear(val);
if (tmpClear.ClearFifoOverflow)
cpreg.status.OverflowHiWatermark = 0;
if (tmpClear.ClearFifoUnderflow)
cpreg.status.UnderflowLoWatermark = 0;
-
- INFO_LOG(COMMANDPROCESSOR,"\t write to CLEAR_REGISTER : %04x",_Value);
- }
- break;
-
- // Fifo Registers
- case FIFO_TOKEN_REGISTER:
- cpreg.token = _Value;
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_TOKEN_REGISTER : %04x", _Value);
- break;
-
- case FIFO_BASE_LO:
- WriteLow ((u32 &)cpreg.fifobase, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_LO. FIFO base is : %08x", cpreg.fifobase);
- break;
- case FIFO_BASE_HI:
- WriteHigh((u32 &)cpreg.fifobase, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BASE_HI. FIFO base is : %08x", cpreg.fifobase);
- break;
- case FIFO_END_LO:
- WriteLow ((u32 &)cpreg.fifoend, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_LO. FIFO end is : %08x", cpreg.fifoend);
- break;
- case FIFO_END_HI:
- WriteHigh((u32 &)cpreg.fifoend, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_HI. FIFO end is : %08x", cpreg.fifoend);
- break;
-
- case FIFO_WRITE_POINTER_LO:
- WriteLow ((u32 &)cpreg.writeptr, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_LO. write ptr is : %08x", cpreg.writeptr);
- break;
- case FIFO_WRITE_POINTER_HI:
- WriteHigh ((u32 &)cpreg.writeptr, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_WRITE_POINTER_HI. write ptr is : %08x", cpreg.writeptr);
- break;
- case FIFO_READ_POINTER_LO:
- WriteLow ((u32 &)cpreg.readptr, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_LO. read ptr is : %08x", cpreg.readptr);
- break;
- case FIFO_READ_POINTER_HI:
- WriteHigh ((u32 &)cpreg.readptr, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_READ_POINTER_HI. read ptr is : %08x", cpreg.readptr);
- break;
-
- case FIFO_HI_WATERMARK_LO:
- WriteLow ((u32 &)cpreg.hiwatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_LO. hiwatermark is : %08x", cpreg.hiwatermark);
- break;
- case FIFO_HI_WATERMARK_HI:
- WriteHigh ((u32 &)cpreg.hiwatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI. hiwatermark is : %08x", cpreg.hiwatermark);
- break;
- case FIFO_LO_WATERMARK_LO:
- WriteLow ((u32 &)cpreg.lowatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_LO. lowatermark is : %08x", cpreg.lowatermark);
- break;
- case FIFO_LO_WATERMARK_HI:
- WriteHigh ((u32 &)cpreg.lowatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_LO_WATERMARK_HI. lowatermark is : %08x", cpreg.lowatermark);
- break;
-
- case FIFO_BP_LO:
- WriteLow ((u32 &)cpreg.breakpt, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_LO. breakpoint is : %08x", cpreg.breakpt);
- break;
- case FIFO_BP_HI:
- WriteHigh ((u32 &)cpreg.breakpt, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_BP_HI. breakpoint is : %08x", cpreg.breakpt);
- break;
-
- case FIFO_RW_DISTANCE_LO:
- WriteLow ((u32 &)cpreg.rwdistance, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_LO. rwdistance is : %08x", cpreg.rwdistance);
- break;
- case FIFO_RW_DISTANCE_HI:
- WriteHigh ((u32 &)cpreg.rwdistance, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_RW_DISTANCE_HI. rwdistance is : %08x", cpreg.rwdistance);
- break;
- }
-
- RunGpu();
-}
-
-void Read32(u32& _rReturnValue, const u32 _Address)
-{
- _rReturnValue = 0;
- _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Read32 from CommandProcessor at 0x%08x", _Address);
-}
-
-void Write32(const u32 _Data, const u32 _Address)
-{
- _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProcessor at 0x%08x", _Address);
+ })
+ );
}
void STACKALIGN GatherPipeBursted()
diff --git a/Source/Core/VideoBackends/Software/SWCommandProcessor.h b/Source/Core/VideoBackends/Software/SWCommandProcessor.h
index 043ff85..885ef6c 100644
--- a/Source/Core/VideoBackends/Software/SWCommandProcessor.h
+++ b/Source/Core/VideoBackends/Software/SWCommandProcessor.h
@@ -4,9 +4,10 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
extern volatile bool g_bSkipCurrentFrame;
extern u8* g_pVideoData;
@@ -123,15 +124,11 @@ namespace SWCommandProcessor
void Shutdown();
void DoState(PointerWrap &p);
+ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
+
bool RunBuffer();
void RunGpu();
- // Read
- void Read16(u16& _rReturnValue, const u32 _Address);
- void Write16(const u16 _Data, const u32 _Address);
- void Read32(u32& _rReturnValue, const u32 _Address);
- void Write32(const u32 _Data, const u32 _Address);
-
// for CGPFIFO
void GatherPipeBursted();
void UpdateInterrupts(u64 userdata);
diff --git a/Source/Core/VideoBackends/Software/SWPixelEngine.cpp b/Source/Core/VideoBackends/Software/SWPixelEngine.cpp
index 4d2f44f..bc92575 100644
--- a/Source/Core/VideoBackends/Software/SWPixelEngine.cpp
+++ b/Source/Core/VideoBackends/Software/SWPixelEngine.cpp
@@ -2,19 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-
// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!!
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
-#include "Common.h"
-#include "ChunkFile.h"
-#include "CoreTiming.h"
-#include "ConfigManager.h"
-#include "HW/ProcessorInterface.h"
-
-#include "SWPixelEngine.h"
-#include "SWCommandProcessor.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
namespace SWPixelEngine
@@ -60,48 +59,34 @@ void Init()
et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread);
}
-void Read16(u16& _uReturnValue, const u32 _iAddress)
-{
- DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
-
- u16 address = _iAddress & 0xFFF;
-
- if (address <= 0x2e)
- _uReturnValue = ((u16*)&pereg)[address >> 1];
-}
-
-void Write32(const u32 _iValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- WARN_LOG(PIXELENGINE, "(w32): 0x%08x @ 0x%08x",_iValue,_iAddress);
-}
-
-void Write16(const u16 _iValue, const u32 _iAddress)
-{
- u16 address = _iAddress & 0xFFF;
-
- switch (address)
+ // Directly map reads and writes to the pereg structure.
+ for (size_t i = 0; i < sizeof (pereg) / sizeof (u16); ++i)
{
- case PE_CTRL_REGISTER:
- {
- UPECtrlReg tmpCtrl(_iValue);
+ u16* ptr = (u16*)&pereg + i;
+ mmio->Register(base | (i * 2),
+ MMIO::DirectRead<u16>(ptr),
+ MMIO::DirectWrite<u16>(ptr)
+ );
+ }
+
+ // The control register has some more complex logic to perform on writes.
+ mmio->RegisterWrite(base | PE_CTRL_REGISTER,
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UPECtrlReg tmpCtrl(val);
- if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
- if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
+ if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
+ if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
pereg.ctrl.PETokenEnable = tmpCtrl.PETokenEnable;
pereg.ctrl.PEFinishEnable = tmpCtrl.PEFinishEnable;
- pereg.ctrl.PEToken = 0; // this flag is write only
- pereg.ctrl.PEFinish = 0; // this flag is write only
+ pereg.ctrl.PEToken = 0; // this flag is write only
+ pereg.ctrl.PEFinish = 0; // this flag is write only
- DEBUG_LOG(PIXELENGINE, "(w16): PE_CTRL_REGISTER: 0x%04x", _iValue);
UpdateInterrupts();
- }
- break;
- default:
- if (address <= 0x2e)
- ((u16*)&pereg)[address >> 1] = _iValue;
- break;
- }
+ })
+ );
}
bool AllowIdleSkipping()
@@ -112,7 +97,7 @@ bool AllowIdleSkipping()
void UpdateInterrupts()
{
// check if there is a token-interrupt
- if (g_bSignalTokenInterrupt & pereg.ctrl.PETokenEnable)
+ if (g_bSignalTokenInterrupt & pereg.ctrl.PETokenEnable)
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, true);
else
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, false);
diff --git a/Source/Core/VideoBackends/Software/SWPixelEngine.h b/Source/Core/VideoBackends/Software/SWPixelEngine.h
index 5e4018a..93cab0b 100644
--- a/Source/Core/VideoBackends/Software/SWPixelEngine.h
+++ b/Source/Core/VideoBackends/Software/SWPixelEngine.h
@@ -4,10 +4,11 @@
#pragma once
-#include "Common.h"
-#include "VideoCommon.h"
+#include "Common/Common.h"
+#include "VideoCommon/VideoCommon.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
namespace SWPixelEngine
{
@@ -200,12 +201,7 @@ namespace SWPixelEngine
void Init();
void DoState(PointerWrap &p);
- // Read
- void Read16(u16& _uReturnValue, const u32 _iAddress);
-
- // Write
- void Write16(const u16 _iValue, const u32 _iAddress);
- void Write32(const u32 _iValue, const u32 _iAddress);
+ void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// gfx backend support
void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
index 783a8ee..fab7b4b 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp
@@ -2,17 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include "../OGL/GLUtil.h"
-#include "Core.h"
-#include "ImageWrite.h"
-#include "RasterFont.h"
-#include "SWRenderer.h"
-#include "SWStatistics.h"
-#include "SWCommandProcessor.h"
-
-#include "OnScreenDisplay.h"
+#include "Common/Common.h"
+#include "Core/Core.h"
+#include "VideoBackends/OGL/GLUtil.h"
+#include "VideoBackends/Software/RasterFont.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWRenderer.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoCommon/ImageWrite.h"
+#include "VideoCommon/OnScreenDisplay.h"
static GLuint s_RenderTarget = 0;
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h
index 97b6556..20ba425 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.h
+++ b/Source/Core/VideoBackends/Software/SWRenderer.h
@@ -4,12 +4,12 @@
#pragma once
-#include "CommonTypes.h"
-#include "EfbInterface.h"
-#include "Thread.h"
+#include "Common/CommonTypes.h"
+#include "Common/Thread.h"
+#include "VideoBackends/Software/EfbInterface.h"
namespace SWRenderer
-{
+{
void Init();
void Prepare();
void Shutdown();
diff --git a/Source/Core/VideoBackends/Software/SWStatistics.cpp b/Source/Core/VideoBackends/Software/SWStatistics.cpp
index c033e2f..e1d3ec8 100644
--- a/Source/Core/VideoBackends/Software/SWStatistics.cpp
+++ b/Source/Core/VideoBackends/Software/SWStatistics.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SWStatistics.h"
+#include "VideoBackends/Software/SWStatistics.h"
SWStatistics swstats;
diff --git a/Source/Core/VideoBackends/Software/SWStatistics.h b/Source/Core/VideoBackends/Software/SWStatistics.h
index b77953f..61f41c7 100644
--- a/Source/Core/VideoBackends/Software/SWStatistics.h
+++ b/Source/Core/VideoBackends/Software/SWStatistics.h
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonTypes.h"
-#include "SWVideoConfig.h"
+#include "Common/CommonTypes.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
#pragma once
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
index f08e2f3..fbecdae 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp
@@ -2,22 +2,21 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include "SWVertexLoader.h"
-#include "VertexLoader_Position.h"
-#include "VertexLoader_Normal.h"
-#include "VertexLoader_Color.h"
-#include "VertexLoader_TextCoord.h"
-
-#include "CPMemLoader.h"
-#include "XFMemLoader.h"
-
-#include "TransformUnit.h"
-#include "SetupUnit.h"
-#include "SWStatistics.h"
-#include "VertexManagerBase.h"
-#include "DataReader.h"
+#include "Common/Common.h"
+
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/SetupUnit.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVertexLoader.h"
+#include "VideoBackends/Software/TransformUnit.h"
+#include "VideoBackends/Software/XFMemLoader.h"
+
+#include "VideoCommon/DataReader.h"
+#include "VideoCommon/VertexLoader_Color.h"
+#include "VideoCommon/VertexLoader_Normal.h"
+#include "VideoCommon/VertexLoader_Position.h"
+#include "VideoCommon/VertexLoader_TextCoord.h"
+#include "VideoCommon/VertexManagerBase.h"
// Vertex loaders read these
extern int tcIndex;
@@ -182,12 +181,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
case DIRECT:
switch (colComp[i])
{
- case FORMAT_16B_565: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_565); break;
- case FORMAT_24B_888: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_888); break;
- case FORMAT_32B_888x: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_888x); break;
- case FORMAT_16B_4444: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_4444); break;
- case FORMAT_24B_6666: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_6666); break;
- case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break;
+ case FORMAT_16B_565: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_565); break;
+ case FORMAT_24B_888: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_888); break;
+ case FORMAT_32B_888x: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_888x); break;
+ case FORMAT_16B_4444: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_4444); break;
+ case FORMAT_24B_6666: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_6666); break;
+ case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
@@ -196,12 +195,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
m_VertexSize += 1;
switch (colComp[i])
{
- case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex8_16b_565); break;
- case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex8_24b_888); break;
- case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex8_32b_888x); break;
- case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex8_16b_4444); break;
- case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex8_24b_6666); break;
- case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break;
+ case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex8_16b_565); break;
+ case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex8_24b_888); break;
+ case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex8_32b_888x); break;
+ case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex8_16b_4444); break;
+ case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex8_24b_6666); break;
+ case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
@@ -210,12 +209,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
m_VertexSize += 2;
switch (colComp[i])
{
- case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex16_16b_565); break;
- case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex16_24b_888); break;
- case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex16_32b_888x); break;
- case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex16_16b_4444); break;
- case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex16_24b_6666); break;
- case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break;
+ case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex16_16b_565); break;
+ case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex16_24b_888); break;
+ case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex16_32b_888x); break;
+ case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex16_16b_4444); break;
+ case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex16_24b_6666); break;
+ case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.h b/Source/Core/VideoBackends/Software/SWVertexLoader.h
index 0b6a023..ed6bf0b 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.h
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.h
@@ -4,11 +4,11 @@
#pragma once
-#include "Common.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
-#include "NativeVertexFormat.h"
-#include "CPMemLoader.h"
-#include "ChunkFile.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
class SetupUnit;
diff --git a/Source/Core/VideoBackends/Software/SWVideoConfig.cpp b/Source/Core/VideoBackends/Software/SWVideoConfig.cpp
index 36f9126..091eab3 100644
--- a/Source/Core/VideoBackends/Software/SWVideoConfig.cpp
+++ b/Source/Core/VideoBackends/Software/SWVideoConfig.cpp
@@ -2,9 +2,9 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FileUtil.h"
-#include "IniFile.h"
-#include "SWVideoConfig.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
SWVideoConfig g_SWVideoConfig;
diff --git a/Source/Core/VideoBackends/Software/SWVideoConfig.h b/Source/Core/VideoBackends/Software/SWVideoConfig.h
index 0de5b93..758f9bb 100644
--- a/Source/Core/VideoBackends/Software/SWVideoConfig.h
+++ b/Source/Core/VideoBackends/Software/SWVideoConfig.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
#define STATISTICS 1
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index 4f60f9d..efc4471 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -2,39 +2,40 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-
-#include "Common.h"
+#include "Common/Common.h"
#if defined(HAVE_WX) && HAVE_WX
-#include "VideoConfigDialog.h"
+#include "VideoBackends/Software/VideoConfigDialog.h"
#endif // HAVE_WX
-#include "../OGL/GLExtensions/GLExtensions.h"
-#include "Atomic.h"
-#include "SWCommandProcessor.h"
-#include "OpcodeDecoder.h"
-#include "SWVideoConfig.h"
-#include "SWPixelEngine.h"
-#include "BPMemLoader.h"
-#include "XFMemLoader.h"
-#include "Clipper.h"
-#include "Rasterizer.h"
-#include "SWRenderer.h"
-#include "HwRasterizer.h"
-#include "LogManager.h"
-#include "EfbInterface.h"
-#include "DebugUtil.h"
-#include "FileUtil.h"
-#include "VideoBackend.h"
-#include "Core.h"
-#include "OpcodeDecoder.h"
-#include "SWVertexLoader.h"
-#include "SWStatistics.h"
-#include "HW/VideoInterface.h"
-#include "HW/Memmap.h"
-#include "ConfigManager.h"
-
-#include "OnScreenDisplay.h"
+#include "Common/Atomic.h"
+#include "Common/FileUtil.h"
+#include "Common/LogManager.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/VideoInterface.h"
+
+#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/Clipper.h"
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/HwRasterizer.h"
+#include "VideoBackends/Software/OpcodeDecoder.h"
+#include "VideoBackends/Software/Rasterizer.h"
+#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWRenderer.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVertexLoader.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/VideoBackend.h"
+#include "VideoBackends/Software/XFMemLoader.h"
+
+#include "VideoCommon/OnScreenDisplay.h"
+
#define VSYNC_ENABLED 0
static volatile u32 s_swapRequested = false;
@@ -360,28 +361,15 @@ void VideoSoftware::Video_AbortFrame(void)
{
}
-readFn16 VideoSoftware::Video_CPRead16()
+void VideoSoftware::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
{
- return SWCommandProcessor::Read16;
-}
-writeFn16 VideoSoftware::Video_CPWrite16()
-{
- return SWCommandProcessor::Write16;
+ SWCommandProcessor::RegisterMMIO(mmio, base);
}
-readFn16 VideoSoftware::Video_PERead16()
+void VideoSoftware::RegisterPEMMIO(MMIO::Mapping* mmio, u32 base)
{
- return SWPixelEngine::Read16;
+ SWPixelEngine::RegisterMMIO(mmio, base);
}
-writeFn16 VideoSoftware::Video_PEWrite16()
-{
- return SWPixelEngine::Write16;
-}
-writeFn32 VideoSoftware::Video_PEWrite32()
-{
- return SWPixelEngine::Write32;
-}
-
// Draw messages on top of the screen
unsigned int VideoSoftware::PeekMessages()
diff --git a/Source/Core/VideoBackends/Software/SetupUnit.cpp b/Source/Core/VideoBackends/Software/SetupUnit.cpp
index b08584e..c324dcf 100644
--- a/Source/Core/VideoBackends/Software/SetupUnit.cpp
+++ b/Source/Core/VideoBackends/Software/SetupUnit.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "SetupUnit.h"
-
-#include "CPMemLoader.h"
-#include "OpcodeDecoder.h"
-#include "SWStatistics.h"
-#include "Clipper.h"
+#include "VideoBackends/Software/Clipper.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/OpcodeDecoder.h"
+#include "VideoBackends/Software/SetupUnit.h"
+#include "VideoBackends/Software/SWStatistics.h"
void SetupUnit::Init(u8 primitiveType)
diff --git a/Source/Core/VideoBackends/Software/SetupUnit.h b/Source/Core/VideoBackends/Software/SetupUnit.h
index 37e5017..36163f0 100644
--- a/Source/Core/VideoBackends/Software/SetupUnit.h
+++ b/Source/Core/VideoBackends/Software/SetupUnit.h
@@ -4,9 +4,9 @@
#pragma once
-#include "Common.h"
-#include "NativeVertexFormat.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
class SetupUnit
{
diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp
index 69c16ae..5ebdcd7 100644
--- a/Source/Core/VideoBackends/Software/Tev.cpp
+++ b/Source/Core/VideoBackends/Software/Tev.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
+#include <cmath>
-#include "Tev.h"
-#include "EfbInterface.h"
-#include "TextureSampler.h"
-#include "XFMemLoader.h"
-#include "SWPixelEngine.h"
-#include "SWStatistics.h"
-#include "SWVideoConfig.h"
-#include "DebugUtil.h"
+#include "Common/Common.h"
-#include <cmath>
+#include "VideoBackends/Software/DebugUtil.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/SWPixelEngine.h"
+#include "VideoBackends/Software/SWStatistics.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoBackends/Software/Tev.h"
+#include "VideoBackends/Software/TextureSampler.h"
+#include "VideoBackends/Software/XFMemLoader.h"
#ifdef _DEBUG
#define ALLOW_TEV_DUMPS 1
@@ -119,7 +119,7 @@ inline s16 Clamp255(s16 in)
inline s16 Clamp1024(s16 in)
{
- return in>1023?1023:(in<-1024?-1024:in);
+ return in>1023?1023:(in<-1024?-1024:in);
}
void Tev::SetRasColor(int colorChan, int swaptable)
@@ -595,10 +595,12 @@ void Tev::Draw()
#if ALLOW_TEV_DUMPS
if (g_SWVideoConfig.bDumpTevStages)
{
- u8 stage[4] = { IndirectTex[stageNum][TextureSampler::ALP_SMP],
- IndirectTex[stageNum][TextureSampler::BLU_SMP],
- IndirectTex[stageNum][TextureSampler::GRN_SMP],
- 255};
+ u8 stage[4] = {
+ IndirectTex[stageNum][TextureSampler::ALP_SMP],
+ IndirectTex[stageNum][TextureSampler::BLU_SMP],
+ IndirectTex[stageNum][TextureSampler::GRN_SMP],
+ 255
+ };
DebugUtil::DrawTempBuffer(stage, INDIRECT + stageNum);
}
#endif
diff --git a/Source/Core/VideoBackends/Software/Tev.h b/Source/Core/VideoBackends/Software/Tev.h
index 0642778..617dee8 100644
--- a/Source/Core/VideoBackends/Software/Tev.h
+++ b/Source/Core/VideoBackends/Software/Tev.h
@@ -4,8 +4,8 @@
#pragma once
-#include "BPMemLoader.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "VideoBackends/Software/BPMemLoader.h"
class Tev
{
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
index 07bb162..6c24257 100644
--- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp
+++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "TextureEncoder.h"
-#include "EfbInterface.h"
-#include "BPMemLoader.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/EfbInterface.h"
+#include "VideoBackends/Software/TextureEncoder.h"
-#include "LookUpTables.h"
-#include "TextureDecoder.h"
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/TextureDecoder.h"
namespace TextureEncoder
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.h b/Source/Core/VideoBackends/Software/TextureEncoder.h
index c675f1f..84e8004 100644
--- a/Source/Core/VideoBackends/Software/TextureEncoder.h
+++ b/Source/Core/VideoBackends/Software/TextureEncoder.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace TextureEncoder
{
diff --git a/Source/Core/VideoBackends/Software/TextureSampler.cpp b/Source/Core/VideoBackends/Software/TextureSampler.cpp
index 0657f70..4f5a3a4 100644
--- a/Source/Core/VideoBackends/Software/TextureSampler.cpp
+++ b/Source/Core/VideoBackends/Software/TextureSampler.cpp
@@ -2,11 +2,10 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "TextureSampler.h"
-
-#include "BPMemLoader.h"
-#include "TextureDecoder.h"
-#include "HW/Memmap.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/TextureSampler.h"
+#include "VideoCommon/TextureDecoder.h"
#include <cmath>
diff --git a/Source/Core/VideoBackends/Software/TextureSampler.h b/Source/Core/VideoBackends/Software/TextureSampler.h
index 6cd1353..d821ace 100644
--- a/Source/Core/VideoBackends/Software/TextureSampler.h
+++ b/Source/Core/VideoBackends/Software/TextureSampler.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
namespace TextureSampler
{
diff --git a/Source/Core/VideoBackends/Software/TransformUnit.cpp b/Source/Core/VideoBackends/Software/TransformUnit.cpp
index e00f05e..f0722ce 100644
--- a/Source/Core/VideoBackends/Software/TransformUnit.cpp
+++ b/Source/Core/VideoBackends/Software/TransformUnit.cpp
@@ -2,17 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-
-#include <math.h>
-
-#include "TransformUnit.h"
-#include "XFMemLoader.h"
-#include "CPMemLoader.h"
-#include "BPMemLoader.h"
-#include "NativeVertexFormat.h"
-
-#include "Vec3.h"
+#include <cmath>
+
+#include "Common/Common.h"
+#include "VideoBackends/Software/BPMemLoader.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/NativeVertexFormat.h"
+#include "VideoBackends/Software/TransformUnit.h"
+#include "VideoBackends/Software/Vec3.h"
+#include "VideoBackends/Software/XFMemLoader.h"
namespace TransformUnit
diff --git a/Source/Core/VideoBackends/Software/Vec3.h b/Source/Core/VideoBackends/Software/Vec3.h
index 08f8877..192355c 100644
--- a/Source/Core/VideoBackends/Software/Vec3.h
+++ b/Source/Core/VideoBackends/Software/Vec3.h
@@ -4,9 +4,10 @@
#pragma once
-#include <stdlib.h>
-#include <math.h>
-#include "ChunkFile.h"
+#include <cmath>
+#include <cstdlib>
+
+#include "Common/ChunkFile.h"
class Vec3
{
diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h
index cf955bf..1559427 100644
--- a/Source/Core/VideoBackends/Software/VideoBackend.h
+++ b/Source/Core/VideoBackends/Software/VideoBackend.h
@@ -1,6 +1,8 @@
#pragma once
-#include "VideoBackendBase.h"
+#include "VideoCommon/VideoBackendBase.h"
+
+namespace MMIO { class Mapping; }
namespace SW
{
@@ -44,11 +46,8 @@ class VideoSoftware : public VideoBackend
bool Video_IsPossibleWaitingSetDrawDone() override;
void Video_AbortFrame() override;
- readFn16 Video_CPRead16() override;
- writeFn16 Video_CPWrite16() override;
- readFn16 Video_PERead16() override;
- writeFn16 Video_PEWrite16() override;
- writeFn32 Video_PEWrite32() override;
+ void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
+ void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) override;
void UpdateFPSDisplay(const char*) override;
unsigned int PeekMessages() override;
diff --git a/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp b/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp
index 8d0d999..d730efd 100644
--- a/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp
+++ b/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp
@@ -2,11 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoConfigDiag.h"
-#include "VideoConfigDialog.h"
-#include "FileUtil.h"
-#include "Core.h"
+#include "Common/FileUtil.h"
+#include "Core/Core.h"
+#include "DolphinWX/VideoConfigDiag.h"
+#include "VideoBackends/Software/VideoConfigDialog.h"
template <typename T>
IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style) :
diff --git a/Source/Core/VideoBackends/Software/VideoConfigDialog.h b/Source/Core/VideoBackends/Software/VideoConfigDialog.h
index e0884dd..057ceb1 100644
--- a/Source/Core/VideoBackends/Software/VideoConfigDialog.h
+++ b/Source/Core/VideoBackends/Software/VideoConfigDialog.h
@@ -4,12 +4,12 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
-#include "SWVideoConfig.h"
-#include "VideoBackendBase.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "VideoBackends/Software/SWVideoConfig.h"
+#include "VideoCommon/VideoBackendBase.h"
#include <wx/wx.h>
#include <wx/textctrl.h>
diff --git a/Source/Core/VideoBackends/Software/XFMemLoader.cpp b/Source/Core/VideoBackends/Software/XFMemLoader.cpp
index 899a5fa..07d5393 100644
--- a/Source/Core/VideoBackends/Software/XFMemLoader.cpp
+++ b/Source/Core/VideoBackends/Software/XFMemLoader.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoCommon.h"
-
-#include "XFMemLoader.h"
-#include "CPMemLoader.h"
-#include "Clipper.h"
-#include "HW/Memmap.h"
+#include "Core/HW/Memmap.h"
+#include "VideoBackends/Software/Clipper.h"
+#include "VideoBackends/Software/CPMemLoader.h"
+#include "VideoBackends/Software/XFMemLoader.h"
+#include "VideoCommon/VideoCommon.h"
XFRegisters swxfregs;
diff --git a/Source/Core/VideoBackends/Software/XFMemLoader.h b/Source/Core/VideoBackends/Software/XFMemLoader.h
index d790c98..4a827cd 100644
--- a/Source/Core/VideoBackends/Software/XFMemLoader.h
+++ b/Source/Core/VideoBackends/Software/XFMemLoader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
/////////////
// Lighting
diff --git a/Source/Core/VideoBackends/Software/stdafx.cpp b/Source/Core/VideoBackends/Software/stdafx.cpp
index b602b39..dff656a 100644
--- a/Source/Core/VideoBackends/Software/stdafx.cpp
+++ b/Source/Core/VideoBackends/Software/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "VideoBackends/Software/stdafx.h"
diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp
index d6f2755..e2c2417 100644
--- a/Source/Core/VideoCommon/AVIDump.cpp
+++ b/Source/Core/VideoCommon/AVIDump.cpp
@@ -6,9 +6,9 @@
#define __STDC_CONSTANT_MACROS 1
#endif
-#include "AVIDump.h"
-#include "HW/VideoInterface.h" //for TargetRefreshRate
-#include "VideoConfig.h"
+#include "Core/HW/VideoInterface.h" //for TargetRefreshRate
+#include "VideoCommon/AVIDump.h"
+#include "VideoCommon/VideoConfig.h"
#ifdef _WIN32
@@ -19,9 +19,9 @@
#include <vfw.h>
#include <winerror.h>
-#include "FileUtil.h"
-#include "CommonPaths.h"
-#include "Log.h"
+#include "Common/CommonPaths.h"
+#include "Common/FileUtil.h"
+#include "Common/Log.h"
HWND m_emuWnd;
LONG m_byteBuffer;
@@ -204,9 +204,9 @@ bool AVIDump::SetVideoFormat()
#else
-#include "FileUtil.h"
-#include "StringUtil.h"
-#include "Log.h"
+#include "Common/FileUtil.h"
+#include "Common/Log.h"
+#include "Common/StringUtil.h"
extern "C" {
#include <libavcodec/avcodec.h>
diff --git a/Source/Core/VideoCommon/AVIDump.h b/Source/Core/VideoCommon/AVIDump.h
index b12f316..c9aa2a4 100644
--- a/Source/Core/VideoCommon/AVIDump.h
+++ b/Source/Core/VideoCommon/AVIDump.h
@@ -10,7 +10,7 @@
#include <stdint.h>
#endif
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class AVIDump
{
diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp
index 43623a9..a3bcd3a 100644
--- a/Source/Core/VideoCommon/BPFunctions.cpp
+++ b/Source/Core/VideoCommon/BPFunctions.cpp
@@ -2,15 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "BPFunctions.h"
-#include "Common.h"
-#include "RenderBase.h"
-#include "TextureCacheBase.h"
-#include "VertexManagerBase.h"
-#include "VertexShaderManager.h"
-#include "VideoConfig.h"
-#include "HW/Memmap.h"
-#include "ConfigManager.h"
+#include "Common/Common.h"
+
+#include "Core/ConfigManager.h"
+#include "Core/HW/Memmap.h"
+
+#include "VideoCommon/BPFunctions.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
const bool renderFog = false;
namespace BPFunctions
@@ -47,8 +49,7 @@ void SetScissor()
if (rc.left > rc.right) rc.right = rc.left;
if (rc.top > rc.bottom) rc.bottom = rc.top;
- TargetRectangle trc = g_renderer->ConvertEFBRectangle(rc);
- g_renderer->SetScissorRect(trc);
+ g_renderer->SetScissorRect(rc);
}
void SetLineWidth()
diff --git a/Source/Core/VideoCommon/BPFunctions.h b/Source/Core/VideoCommon/BPFunctions.h
index b750e81..dfaaa39 100644
--- a/Source/Core/VideoCommon/BPFunctions.h
+++ b/Source/Core/VideoCommon/BPFunctions.h
@@ -9,8 +9,8 @@
#pragma once
-#include "BPMemory.h"
-#include "VideoCommon.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/VideoCommon.h"
namespace BPFunctions
{
diff --git a/Source/Core/VideoCommon/BPMemory.cpp b/Source/Core/VideoCommon/BPMemory.cpp
index 7272ed0..7902bf7 100644
--- a/Source/Core/VideoCommon/BPMemory.cpp
+++ b/Source/Core/VideoCommon/BPMemory.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "BPMemory.h"
+#include "Common/Common.h"
+#include "VideoCommon/BPMemory.h"
// BP state
// STATE_TO_SAVE
diff --git a/Source/Core/VideoCommon/BPMemory.h b/Source/Core/VideoCommon/BPMemory.h
index 72245d0..35f1e79 100644
--- a/Source/Core/VideoCommon/BPMemory.h
+++ b/Source/Core/VideoCommon/BPMemory.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
#pragma pack(4)
@@ -33,7 +33,7 @@
#define BPMEM_FIELDMASK 0x44
#define BPMEM_SETDRAWDONE 0x45
#define BPMEM_BUSCLOCK0 0x46
-#define BPMEM_PE_TOKEN_ID 0x47
+#define BPMEM_PE_TOKEN_ID 0x47
#define BPMEM_PE_TOKEN_INT_ID 0x48
#define BPMEM_EFB_TL 0x49
#define BPMEM_EFB_BR 0x4A
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 5482dae..c417e0d 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -4,20 +4,21 @@
#include <cmath>
-#include "VideoConfig.h"
-#include "Statistics.h"
-#include "RenderBase.h"
-#include "VideoCommon.h"
-#include "PixelShaderManager.h"
-#include "PixelEngine.h"
-#include "BPFunctions.h"
-#include "BPStructs.h"
-#include "TextureDecoder.h"
-#include "VertexLoader.h"
-#include "VertexShaderManager.h"
-#include "Thread.h"
-#include "HW/Memmap.h"
-#include "PerfQueryBase.h"
+#include "Common/Thread.h"
+#include "Core/HW/Memmap.h"
+
+#include "VideoCommon/BPFunctions.h"
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/PerfQueryBase.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
using namespace BPFunctions;
@@ -423,7 +424,8 @@ void BPWritten(const BPCmd& bp)
case BPMEM_CLEAR_PIXEL_PERF:
// GXClearPixMetric writes 0xAAA here, Sunshine alternates this register between values 0x000 and 0xAAA
- g_perf_query->ResetQuery();
+ if(PerfQueryBase::ShouldEmulate())
+ g_perf_query->ResetQuery();
break;
case BPMEM_PRELOAD_ADDR:
diff --git a/Source/Core/VideoCommon/BPStructs.h b/Source/Core/VideoCommon/BPStructs.h
index cf67ba2..2a99443 100644
--- a/Source/Core/VideoCommon/BPStructs.h
+++ b/Source/Core/VideoCommon/BPStructs.h
@@ -4,7 +4,7 @@
#pragma once
-#include "BPMemory.h"
+#include "VideoCommon/BPMemory.h"
void BPInit();
void LoadBPReg(u32 value0);
diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp
index fd8874d..f86e206 100644
--- a/Source/Core/VideoCommon/CPMemory.cpp
+++ b/Source/Core/VideoCommon/CPMemory.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "CPMemory.h"
+#include "Common/Common.h"
+#include "VideoCommon/CPMemory.h"
// CP state
u8 *cached_arraybases[16];
diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h
index 7a5af3c..4146caa 100644
--- a/Source/Core/VideoCommon/CPMemory.h
+++ b/Source/Core/VideoCommon/CPMemory.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// Vertex array numbers
enum
diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp
index b52be51..0ccd251 100644
--- a/Source/Core/VideoCommon/CommandProcessor.cpp
+++ b/Source/Core/VideoCommon/CommandProcessor.cpp
@@ -2,23 +2,24 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "VideoConfig.h"
-#include "MathUtil.h"
-#include "Thread.h"
-#include "Atomic.h"
-#include "Fifo.h"
-#include "ChunkFile.h"
-#include "CommandProcessor.h"
-#include "PixelEngine.h"
-#include "CoreTiming.h"
-#include "ConfigManager.h"
-#include "HW/ProcessorInterface.h"
-#include "HW/GPFifo.h"
-#include "HW/Memmap.h"
-#include "HW/SystemTimers.h"
-#include "Core.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "Common/Thread.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/GPFifo.h"
+#include "Core/HW/Memmap.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "Core/HW/SystemTimers.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
namespace CommandProcessor
{
@@ -30,13 +31,13 @@ int et_UpdateInterrupts;
// STATE_TO_SAVE
SCPFifoStruct fifo;
UCPStatusReg m_CPStatusReg;
-UCPCtrlReg m_CPCtrlReg;
-UCPClearReg m_CPClearReg;
+UCPCtrlReg m_CPCtrlReg;
+UCPClearReg m_CPClearReg;
-int m_bboxleft;
-int m_bboxtop;
-int m_bboxright;
-int m_bboxbottom;
+u16 m_bboxleft;
+u16 m_bboxtop;
+u16 m_bboxright;
+u16 m_bboxbottom;
u16 m_tokenReg;
static bool bProcessFifoToLoWatermark = false;
@@ -131,307 +132,168 @@ void Init()
et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper);
}
-void Read16(u16& _rReturnValue, const u32 _Address)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- INFO_LOG(COMMANDPROCESSOR, "(r): 0x%08x", _Address);
- switch (_Address & 0xFFF)
+ struct {
+ u32 addr;
+ u16* ptr;
+ bool readonly;
+ bool writes_align_to_32_bytes;
+ } directly_mapped_vars[] = {
+ { FIFO_TOKEN_REGISTER, &m_tokenReg },
+
+ // Bounding box registers are read only.
+ { FIFO_BOUNDING_BOX_LEFT, &m_bboxleft, true },
+ { FIFO_BOUNDING_BOX_RIGHT, &m_bboxright, true },
+ { FIFO_BOUNDING_BOX_TOP, &m_bboxtop, true },
+ { FIFO_BOUNDING_BOX_BOTTOM, &m_bboxbottom, true },
+
+ // Some FIFO addresses need to be aligned on 32 bytes on write - only
+ // the high part can be written directly without a mask.
+ { FIFO_BASE_LO, MMIO::Utils::LowPart(&fifo.CPBase), false, true },
+ { FIFO_BASE_HI, MMIO::Utils::HighPart(&fifo.CPBase) },
+ { FIFO_END_LO, MMIO::Utils::LowPart(&fifo.CPEnd), false, true },
+ { FIFO_END_HI, MMIO::Utils::HighPart(&fifo.CPEnd) },
+ { FIFO_HI_WATERMARK_LO, MMIO::Utils::LowPart(&fifo.CPHiWatermark) },
+ { FIFO_HI_WATERMARK_HI, MMIO::Utils::HighPart(&fifo.CPHiWatermark) },
+ { FIFO_LO_WATERMARK_LO, MMIO::Utils::LowPart(&fifo.CPLoWatermark) },
+ { FIFO_LO_WATERMARK_HI, MMIO::Utils::HighPart(&fifo.CPLoWatermark) },
+ // FIFO_RW_DISTANCE has some complex read code different for
+ // single/dual core.
+ { FIFO_WRITE_POINTER_LO, MMIO::Utils::LowPart(&fifo.CPWritePointer), false, true },
+ { FIFO_WRITE_POINTER_HI, MMIO::Utils::HighPart(&fifo.CPWritePointer) },
+ // FIFO_READ_POINTER has different code for single/dual core.
+ { FIFO_BP_LO, MMIO::Utils::LowPart(&fifo.CPBreakpoint), false, true },
+ { FIFO_BP_HI, MMIO::Utils::HighPart(&fifo.CPBreakpoint) },
+ };
+ for (auto& mapped_var : directly_mapped_vars)
{
- case STATUS_REGISTER:
- SetCpStatusRegister();
- _rReturnValue = m_CPStatusReg.Hex;
- return;
- case CTRL_REGISTER: _rReturnValue = m_CPCtrlReg.Hex; return;
- case CLEAR_REGISTER:
- _rReturnValue = m_CPClearReg.Hex;
- PanicAlert("CommandProcessor:: CPU reads from CLEAR_REGISTER!");
- ERROR_LOG(COMMANDPROCESSOR, "(r) clear: 0x%04x", _rReturnValue);
- return;
- case FIFO_TOKEN_REGISTER: _rReturnValue = m_tokenReg; return;
- case FIFO_BOUNDING_BOX_LEFT: _rReturnValue = m_bboxleft; return;
- case FIFO_BOUNDING_BOX_RIGHT: _rReturnValue = m_bboxright; return;
- case FIFO_BOUNDING_BOX_TOP: _rReturnValue = m_bboxtop; return;
- case FIFO_BOUNDING_BOX_BOTTOM: _rReturnValue = m_bboxbottom; return;
-
- case FIFO_BASE_LO: _rReturnValue = ReadLow (fifo.CPBase); return;
- case FIFO_BASE_HI: _rReturnValue = ReadHigh(fifo.CPBase); return;
- case FIFO_END_LO: _rReturnValue = ReadLow (fifo.CPEnd); return;
- case FIFO_END_HI: _rReturnValue = ReadHigh(fifo.CPEnd); return;
- case FIFO_HI_WATERMARK_LO: _rReturnValue = ReadLow (fifo.CPHiWatermark); return;
- case FIFO_HI_WATERMARK_HI: _rReturnValue = ReadHigh(fifo.CPHiWatermark); return;
- case FIFO_LO_WATERMARK_LO: _rReturnValue = ReadLow (fifo.CPLoWatermark); return;
- case FIFO_LO_WATERMARK_HI: _rReturnValue = ReadHigh(fifo.CPLoWatermark); return;
-
- case FIFO_RW_DISTANCE_LO:
- if (IsOnThread())
- {
- if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
- _rReturnValue = ReadLow (fifo.CPWritePointer - fifo.SafeCPReadPointer);
- else
- _rReturnValue = ReadLow (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
- }
- else
- {
- _rReturnValue = ReadLow (fifo.CPReadWriteDistance);
- }
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_LO : %04x", _rReturnValue);
- return;
- case FIFO_RW_DISTANCE_HI:
- if (IsOnThread())
- {
- if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
- _rReturnValue = ReadHigh (fifo.CPWritePointer - fifo.SafeCPReadPointer);
- else
- _rReturnValue = ReadHigh (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
- }
- else
- {
- _rReturnValue = ReadHigh(fifo.CPReadWriteDistance);
- }
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_HI : %04x", _rReturnValue);
- return;
- case FIFO_WRITE_POINTER_LO:
- _rReturnValue = ReadLow (fifo.CPWritePointer);
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_LO : %04x", _rReturnValue);
- return;
- case FIFO_WRITE_POINTER_HI:
- _rReturnValue = ReadHigh(fifo.CPWritePointer);
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_HI : %04x", _rReturnValue);
- return;
- case FIFO_READ_POINTER_LO:
- if (IsOnThread())
- _rReturnValue = ReadLow (fifo.SafeCPReadPointer);
- else
- _rReturnValue = ReadLow (fifo.CPReadPointer);
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_LO : %04x", _rReturnValue);
- return;
- case FIFO_READ_POINTER_HI:
- if (IsOnThread())
- _rReturnValue = ReadHigh (fifo.SafeCPReadPointer);
- else
- _rReturnValue = ReadHigh (fifo.CPReadPointer);
- DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_HI : %04x", _rReturnValue);
- return;
-
- case FIFO_BP_LO: _rReturnValue = ReadLow (fifo.CPBreakpoint); return;
- case FIFO_BP_HI: _rReturnValue = ReadHigh(fifo.CPBreakpoint); return;
-
- case XF_RASBUSY_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_RASBUSY_L: %04x", _rReturnValue);
- return;
- case XF_RASBUSY_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_RASBUSY_H: %04x", _rReturnValue);
- return;
-
- case XF_CLKS_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_CLKS_L: %04x", _rReturnValue);
- return;
- case XF_CLKS_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_CLKS_H: %04x", _rReturnValue);
- return;
-
- case XF_WAIT_IN_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_IN_L: %04x", _rReturnValue);
- return;
- case XF_WAIT_IN_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_IN_H: %04x", _rReturnValue);
- return;
-
- case XF_WAIT_OUT_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_OUT_L: %04x", _rReturnValue);
- return;
- case XF_WAIT_OUT_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_OUT_H: %04x", _rReturnValue);
- return;
-
- case VCACHE_METRIC_CHECK_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_CHECK_L: %04x", _rReturnValue);
- return;
- case VCACHE_METRIC_CHECK_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_CHECK_H: %04x", _rReturnValue);
- return;
-
- case VCACHE_METRIC_MISS_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_MISS_L: %04x", _rReturnValue);
- return;
- case VCACHE_METRIC_MISS_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_MISS_H: %04x", _rReturnValue);
- return;
-
- case VCACHE_METRIC_STALL_L:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_STALL_L: %04x", _rReturnValue);
- return;
- case VCACHE_METRIC_STALL_H:
- _rReturnValue = 0; // TODO: Figure out the true value
- DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_STALL_H: %04x", _rReturnValue);
- return;
-
- case CLKS_PER_VTX_OUT:
- _rReturnValue = 4; //Number of clocks per vertex.. TODO: Calculate properly
- DEBUG_LOG(COMMANDPROCESSOR, "Read from CLKS_PER_VTX_OUT: %04x", _rReturnValue);
- return;
- default:
- _rReturnValue = 0;
- WARN_LOG(COMMANDPROCESSOR, "(r16) unknown CP reg @ %08x", _Address);
- return;
+ u16 wmask = mapped_var.writes_align_to_32_bytes ? 0xFFE0 : 0xFFFF;
+ mmio->Register(base | mapped_var.addr,
+ MMIO::DirectRead<u16>(mapped_var.ptr),
+ mapped_var.readonly
+ ? MMIO::InvalidWrite<u16>()
+ : MMIO::DirectWrite<u16>(mapped_var.ptr, wmask)
+ );
}
- return;
-}
-
-void Write16(const u16 _Value, const u32 _Address)
-{
- INFO_LOG(COMMANDPROCESSOR, "(write16): 0x%04x @ 0x%08x",_Value,_Address);
-
- switch (_Address & 0xFFF)
+ // Timing and metrics MMIOs are stubbed with fixed values.
+ struct {
+ u32 addr;
+ u16 value;
+ } metrics_mmios[] = {
+ { XF_RASBUSY_L, 0 },
+ { XF_RASBUSY_H, 0 },
+ { XF_CLKS_L, 0 },
+ { XF_CLKS_H, 0 },
+ { XF_WAIT_IN_L, 0 },
+ { XF_WAIT_IN_H, 0 },
+ { XF_WAIT_OUT_L, 0 },
+ { XF_WAIT_OUT_H, 0 },
+ { VCACHE_METRIC_CHECK_L, 0 },
+ { VCACHE_METRIC_CHECK_H, 0 },
+ { VCACHE_METRIC_MISS_L, 0 },
+ { VCACHE_METRIC_MISS_H, 0 },
+ { VCACHE_METRIC_STALL_L, 0 },
+ { VCACHE_METRIC_STALL_H, 0 },
+ { CLKS_PER_VTX_OUT, 4 },
+ };
+ for (auto& metrics_mmio : metrics_mmios)
{
- case STATUS_REGISTER:
- {
- // This should be Read-Only
- ERROR_LOG(COMMANDPROCESSOR,"\t write to STATUS_REGISTER : %04x", _Value);
- PanicAlert("CommandProcessor:: CPU writes to STATUS_REGISTER!");
- }
- break;
+ mmio->Register(base | metrics_mmio.addr,
+ MMIO::Constant<u16>(metrics_mmio.value),
+ MMIO::InvalidWrite<u16>()
+ );
+ }
- case CTRL_REGISTER:
- {
- UCPCtrlReg tmpCtrl(_Value);
- m_CPCtrlReg.Hex = tmpCtrl.Hex;
- INFO_LOG(COMMANDPROCESSOR,"\t Write to CTRL_REGISTER : %04x", _Value);
+ mmio->Register(base | STATUS_REGISTER,
+ MMIO::ComplexRead<u16>([](u32) {
+ SetCpStatusRegister();
+ return m_CPStatusReg.Hex;
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+
+ mmio->Register(base | CTRL_REGISTER,
+ MMIO::DirectRead<u16>(&m_CPCtrlReg.Hex),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UCPCtrlReg tmp(val);
+ m_CPCtrlReg.Hex = tmp.Hex;
SetCpControlRegister();
- }
- break;
-
- case CLEAR_REGISTER:
- {
- UCPClearReg tmpCtrl(_Value);
- m_CPClearReg.Hex = tmpCtrl.Hex;
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to CLEAR_REGISTER : %04x", _Value);
+ if (!IsOnThread())
+ RunGpu();
+ })
+ );
+
+ mmio->Register(base | CLEAR_REGISTER,
+ MMIO::DirectRead<u16>(&m_CPClearReg.Hex),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UCPClearReg tmp(val);
+ m_CPClearReg.Hex = tmp.Hex;
SetCpClearRegister();
- }
- break;
-
- case PERF_SELECT:
- // Seems to select which set of perf registers should be exposed.
- DEBUG_LOG(COMMANDPROCESSOR, "Write to PERF_SELECT: %04x", _Value);
- break;
-
- // Fifo Registers
- case FIFO_TOKEN_REGISTER:
- m_tokenReg = _Value;
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_TOKEN_REGISTER : %04x", _Value);
- break;
- case FIFO_BASE_LO:
- WriteLow ((u32 &)fifo.CPBase, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_LO : %04x", _Value);
- break;
- case FIFO_BASE_HI:
- WriteHigh((u32 &)fifo.CPBase, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_HI : %04x", _Value);
- break;
-
- case FIFO_END_LO:
- WriteLow ((u32 &)fifo.CPEnd, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_LO : %04x", _Value);
- break;
- case FIFO_END_HI:
- WriteHigh((u32 &)fifo.CPEnd, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_HI : %04x", _Value);
- break;
-
- case FIFO_WRITE_POINTER_LO:
- WriteLow ((u32 &)fifo.CPWritePointer, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_LO : %04x", _Value);
- break;
- case FIFO_WRITE_POINTER_HI:
- WriteHigh((u32 &)fifo.CPWritePointer, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_HI : %04x", _Value);
- break;
-
- case FIFO_READ_POINTER_LO:
- WriteLow ((u32 &)fifo.CPReadPointer, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_LO : %04x", _Value);
- break;
- case FIFO_READ_POINTER_HI:
- WriteHigh((u32 &)fifo.CPReadPointer, _Value);
- fifo.SafeCPReadPointer = fifo.CPReadPointer;
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_HI : %04x", _Value);
- break;
-
- case FIFO_HI_WATERMARK_LO:
- WriteLow ((u32 &)fifo.CPHiWatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_LO : %04x", _Value);
- break;
- case FIFO_HI_WATERMARK_HI:
- WriteHigh((u32 &)fifo.CPHiWatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_HI : %04x", _Value);
- break;
-
- case FIFO_LO_WATERMARK_LO:
- WriteLow ((u32 &)fifo.CPLoWatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_LO : %04x", _Value);
- break;
- case FIFO_LO_WATERMARK_HI:
- WriteHigh((u32 &)fifo.CPLoWatermark, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_HI : %04x", _Value);
- break;
-
- case FIFO_BP_LO:
- WriteLow ((u32 &)fifo.CPBreakpoint, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_LO : %04x", _Value);
- break;
- case FIFO_BP_HI:
- WriteHigh((u32 &)fifo.CPBreakpoint, _Value);
- DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_HI : %04x", _Value);
- break;
-
- case FIFO_RW_DISTANCE_HI:
- WriteHigh((u32 &)fifo.CPReadWriteDistance, _Value);
- if (fifo.CPReadWriteDistance == 0)
- {
- GPFifo::ResetGatherPipe();
- ResetVideoBuffer();
- }
- else
- {
- ResetVideoBuffer();
- }
- DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_HI : %04x", _Value);
- break;
- case FIFO_RW_DISTANCE_LO:
- WriteLow((u32 &)fifo.CPReadWriteDistance, _Value & 0xFFE0);
- DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_LO : %04x", _Value);
- break;
-
- default:
- WARN_LOG(COMMANDPROCESSOR, "(w16) unknown CP reg write %04x @ %08x", _Value, _Address);
- }
-
- if (!IsOnThread())
- RunGpu();
-}
-
-void Read32(u32& _rReturnValue, const u32 _Address)
-{
- _rReturnValue = 0;
- _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Read32 from CommandProccessor at 0x%08x", _Address);
-}
-
-void Write32(const u32 _Data, const u32 _Address)
-{
- _dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProccessor at 0x%08x", _Address);
+ if (!IsOnThread())
+ RunGpu();
+ })
+ );
+
+ mmio->Register(base | PERF_SELECT,
+ MMIO::InvalidRead<u16>(),
+ MMIO::Nop<u16>()
+ );
+
+ // Some MMIOs have different handlers for single core vs. dual core mode.
+ mmio->Register(base | FIFO_RW_DISTANCE_LO,
+ IsOnThread()
+ ? MMIO::ComplexRead<u16>([](u32) {
+ if (fifo.CPWritePointer >= fifo.SafeCPReadPointer)
+ return ReadLow(fifo.CPWritePointer - fifo.SafeCPReadPointer);
+ else
+ return ReadLow(fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
+ })
+ : MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.CPReadWriteDistance)),
+ MMIO::DirectWrite<u16>(MMIO::Utils::LowPart(&fifo.CPReadWriteDistance), 0xFFE0)
+ );
+ mmio->Register(base | FIFO_RW_DISTANCE_HI,
+ IsOnThread()
+ ? MMIO::ComplexRead<u16>([](u32) {
+ if (fifo.CPWritePointer >= fifo.SafeCPReadPointer)
+ return ReadHigh(fifo.CPWritePointer - fifo.SafeCPReadPointer);
+ else
+ return ReadHigh(fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
+ })
+ : MMIO::DirectRead<u16>(MMIO::Utils::HighPart(&fifo.CPReadWriteDistance)),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ WriteHigh(fifo.CPReadWriteDistance, val);
+ if (fifo.CPReadWriteDistance == 0)
+ {
+ GPFifo::ResetGatherPipe();
+ ResetVideoBuffer();
+ }
+ else
+ {
+ ResetVideoBuffer();
+ }
+ if (!IsOnThread())
+ RunGpu();
+ })
+ );
+ mmio->Register(base | FIFO_READ_POINTER_LO,
+ IsOnThread()
+ ? MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.SafeCPReadPointer))
+ : MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.CPReadPointer)),
+ MMIO::DirectWrite<u16>(MMIO::Utils::LowPart(&fifo.CPReadPointer), 0xFFE0)
+ );
+ mmio->Register(base | FIFO_READ_POINTER_HI,
+ IsOnThread()
+ ? MMIO::DirectRead<u16>(MMIO::Utils::HighPart(&fifo.SafeCPReadPointer))
+ : MMIO::DirectRead<u16>(MMIO::Utils::HighPart(&fifo.CPReadPointer)),
+ IsOnThread()
+ ? MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ WriteHigh(fifo.CPReadPointer, val);
+ fifo.SafeCPReadPointer = fifo.CPReadPointer;
+ })
+ : MMIO::DirectWrite<u16>(MMIO::Utils::HighPart(&fifo.CPReadPointer))
+ );
}
void STACKALIGN GatherPipeBursted()
@@ -475,9 +337,9 @@ void STACKALIGN GatherPipeBursted()
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
// check if we are in sync
- _assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync");
- _assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync");
- _assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync");
+ _assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync");
+ _assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync");
+ _assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync");
}
void UpdateInterrupts(u64 userdata)
@@ -624,11 +486,11 @@ void SetCpStatusRegister()
INFO_LOG(COMMANDPROCESSOR,"\t Read from STATUS_REGISTER : %04x", m_CPStatusReg.Hex);
DEBUG_LOG(COMMANDPROCESSOR, "(r) status: iBP %s | fReadIdle %s | fCmdIdle %s | iOvF %s | iUndF %s"
- , m_CPStatusReg.Breakpoint ? "ON" : "OFF"
- , m_CPStatusReg.ReadIdle ? "ON" : "OFF"
- , m_CPStatusReg.CommandIdle ? "ON" : "OFF"
- , m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF"
- , m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF"
+ , m_CPStatusReg.Breakpoint ? "ON" : "OFF"
+ , m_CPStatusReg.ReadIdle ? "ON" : "OFF"
+ , m_CPStatusReg.CommandIdle ? "ON" : "OFF"
+ , m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF"
+ , m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF"
);
}
@@ -665,12 +527,12 @@ void SetCpControlRegister()
}
DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | BP %s | Int %s | OvF %s | UndF %s | LINK %s"
- , fifo.bFF_GPReadEnable ? "ON" : "OFF"
- , fifo.bFF_BPEnable ? "ON" : "OFF"
- , fifo.bFF_BPInt ? "ON" : "OFF"
- , m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF"
- , m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF"
- , m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF"
+ , fifo.bFF_GPReadEnable ? "ON" : "OFF"
+ , fifo.bFF_BPEnable ? "ON" : "OFF"
+ , fifo.bFF_BPInt ? "ON" : "OFF"
+ , m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF"
+ , m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF"
+ , m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF"
);
}
@@ -679,11 +541,11 @@ void SetCpControlRegister()
// We don't emulate proper GP timing anyway at the moment, so this code would just slow down emulation.
void SetCpClearRegister()
{
-// if (IsOnThread())
-// {
-// if (!m_CPClearReg.ClearFifoUnderflow && m_CPClearReg.ClearFifoOverflow)
-// bProcessFifoToLoWatermark = true;
-// }
+ // if (IsOnThread())
+ // {
+ // if (!m_CPClearReg.ClearFifoUnderflow && m_CPClearReg.ClearFifoOverflow)
+ // bProcessFifoToLoWatermark = true;
+ // }
}
void Update()
diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h
index b6bf7ea..09a5f45 100644
--- a/Source/Core/VideoCommon/CommandProcessor.h
+++ b/Source/Core/VideoCommon/CommandProcessor.h
@@ -4,10 +4,11 @@
#pragma once
-#include "Common.h"
-#include "VideoBackendBase.h"
+#include "Common/Common.h"
+#include "VideoCommon/VideoBackendBase.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
extern bool MT;
@@ -134,11 +135,7 @@ void Init();
void Shutdown();
void DoState(PointerWrap &p);
-// Read
-void Read16(u16& _rReturnValue, const u32 _Address);
-void Write16(const u16 _Data, const u32 _Address);
-void Read32(u32& _rReturnValue, const u32 _Address);
-void Write32(const u32 _Data, const u32 _Address);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void SetCpStatus(bool isCPUThread = false);
void GatherPipeBursted();
diff --git a/Source/Core/VideoCommon/DataReader.h b/Source/Core/VideoCommon/DataReader.h
index 2066334..dd963b1 100644
--- a/Source/Core/VideoCommon/DataReader.h
+++ b/Source/Core/VideoCommon/DataReader.h
@@ -4,7 +4,7 @@
#pragma once
-#include "VertexManagerBase.h"
+#include "VideoCommon/VertexManagerBase.h"
extern u8* g_pVideoData;
diff --git a/Source/Core/VideoCommon/Debugger.cpp b/Source/Core/VideoCommon/Debugger.cpp
index 321fed8..affeb91 100644
--- a/Source/Core/VideoCommon/Debugger.cpp
+++ b/Source/Core/VideoCommon/Debugger.cpp
@@ -2,15 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "IniFile.h"
-#include "Debugger.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
-#include "VideoConfig.h"
-#include "TextureCacheBase.h"
-#include "PixelShaderGen.h"
-#include "VertexShaderGen.h"
-#include "NativeVertexFormat.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VideoConfig.h"
//void UpdateFPSDisplay(const char *text);
extern NativeVertexFormat *g_nativeVertexFmt;
@@ -58,7 +58,7 @@ void GFXDebuggerCheckAndPause(bool update)
{
g_video_backend->UpdateFPSDisplay("Paused by Video Debugger");
- if (update) GFXDebuggerUpdateScreen();
+ if (update) GFXDebuggerUpdateScreen();
SLEEP(5);
}
g_pdebugger->OnContinue();
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index e25cd4e..1a0475f 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -4,8 +4,8 @@
#include <map>
-#include "LogManager.h"
-#include "DriverDetails.h"
+#include "Common/LogManager.h"
+#include "VideoCommon/DriverDetails.h"
namespace DriverDetails
{
@@ -32,10 +32,10 @@ namespace DriverDetails
const u32 m_os = OS_ALL | OS_LINUX;
#endif
- Vendor m_vendor = VENDOR_UNKNOWN;
- Driver m_driver = DRIVER_UNKNOWN;
- s32 m_family = 0;
- double m_version = 0.0;
+ Vendor m_vendor = VENDOR_UNKNOWN;
+ Driver m_driver = DRIVER_UNKNOWN;
+ s32 m_family = 0;
+ double m_version = 0.0;
// This is a list of all known bugs for each vendor
// We use this to check if the device and driver has a issue
@@ -74,21 +74,21 @@ namespace DriverDetails
case VENDOR_NVIDIA:
case VENDOR_TEGRA:
m_driver = DRIVER_NVIDIA;
- break;
+ break;
case VENDOR_ATI:
m_driver = DRIVER_ATI;
- break;
+ break;
case VENDOR_INTEL:
m_driver = DRIVER_INTEL;
- break;
+ break;
case VENDOR_IMGTEC:
m_driver = DRIVER_IMGTEC;
- break;
+ break;
case VENDOR_VIVANTE:
m_driver = DRIVER_VIVANTE;
- break;
+ break;
default:
- break;
+ break;
}
for(auto& bug : m_known_bugs)
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index b9707b3..c9bcb66 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
namespace DriverDetails
{
diff --git a/Source/Core/VideoCommon/EmuWindow.cpp b/Source/Core/VideoCommon/EmuWindow.cpp
index 23a7208..b5570a9 100644
--- a/Source/Core/VideoCommon/EmuWindow.cpp
+++ b/Source/Core/VideoCommon/EmuWindow.cpp
@@ -4,13 +4,14 @@
#include <windows.h>
-#include "VideoConfig.h"
-#include "EmuWindow.h"
-#include "Fifo.h"
-#include "VideoBackendBase.h"
-#include "Core.h"
-#include "Host.h"
-#include "ConfigManager.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+
+#include "VideoCommon/EmuWindow.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/VideoBackendBase.h"
+#include "VideoCommon/VideoConfig.h"
namespace EmuWindow
{
diff --git a/Source/Core/VideoCommon/FPSCounter.cpp b/Source/Core/VideoCommon/FPSCounter.cpp
index d9464af..cdf7c1d 100644
--- a/Source/Core/VideoCommon/FPSCounter.cpp
+++ b/Source/Core/VideoCommon/FPSCounter.cpp
@@ -2,10 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "FPSCounter.h"
-#include "FileUtil.h"
-#include "Timer.h"
-#include "VideoConfig.h"
+#include "Common/FileUtil.h"
+#include "Common/Timer.h"
+
+#include "VideoCommon/FPSCounter.h"
+#include "VideoCommon/VideoConfig.h"
#define FPS_REFRESH_INTERVAL 1000
diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp
index 92b9753..178a8c6 100644
--- a/Source/Core/VideoCommon/Fifo.cpp
+++ b/Source/Core/VideoCommon/Fifo.cpp
@@ -2,18 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoConfig.h"
-#include "MemoryUtil.h"
-#include "Thread.h"
-#include "Atomic.h"
-#include "OpcodeDecoding.h"
-#include "CommandProcessor.h"
-#include "PixelEngine.h"
-#include "ChunkFile.h"
-#include "Fifo.h"
-#include "HW/Memmap.h"
-#include "Core.h"
-#include "CoreTiming.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/MemoryUtil.h"
+#include "Common/Thread.h"
+
+#include "Core/Core.h"
+#include "Core/CoreTiming.h"
+#include "Core/HW/Memmap.h"
+
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/VideoConfig.h"
volatile bool g_bSkipCurrentFrame = false;
extern u8* g_pVideoData;
diff --git a/Source/Core/VideoCommon/Fifo.h b/Source/Core/VideoCommon/Fifo.h
index 83127f5..9045c56 100644
--- a/Source/Core/VideoCommon/Fifo.h
+++ b/Source/Core/VideoCommon/Fifo.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "VideoBackendBase.h"
+#include "Common/Common.h"
+#include "VideoCommon/VideoBackendBase.h"
class PointerWrap;
diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/FramebufferManagerBase.cpp
index a975da6..e5e8a85 100644
--- a/Source/Core/VideoCommon/FramebufferManagerBase.cpp
+++ b/Source/Core/VideoCommon/FramebufferManagerBase.cpp
@@ -1,8 +1,7 @@
-#include "FramebufferManagerBase.h"
-
-#include "RenderBase.h"
-#include "VideoConfig.h"
+#include "VideoCommon/FramebufferManagerBase.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VideoConfig.h"
FramebufferManagerBase *g_framebuffer_manager;
diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.h b/Source/Core/VideoCommon/FramebufferManagerBase.h
index be668ca..6f0b73f 100644
--- a/Source/Core/VideoCommon/FramebufferManagerBase.h
+++ b/Source/Core/VideoCommon/FramebufferManagerBase.h
@@ -2,7 +2,7 @@
#include <list>
-#include "VideoCommon.h"
+#include "VideoCommon/VideoCommon.h"
inline bool addrRangesOverlap(u32 aLower, u32 aUpper, u32 bLower, u32 bUpper)
{
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp
index c88e4ae..286e3e2 100644
--- a/Source/Core/VideoCommon/HiresTextures.cpp
+++ b/Source/Core/VideoCommon/HiresTextures.cpp
@@ -2,16 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "HiresTextures.h"
-
+#include <algorithm>
#include <cstring>
#include <utility>
-#include <algorithm>
#include <SOIL/SOIL.h>
-#include "CommonPaths.h"
-#include "FileUtil.h"
-#include "FileSearch.h"
-#include "StringUtil.h"
+
+#include "Common/CommonPaths.h"
+#include "Common/FileSearch.h"
+#include "Common/FileUtil.h"
+#include "Common/StringUtil.h"
+
+#include "VideoCommon/HiresTextures.h"
namespace HiresTextures
{
diff --git a/Source/Core/VideoCommon/HiresTextures.h b/Source/Core/VideoCommon/HiresTextures.h
index 18267e4..c51d0b8 100644
--- a/Source/Core/VideoCommon/HiresTextures.h
+++ b/Source/Core/VideoCommon/HiresTextures.h
@@ -5,8 +5,8 @@
#pragma once
#include <map>
-#include "VideoCommon.h"
-#include "TextureDecoder.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoCommon.h"
namespace HiresTextures
{
diff --git a/Source/Core/VideoCommon/ImageWrite.cpp b/Source/Core/VideoCommon/ImageWrite.cpp
index 193f058..ad0449d 100644
--- a/Source/Core/VideoCommon/ImageWrite.cpp
+++ b/Source/Core/VideoCommon/ImageWrite.cpp
@@ -6,8 +6,8 @@
#include <vector>
#include "png.h"
-#include "ImageWrite.h"
-#include "FileUtil.h"
+#include "Common/FileUtil.h"
+#include "VideoCommon/ImageWrite.h"
bool SaveData(const char* filename, const char* data)
{
diff --git a/Source/Core/VideoCommon/ImageWrite.h b/Source/Core/VideoCommon/ImageWrite.h
index 7022526..5df6306 100644
--- a/Source/Core/VideoCommon/ImageWrite.h
+++ b/Source/Core/VideoCommon/ImageWrite.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
bool SaveData(const char* filename, const char* pdata);
bool TextureToPng(u8* data, int row_stride, const std::string filename, int width, int height, bool saveAlpha = true);
diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp
index 0789ec1..809a2be 100644
--- a/Source/Core/VideoCommon/IndexGenerator.cpp
+++ b/Source/Core/VideoCommon/IndexGenerator.cpp
@@ -4,9 +4,9 @@
#include <cstddef>
-#include "Common.h"
-#include "VideoConfig.h"
-#include "IndexGenerator.h"
+#include "Common/Common.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/VideoConfig.h"
//Init
u16 *IndexGenerator::index_buffer_current;
diff --git a/Source/Core/VideoCommon/IndexGenerator.h b/Source/Core/VideoCommon/IndexGenerator.h
index 18f2b66..e5d09c8 100644
--- a/Source/Core/VideoCommon/IndexGenerator.h
+++ b/Source/Core/VideoCommon/IndexGenerator.h
@@ -7,7 +7,7 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class IndexGenerator
{
diff --git a/Source/Core/VideoCommon/LightingShaderGen.h b/Source/Core/VideoCommon/LightingShaderGen.h
index f74f92a..9379f65 100644
--- a/Source/Core/VideoCommon/LightingShaderGen.h
+++ b/Source/Core/VideoCommon/LightingShaderGen.h
@@ -4,9 +4,9 @@
#pragma once
-#include "ShaderGenCommon.h"
-#include "NativeVertexFormat.h"
-#include "XFMemory.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/ShaderGenCommon.h"
+#include "VideoCommon/XFMemory.h"
#define LIGHT_COL "%s[5*%d].%s"
diff --git a/Source/Core/VideoCommon/LookUpTables.h b/Source/Core/VideoCommon/LookUpTables.h
index 57414d2..eb38557 100644
--- a/Source/Core/VideoCommon/LookUpTables.h
+++ b/Source/Core/VideoCommon/LookUpTables.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
inline u8 Convert3To8(u8 v)
{
diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp
index 7d81e4a..8694fe2 100644
--- a/Source/Core/VideoCommon/MainBase.cpp
+++ b/Source/Core/VideoCommon/MainBase.cpp
@@ -1,19 +1,20 @@
-#include "MainBase.h"
-#include "VideoState.h"
-#include "VideoConfig.h"
-#include "RenderBase.h"
-#include "FramebufferManagerBase.h"
-#include "TextureCacheBase.h"
-#include "VertexLoaderManager.h"
-#include "CommandProcessor.h"
-#include "PixelEngine.h"
-#include "Atomic.h"
-#include "Fifo.h"
-#include "BPStructs.h"
-#include "OnScreenDisplay.h"
-#include "VideoBackendBase.h"
-#include "ConfigManager.h"
+#include "Common/Atomic.h"
+#include "Core/ConfigManager.h"
+
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/FramebufferManagerBase.h"
+#include "VideoCommon/MainBase.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VideoBackendBase.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/VideoState.h"
bool s_BackendInitialized = false;
@@ -72,7 +73,7 @@ void VideoFifo_CheckSwapRequest()
if (Common::AtomicLoadAcquire(s_swapRequested))
{
EFBRectangle rc;
- g_renderer->Swap(s_beginFieldArgs.xfbAddr, s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight,rc);
+ Renderer::Swap(s_beginFieldArgs.xfbAddr, s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight,rc);
Common::AtomicStoreRelease(s_swapRequested, false);
}
}
@@ -311,24 +312,12 @@ void VideoBackendHardware::Video_AbortFrame()
CommandProcessor::AbortFrame();
}
-readFn16 VideoBackendHardware::Video_CPRead16()
+void VideoBackendHardware::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
{
- return CommandProcessor::Read16;
-}
-writeFn16 VideoBackendHardware::Video_CPWrite16()
-{
- return CommandProcessor::Write16;
+ CommandProcessor::RegisterMMIO(mmio, base);
}
-readFn16 VideoBackendHardware::Video_PERead16()
-{
- return PixelEngine::Read16;
-}
-writeFn16 VideoBackendHardware::Video_PEWrite16()
-{
- return PixelEngine::Write16;
-}
-writeFn32 VideoBackendHardware::Video_PEWrite32()
+void VideoBackendHardware::RegisterPEMMIO(MMIO::Mapping* mmio, u32 base)
{
- return PixelEngine::Write32;
+ PixelEngine::RegisterMMIO(mmio, base);
}
diff --git a/Source/Core/VideoCommon/MainBase.h b/Source/Core/VideoCommon/MainBase.h
index a3a5ed0..3b4d574 100644
--- a/Source/Core/VideoCommon/MainBase.h
+++ b/Source/Core/VideoCommon/MainBase.h
@@ -1,6 +1,6 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
extern bool s_BackendInitialized;
extern u32 s_efbAccessRequested;
diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h
index c57e34b..8dd53c7 100644
--- a/Source/Core/VideoCommon/NativeVertexFormat.h
+++ b/Source/Core/VideoCommon/NativeVertexFormat.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// m_components
enum
diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp
index 9f14a90..7ea6d55 100644
--- a/Source/Core/VideoCommon/OnScreenDisplay.cpp
+++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp
@@ -3,16 +3,17 @@
// Refer to the license.txt file included.
#include <list>
+#include <map>
+#include <string>
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/Timer.h"
-#include "ConfigManager.h"
-#include "OnScreenDisplay.h"
-#include "RenderBase.h"
-#include "Timer.h"
+#include "Core/ConfigManager.h"
+
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/RenderBase.h"
-#include <map>
-#include <string>
namespace OSD
{
diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp
index 4211bd6..8c680a0 100644
--- a/Source/Core/VideoCommon/OpcodeDecoding.cpp
+++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp
@@ -3,7 +3,7 @@
// Refer to the license.txt file included.
//DL facts:
-// Ikaruga uses (nearly) NO display lists!
+// Ikaruga uses (nearly) NO display lists!
// Zelda WW uses TONS of display lists
// Zelda TP uses almost 100% display lists except menus (we like this!)
// Super Mario Galaxy has nearly all geometry and more than half of the state in DLs (great!)
@@ -12,28 +12,24 @@
// while interpreting them, and hope that the vertex format doesn't change, though, if you do it right
// when they are called. The reason is that the vertex format affects the sizes of the vertices.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "OpcodeDecoding.h"
-#include "CommandProcessor.h"
-#include "CPUDetect.h"
-#include "Core.h"
-#include "Host.h"
-#include "HW/Memmap.h"
-#include "FifoPlayer/FifoRecorder.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/FifoPlayer/FifoRecorder.h"
+#include "Core/HW/Memmap.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/DataReader.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/XFMemory.h"
-#include "VertexLoaderManager.h"
-
-#include "Statistics.h"
-
-#include "XFMemory.h"
-#include "CPMemory.h"
-#include "BPMemory.h"
-
-#include "Fifo.h"
-#include "DataReader.h"
-
-#include "VideoConfig.h"
u8* g_pVideoData = 0;
bool g_bRecordFifoData = false;
diff --git a/Source/Core/VideoCommon/PerfQueryBase.cpp b/Source/Core/VideoCommon/PerfQueryBase.cpp
index af8bfa7..cf59b31 100644
--- a/Source/Core/VideoCommon/PerfQueryBase.cpp
+++ b/Source/Core/VideoCommon/PerfQueryBase.cpp
@@ -1,9 +1,9 @@
-#include "PerfQueryBase.h"
-#include "VideoConfig.h"
+#include "VideoCommon/PerfQueryBase.h"
+#include "VideoCommon/VideoConfig.h"
PerfQueryBase* g_perf_query = 0;
-bool PerfQueryBase::ShouldEmulate() const
+bool PerfQueryBase::ShouldEmulate()
{
return g_ActiveConfig.bPerfQueriesEnable;
}
diff --git a/Source/Core/VideoCommon/PerfQueryBase.h b/Source/Core/VideoCommon/PerfQueryBase.h
index 64a22c2..7b68b84 100644
--- a/Source/Core/VideoCommon/PerfQueryBase.h
+++ b/Source/Core/VideoCommon/PerfQueryBase.h
@@ -1,6 +1,6 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
enum PerfQueryType
{
@@ -29,7 +29,7 @@ public:
// Checks if performance queries are enabled in the gameini configuration.
// NOTE: Called from CPU+GPU thread
- bool ShouldEmulate() const;
+ static bool ShouldEmulate();
// Begin querying the specified value for the following host GPU commands
virtual void EnableQuery(PerfQueryGroup type) {}
diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp
index b075a29..4d913dd 100644
--- a/Source/Core/VideoCommon/PixelEngine.cpp
+++ b/Source/Core/VideoCommon/PixelEngine.cpp
@@ -6,18 +6,18 @@
// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!!
-#include "Common.h"
-#include "VideoCommon.h"
-#include "ChunkFile.h"
-#include "Atomic.h"
-#include "CoreTiming.h"
-#include "ConfigManager.h"
-
-#include "PixelEngine.h"
-#include "RenderBase.h"
-#include "CommandProcessor.h"
-#include "HW/ProcessorInterface.h"
-#include "State.h"
+#include "Common/Atomic.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
+#include "Core/ConfigManager.h"
+#include "Core/CoreTiming.h"
+#include "Core/State.h"
+#include "Core/HW/MMIO.h"
+#include "Core/HW/ProcessorInterface.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VideoCommon.h"
namespace PixelEngine
{
@@ -164,175 +164,92 @@ void Init()
bbox_active = false;
}
-void Read16(u16& _uReturnValue, const u32 _iAddress)
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{
- DEBUG_LOG(PIXELENGINE, "(r16) 0x%08x", _iAddress);
- switch (_iAddress & 0xFFF)
+ // Directly mapped registers.
+ struct {
+ u32 addr;
+ u16* ptr;
+ } directly_mapped_vars[] = {
+ { PE_ZCONF, &m_ZConf.Hex },
+ { PE_ALPHACONF, &m_AlphaConf.Hex },
+ { PE_DSTALPHACONF, &m_DstAlphaConf.Hex },
+ { PE_ALPHAMODE, &m_AlphaModeConf.Hex },
+ { PE_ALPHAREAD, &m_AlphaRead.Hex },
+ };
+ for (auto& mapped_var : directly_mapped_vars)
{
- // CPU Direct Access EFB Raster State Config
- case PE_ZCONF:
- _uReturnValue = m_ZConf.Hex;
- INFO_LOG(PIXELENGINE, "(r16) ZCONF");
- break;
- case PE_ALPHACONF:
- // Most games read this early. no idea why.
- _uReturnValue = m_AlphaConf.Hex;
- INFO_LOG(PIXELENGINE, "(r16) ALPHACONF");
- break;
- case PE_DSTALPHACONF:
- _uReturnValue = m_DstAlphaConf.Hex;
- INFO_LOG(PIXELENGINE, "(r16) DSTALPHACONF");
- break;
- case PE_ALPHAMODE:
- _uReturnValue = m_AlphaModeConf.Hex;
- INFO_LOG(PIXELENGINE, "(r16) ALPHAMODE");
- break;
- case PE_ALPHAREAD:
- _uReturnValue = m_AlphaRead.Hex;
- WARN_LOG(PIXELENGINE, "(r16) ALPHAREAD");
- break;
-
- case PE_CTRL_REGISTER:
- _uReturnValue = m_Control.Hex;
- INFO_LOG(PIXELENGINE, "(r16) CTRL_REGISTER : %04x", _uReturnValue);
- break;
-
- case PE_TOKEN_REG:
- _uReturnValue = Common::AtomicLoad(*(volatile u32*)&CommandProcessor::fifo.PEToken);
- INFO_LOG(PIXELENGINE, "(r16) TOKEN_REG : %04x", _uReturnValue);
- break;
-
- // BBox
- case PE_BBOX_LEFT:
- case PE_BBOX_RIGHT:
- case PE_BBOX_TOP:
- case PE_BBOX_BOTTOM:
- _uReturnValue = bbox[(_iAddress >> 1) & 3];
- bbox_active = false;
- break;
-
- // NOTE(neobrain): only PE_PERF_ZCOMP_OUTPUT is implemented in D3D11, but the other values shouldn't be contradictionary to the value of that register (i.e. INPUT registers should always be greater or equal to their corresponding OUTPUT registers).
- case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) & 0xFFFF;
- break;
-
- case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) >> 16;
- break;
-
- case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) & 0xFFFF;
- break;
-
- case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) >> 16;
- break;
-
- case PE_PERF_ZCOMP_INPUT_L:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) & 0xFFFF;
- break;
-
- case PE_PERF_ZCOMP_INPUT_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) >> 16;
- break;
-
- case PE_PERF_ZCOMP_OUTPUT_L:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) & 0xFFFF;
- break;
-
- case PE_PERF_ZCOMP_OUTPUT_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) >> 16;
- break;
-
- case PE_PERF_BLEND_INPUT_L:
- // Super Mario Sunshine uses this register in episode 6 of Sirena Beach:
- // The amount of remaining goop is determined by checking how many pixels reach the blending stage.
- // Once this register falls below a particular value (around 0x90), the game regards the challenge finished.
- // In very old builds, Dolphin only returned 0. That caused the challenge to be immediately finished without any goop being cleaned (the timer just didn't even start counting from 3:00:00).
- // Later builds returned 1 for the high register. That caused the timer to actually count down, but made the challenge unbeatable because the game always thought you didn't clear any goop at all.
- // Note that currently this functionality is only implemented in the D3D11 backend.
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) & 0xFFFF;
- break;
-
- case PE_PERF_BLEND_INPUT_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) >> 16;
- break;
-
- case PE_PERF_EFB_COPY_CLOCKS_L:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) & 0xFFFF;
- break;
-
- case PE_PERF_EFB_COPY_CLOCKS_H:
- _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) >> 16;
- break;
-
- default:
- INFO_LOG(PIXELENGINE, "(r16) unknown @ %08x", _iAddress);
- _uReturnValue = 1;
- break;
+ mmio->Register(base | mapped_var.addr,
+ MMIO::DirectRead<u16>(mapped_var.ptr),
+ MMIO::DirectWrite<u16>(mapped_var.ptr)
+ );
}
-}
-
-void Write16(const u16 _iValue, const u32 _iAddress)
-{
- switch (_iAddress & 0xFFF)
+ // Performance queries registers: read only, need to call the video backend
+ // to get the results.
+ struct {
+ u32 addr;
+ PerfQueryType pqtype;
+ } pq_regs[] = {
+ { PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L, PQ_ZCOMP_INPUT_ZCOMPLOC },
+ { PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L, PQ_ZCOMP_OUTPUT_ZCOMPLOC },
+ { PE_PERF_ZCOMP_INPUT_L, PQ_ZCOMP_INPUT },
+ { PE_PERF_ZCOMP_OUTPUT_L, PQ_ZCOMP_OUTPUT },
+ { PE_PERF_BLEND_INPUT_L, PQ_BLEND_INPUT },
+ { PE_PERF_EFB_COPY_CLOCKS_L, PQ_EFB_COPY_CLOCKS },
+ };
+ for (auto& pq_reg : pq_regs)
{
- // CPU Direct Access EFB Raster State Config
- case PE_ZCONF:
- m_ZConf.Hex = _iValue;
- INFO_LOG(PIXELENGINE, "(w16) ZCONF: %02x", _iValue);
- break;
- case PE_ALPHACONF:
- m_AlphaConf.Hex = _iValue;
- INFO_LOG(PIXELENGINE, "(w16) ALPHACONF: %02x", _iValue);
- break;
- case PE_DSTALPHACONF:
- m_DstAlphaConf.Hex = _iValue;
- INFO_LOG(PIXELENGINE, "(w16) DSTALPHACONF: %02x", _iValue);
- break;
- case PE_ALPHAMODE:
- m_AlphaModeConf.Hex = _iValue;
- INFO_LOG(PIXELENGINE, "(w16) ALPHAMODE: %02x", _iValue);
- break;
- case PE_ALPHAREAD:
- m_AlphaRead.Hex = _iValue;
- INFO_LOG(PIXELENGINE, "(w16) ALPHAREAD: %02x", _iValue);
- break;
-
- case PE_CTRL_REGISTER:
- {
- UPECtrlReg tmpCtrl(_iValue);
-
- if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0;
- if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0;
+ mmio->Register(base | pq_reg.addr,
+ MMIO::ComplexRead<u16>([pq_reg](u32) {
+ return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) & 0xFFFF;
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+ mmio->Register(base | (pq_reg.addr + 2),
+ MMIO::ComplexRead<u16>([pq_reg](u32) {
+ return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) >> 16;
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+ }
+
+ // Control register
+ mmio->Register(base | PE_CTRL_REGISTER,
+ MMIO::DirectRead<u16>(&m_Control.Hex),
+ MMIO::ComplexWrite<u16>([](u32, u16 val) {
+ UPECtrlReg tmpCtrl(val);
+
+ if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0;
+ if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0;
m_Control.PETokenEnable = tmpCtrl.PETokenEnable;
m_Control.PEFinishEnable = tmpCtrl.PEFinishEnable;
- m_Control.PEToken = 0; // this flag is write only
- m_Control.PEFinish = 0; // this flag is write only
+ m_Control.PEToken = 0; // this flag is write only
+ m_Control.PEFinish = 0; // this flag is write only
- DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", _iValue);
+ DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", val);
UpdateInterrupts();
- }
- break;
-
- case PE_TOKEN_REG:
- PanicAlert("(w16) WTF? PowerPC program wrote token: %i", _iValue);
- //only the gx pipeline is supposed to be able to write here
- //g_token = _iValue;
- break;
-
- default:
- WARN_LOG(PIXELENGINE, "(w16) unknown %04x @ %08x", _iValue, _iAddress);
- break;
- }
+ })
+ );
-}
+ // Token register, readonly.
+ mmio->Register(base | PE_TOKEN_REG,
+ MMIO::DirectRead<u16>(&CommandProcessor::fifo.PEToken),
+ MMIO::InvalidWrite<u16>()
+ );
-void Write32(const u32 _iValue, const u32 _iAddress)
-{
- WARN_LOG(PIXELENGINE, "(w32) 0x%08x @ 0x%08x IGNORING...",_iValue,_iAddress);
+ // BBOX registers, readonly and need to update a flag.
+ for (int i = 0; i < 4; ++i)
+ {
+ mmio->Register(base | (PE_BBOX_LEFT + 2 * i),
+ MMIO::ComplexRead<u16>([i](u32) {
+ bbox_active = false;
+ return bbox[i];
+ }),
+ MMIO::InvalidWrite<u16>()
+ );
+ }
}
bool AllowIdleSkipping()
@@ -362,8 +279,8 @@ void UpdateFinishInterrupt(bool active)
}
// TODO(mb2): Refactor SetTokenINT_OnMainThread(u64 userdata, int cyclesLate).
-// Think about the right order between tokenVal and tokenINT... one day maybe.
-// Cleanup++
+// Think about the right order between tokenVal and tokenINT... one day maybe.
+// Cleanup++
// Called only if BPMEM_PE_TOKEN_INT_ID is ack by GP
void SetToken_OnMainThread(u64 userdata, int cyclesLate)
@@ -441,4 +358,10 @@ void ResetSetToken()
}
CommandProcessor::interruptTokenWaiting = false;
}
+
+UPEAlphaReadReg GetAlphaReadMode()
+{
+ return m_AlphaRead;
+}
+
} // end of namespace PixelEngine
diff --git a/Source/Core/VideoCommon/PixelEngine.h b/Source/Core/VideoCommon/PixelEngine.h
index 1486639..d021859 100644
--- a/Source/Core/VideoCommon/PixelEngine.h
+++ b/Source/Core/VideoCommon/PixelEngine.h
@@ -4,8 +4,9 @@
#pragma once
-#include "CommonTypes.h"
+#include "Common/CommonTypes.h"
class PointerWrap;
+namespace MMIO { class Mapping; }
// internal hardware addresses
enum
@@ -47,26 +48,22 @@ union UPEAlphaReadReg
u16 Hex;
struct
{
- u16 ReadMode : 2;
- u16 : 14;
+ u16 ReadMode : 2;
+ u16 : 14;
};
};
void Init();
void DoState(PointerWrap &p);
-// Read
-void Read16(u16& _uReturnValue, const u32 _iAddress);
-
-// Write
-void Write16(const u16 _iValue, const u32 _iAddress);
-void Write32(const u32 _iValue, const u32 _iAddress);
+void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// gfx backend support
void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
void SetFinish(void);
void ResetSetFinish(void);
void ResetSetToken(void);
+UPEAlphaReadReg GetAlphaReadMode();
// Bounding box functionality. Paper Mario (both) are a couple of the few games that use it.
extern u16 bbox[4];
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index eb9d79e..6696513 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -2,20 +2,20 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <stdio.h>
+#include <cassert>
#include <cmath>
-#include <assert.h>
+#include <cstdio>
#include <locale.h>
#ifdef __APPLE__
#include <xlocale.h>
#endif
-#include "LightingShaderGen.h"
-#include "PixelShaderGen.h"
-#include "XFMemory.h" // for texture projection mode
-#include "BPMemory.h"
-#include "VideoConfig.h"
-#include "NativeVertexFormat.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/LightingShaderGen.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/XFMemory.h" // for texture projection mode
// old tev->pixelshader notes
@@ -1046,14 +1046,14 @@ void SampleTexture(T& out, const char *texcoords, const char *texswap, int texma
static const char *tevAlphaFuncsTable[] =
{
- "(false)", // NEVER
- "(prev.a <= %s - (0.25/255.0))", // LESS
- "(abs( prev.a - %s ) < (0.5/255.0))", // EQUAL
- "(prev.a < %s + (0.25/255.0))", // LEQUAL
- "(prev.a >= %s + (0.25/255.0))", // GREATER
- "(abs( prev.a - %s ) >= (0.5/255.0))", // NEQUAL
- "(prev.a > %s - (0.25/255.0))", // GEQUAL
- "(true)" // ALWAYS
+ "(false)", // NEVER
+ "(prev.a <= %s - (0.25/255.0))", // LESS
+ "(abs( prev.a - %s ) < (0.5/255.0))", // EQUAL
+ "(prev.a < %s + (0.25/255.0))", // LEQUAL
+ "(prev.a >= %s + (0.25/255.0))", // GREATER
+ "(abs( prev.a - %s ) >= (0.5/255.0))", // NEQUAL
+ "(prev.a > %s - (0.25/255.0))", // GEQUAL
+ "(true)" // ALWAYS
};
static const char *tevAlphaFunclogicTable[] =
@@ -1124,14 +1124,14 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_T
static const char *tevFogFuncsTable[] =
{
- "", // No Fog
- "", // ?
- "", // Linear
- "", // ?
- "\tfog = 1.0 - exp2(-8.0 * fog);\n", // exp
- "\tfog = 1.0 - exp2(-8.0 * fog * fog);\n", // exp2
- "\tfog = exp2(-8.0 * (1.0 - fog));\n", // backward exp
- "\tfog = 1.0 - fog;\n fog = exp2(-8.0 * fog * fog);\n" // backward exp2
+ "", // No Fog
+ "", // ?
+ "", // Linear
+ "", // ?
+ "\tfog = 1.0 - exp2(-8.0 * fog);\n", // exp
+ "\tfog = 1.0 - exp2(-8.0 * fog * fog);\n", // exp2
+ "\tfog = exp2(-8.0 * (1.0 - fog));\n", // backward exp
+ "\tfog = 1.0 - fog;\n fog = exp2(-8.0 * fog * fog);\n" // backward exp2
};
template<class T>
@@ -1153,7 +1153,7 @@ static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data)
else
{
// orthographic
- // ze = a*Zs (here, no B_SHF)
+ // ze = a*Zs (here, no B_SHF)
out.Write("\tfloat ze = " I_FOG"[1].x * zCoord;\n");
}
diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h
index e1feb06..6ed6960 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.h
+++ b/Source/Core/VideoCommon/PixelShaderGen.h
@@ -4,10 +4,10 @@
#pragma once
-#include "VideoCommon.h"
-#include "ShaderGenCommon.h"
-#include "BPMemory.h"
-#include "LightingShaderGen.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/LightingShaderGen.h"
+#include "VideoCommon/ShaderGenCommon.h"
+#include "VideoCommon/VideoCommon.h"
#define I_COLORS "color"
#define I_KCOLORS "k"
@@ -21,18 +21,18 @@
#define I_PMATERIALS "cPmtrl"
// TODO: get rid of them as they aren't used
-#define C_COLORMATRIX 0 // 0
-#define C_COLORS 0 // 0
-#define C_KCOLORS (C_COLORS + 4) // 4
-#define C_ALPHA (C_KCOLORS + 4) // 8
-#define C_TEXDIMS (C_ALPHA + 1) // 9
-#define C_ZBIAS (C_TEXDIMS + 8) //17
-#define C_INDTEXSCALE (C_ZBIAS + 2) //19
-#define C_INDTEXMTX (C_INDTEXSCALE + 2) //21
-#define C_FOG (C_INDTEXMTX + 6) //27
-
-#define C_PLIGHTS (C_FOG + 3)
-#define C_PMATERIALS (C_PLIGHTS + 40)
+#define C_COLORMATRIX 0 // 0
+#define C_COLORS 0 // 0
+#define C_KCOLORS (C_COLORS + 4) // 4
+#define C_ALPHA (C_KCOLORS + 4) // 8
+#define C_TEXDIMS (C_ALPHA + 1) // 9
+#define C_ZBIAS (C_TEXDIMS + 8) //17
+#define C_INDTEXSCALE (C_ZBIAS + 2) //19
+#define C_INDTEXMTX (C_INDTEXSCALE + 2) //21
+#define C_FOG (C_INDTEXMTX + 6) //27
+
+#define C_PLIGHTS (C_FOG + 3)
+#define C_PMATERIALS (C_PLIGHTS + 40)
#define C_PENVCONST_END (C_PMATERIALS + 4)
// Different ways to achieve rendering with destination alpha
diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp
index 0c35bb4..74cc5c1 100644
--- a/Source/Core/VideoCommon/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/PixelShaderManager.cpp
@@ -4,13 +4,14 @@
#include <cmath>
-#include "Common.h"
-#include "Statistics.h"
-#include "PixelShaderManager.h"
-#include "VideoCommon.h"
-#include "VideoConfig.h"
+#include "Common/Common.h"
+
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
-#include "RenderBase.h"
static bool s_bFogRangeAdjustChanged;
static bool s_bViewPortChanged;
static int nLightsChanged[2]; // min,max
diff --git a/Source/Core/VideoCommon/PixelShaderManager.h b/Source/Core/VideoCommon/PixelShaderManager.h
index c5be112..bd0c904 100644
--- a/Source/Core/VideoCommon/PixelShaderManager.h
+++ b/Source/Core/VideoCommon/PixelShaderManager.h
@@ -4,10 +4,10 @@
#pragma once
-#include "BPMemory.h"
-#include "XFMemory.h"
-#include "PixelShaderGen.h"
-#include "ConstantManager.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/ConstantManager.h"
+#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/XFMemory.h"
class PointerWrap;
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 7f046e5..e275238 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -12,28 +12,32 @@
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
// ---------------------------------------------------------------------------------------------
-
-#include "RenderBase.h"
-#include "Atomic.h"
-#include "BPMemory.h"
-#include "CommandProcessor.h"
-#include "CPMemory.h"
-#include "MainBase.h"
-#include "VideoConfig.h"
-#include "FramebufferManagerBase.h"
-#include "TextureCacheBase.h"
-#include "Fifo.h"
-#include "OpcodeDecoding.h"
-#include "Timer.h"
-#include "StringUtil.h"
-#include "Host.h"
-#include "XFMemory.h"
-#include "FifoPlayer/FifoRecorder.h"
-#include "AVIDump.h"
-
#include <cmath>
#include <string>
+#include "Common/Atomic.h"
+#include "Common/StringUtil.h"
+#include "Common/Timer.h"
+
+#include "Core/Core.h"
+#include "Core/Host.h"
+#include "Core/FifoPlayer/FifoRecorder.h"
+
+#include "VideoCommon/AVIDump.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/FramebufferManagerBase.h"
+#include "VideoCommon/MainBase.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/XFMemory.h"
+
// TODO: Move these out of here.
int frameCount;
int OSDChoice, OSDTime;
@@ -117,7 +121,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
}
else
{
- g_renderer->Swap(xfbAddr, fbWidth, fbHeight,sourceRc,Gamma);
+ Swap(xfbAddr, fbWidth, fbHeight,sourceRc,Gamma);
Common::AtomicStoreRelease(s_swapRequested, false);
}
}
@@ -438,7 +442,7 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
// -----------------------------------------------------------------------
// Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10.
- // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset
+ // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset
// ------------------
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop)
{
@@ -509,8 +513,19 @@ void Renderer::RecordVideoMemory()
FifoRecorder::GetInstance().SetVideoMemory(bpMem, cpMem, xfMem, xfRegs, sizeof(XFRegisters) / 4);
}
-void UpdateViewport()
+void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc, float Gamma)
{
- if (xfregs.viewport.wd != 0 && xfregs.viewport.ht != 0)
- g_renderer->UpdateViewport();
+ // TODO: merge more generic parts into VideoCommon
+ g_renderer->SwapImpl(xfbAddr, fbWidth, fbHeight, rc, Gamma);
+
+ frameCount++;
+ GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
+
+ // Begin new frame
+ // Set default viewport and scissor, for the clear to work correctly
+ // New frame
+ stats.ResetFrame();
+
+ Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
+ XFBWrited = false;
}
diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h
index 81ca9f7..96bf431 100644
--- a/Source/Core/VideoCommon/RenderBase.h
+++ b/Source/Core/VideoCommon/RenderBase.h
@@ -14,15 +14,15 @@
#pragma once
-#include "VideoCommon.h"
-#include "Thread.h"
-#include "MathUtil.h"
-#include "NativeVertexFormat.h"
-#include "FramebufferManagerBase.h"
-#include "BPMemory.h"
-
#include <string>
+#include "Common/MathUtil.h"
+#include "Common/Thread.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/FramebufferManagerBase.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/VideoCommon.h"
+
// TODO: Move these out of here.
extern int frameCount;
extern int OSDChoice;
@@ -49,7 +49,7 @@ public:
virtual void SetColorMask() = 0;
virtual void SetBlendMode(bool forceUpdate) = 0;
- virtual void SetScissorRect(const TargetRectangle& rc) = 0;
+ virtual void SetScissorRect(const EFBRectangle& rc) = 0;
virtual void SetGenerationMode() = 0;
virtual void SetDepthMode() = 0;
virtual void SetLogicOpMode() = 0;
@@ -57,6 +57,7 @@ public:
virtual void SetLineWidth() = 0;
virtual void SetSamplerState(int stage,int texindex) = 0;
virtual void SetInterlacingMode() = 0;
+ virtual void SetViewport() = 0;
virtual void ApplyState(bool bUseDstAlpha) = 0;
virtual void RestoreState() = 0;
@@ -105,9 +106,8 @@ public:
virtual void RestoreAPIState() = 0;
// Finish up the current frame, print some stats
- virtual void Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma = 1.0f) = 0;
-
- virtual void UpdateViewport() = 0;
+ static void Swap(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma = 1.0f);
+ virtual void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma = 1.0f) = 0;
virtual bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) = 0;
@@ -160,4 +160,3 @@ private:
extern Renderer *g_renderer;
-void UpdateViewport();
diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h
index 9d2e8e1..64d30a0 100644
--- a/Source/Core/VideoCommon/ShaderGenCommon.h
+++ b/Source/Core/VideoCommon/ShaderGenCommon.h
@@ -4,14 +4,14 @@
#pragma once
-#include <stdio.h>
-#include <stdarg.h>
+#include <algorithm>
+#include <cstdarg>
+#include <cstdio>
#include <string>
#include <vector>
-#include <algorithm>
-#include "CommonTypes.h"
-#include "VideoCommon.h"
+#include "Common/CommonTypes.h"
+#include "VideoCommon/VideoCommon.h"
/**
* Common interface for classes that need to go through the shader generation path (GenerateVertexShader, GeneratePixelShader)
@@ -144,7 +144,7 @@ public:
{
// TODO: Not ready for usage yet
return true;
-// return constant_usage[index];
+ //return constant_usage[index];
}
private:
std::vector<bool> constant_usage; // TODO: Is vector<bool> appropriate here?
diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp
index 8121920..d1d6312 100644
--- a/Source/Core/VideoCommon/Statistics.cpp
+++ b/Source/Core/VideoCommon/Statistics.cpp
@@ -5,8 +5,8 @@
#include <string.h>
#include <utility>
-#include "Statistics.h"
-#include "VertexLoaderManager.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoaderManager.h"
Statistics stats;
diff --git a/Source/Core/VideoCommon/Statistics.h b/Source/Core/VideoCommon/Statistics.h
index daa8700..989549e 100644
--- a/Source/Core/VideoCommon/Statistics.h
+++ b/Source/Core/VideoCommon/Statistics.h
@@ -2,10 +2,11 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "CommonTypes.h"
-#include "VideoCommon.h"
#include <vector>
+#include "Common/CommonTypes.h"
+#include "VideoCommon/VideoCommon.h"
+
#pragma once
struct Statistics
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 6903f77..5abce6f 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -2,18 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "MemoryUtil.h"
+#include "Common/FileUtil.h"
+#include "Common/MemoryUtil.h"
-#include "VideoConfig.h"
-#include "Statistics.h"
-#include "HiresTextures.h"
-#include "RenderBase.h"
-#include "FileUtil.h"
+#include "Core/ConfigManager.h"
+#include "Core/HW/Memmap.h"
-#include "TextureCacheBase.h"
-#include "Debugger.h"
-#include "ConfigManager.h"
-#include "HW/Memmap.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/HiresTextures.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VideoConfig.h"
// ugly
extern int frameCount;
@@ -130,7 +130,7 @@ void TextureCache::Cleanup()
TexCache::iterator tcend = textures.end();
while (iter != tcend)
{
- if ( frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount
+ if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount
// EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted
&& ! iter->second->IsEfbCopy() )
@@ -378,12 +378,12 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
tlut_hash = GetHash64(&texMem[tlutaddr], palette_size, g_ActiveConfig.iSafeTextureCache_ColorSamples);
// NOTE: For non-paletted textures, texID is equal to the texture address.
- // A paletted texture, however, may have multiple texIDs assigned though depending on the currently used tlut.
- // This (changing texID depending on the tlut_hash) is a trick to get around
- // an issue with Metroid Prime's fonts (it has multiple sets of fonts on each other
- // stored in a single texture and uses the palette to make different characters
- // visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
- // we must make sure that a paletted texture gets assigned multiple IDs for each tlut used.
+ // A paletted texture, however, may have multiple texIDs assigned though depending on the currently used tlut.
+ // This (changing texID depending on the tlut_hash) is a trick to get around
+ // an issue with Metroid Prime's fonts (it has multiple sets of fonts on each other
+ // stored in a single texture and uses the palette to make different characters
+ // visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
+ // we must make sure that a paletted texture gets assigned multiple IDs for each tlut used.
//
// TODO: Because texID isn't always the same as the address now, CopyRenderTargetToTexture might be broken now
texID ^= ((u32)tlut_hash) ^(u32)(tlut_hash >> 32);
@@ -579,40 +579,40 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
// Emulation methods:
//
// - EFB to RAM:
- // Encodes the requested EFB data at its native resolution to the emulated RAM using shaders.
- // Load() decodes the data from there again (using TextureDecoder) if the EFB copy is being used as a texture again.
- // Advantage: CPU can read data from the EFB copy and we don't lose any important updates to the texture
- // Disadvantage: Encoding+decoding steps often are redundant because only some games read or modify EFB copies before using them as textures.
+ // Encodes the requested EFB data at its native resolution to the emulated RAM using shaders.
+ // Load() decodes the data from there again (using TextureDecoder) if the EFB copy is being used as a texture again.
+ // Advantage: CPU can read data from the EFB copy and we don't lose any important updates to the texture
+ // Disadvantage: Encoding+decoding steps often are redundant because only some games read or modify EFB copies before using them as textures.
//
// - EFB to texture:
- // Copies the requested EFB data to a texture object in VRAM, performing any color conversion using shaders.
- // Advantage: Works for many games, since in most cases EFB copies aren't read or modified at all before being used as a texture again.
- // Since we don't do any further encoding or decoding here, this method is much faster.
- // It also allows enhancing the visual quality by doing scaled EFB copies.
+ // Copies the requested EFB data to a texture object in VRAM, performing any color conversion using shaders.
+ // Advantage: Works for many games, since in most cases EFB copies aren't read or modified at all before being used as a texture again.
+ // Since we don't do any further encoding or decoding here, this method is much faster.
+ // It also allows enhancing the visual quality by doing scaled EFB copies.
//
// - Hybrid EFB copies:
- // 1a) Whenever this function gets called, encode the requested EFB data to RAM (like EFB to RAM)
- // 1b) Set type to TCET_EC_DYNAMIC for all texture cache entries in the destination address range.
- // If EFB copy caching is enabled, further checks will (try to) prevent redundant EFB copies.
- // 2) Check if a texture cache entry for the specified dstAddr already exists (i.e. if an EFB copy was triggered to that address before):
- // 2a) Entry doesn't exist:
- // - Also copy the requested EFB data to a texture object in VRAM (like EFB to texture)
- // - Create a texture cache entry for the target (type = TCET_EC_VRAM)
- // - Store a hash of the encoded RAM data in the texcache entry.
- // 2b) Entry exists AND type is TCET_EC_VRAM:
- // - Like case 2a, but reuse the old texcache entry instead of creating a new one.
- // 2c) Entry exists AND type is TCET_EC_DYNAMIC:
- // - Only encode the texture to RAM (like EFB to RAM) and store a hash of the encoded data in the existing texcache entry.
- // - Do NOT copy the requested EFB data to a VRAM object. Reason: the texture is dynamic, i.e. the CPU is modifying it. Storing a VRAM copy is useless, because we'd always end up deleting it and reloading the data from RAM anyway.
- // 3) If the EFB copy gets used as a texture, compare the source RAM hash with the hash you stored when encoding the EFB data to RAM.
- // 3a) If the two hashes match AND type is TCET_EC_VRAM, reuse the VRAM copy you created
- // 3b) If the two hashes differ AND type is TCET_EC_VRAM, screw your existing VRAM copy. Set type to TCET_EC_DYNAMIC.
- // Redecode the source RAM data to a VRAM object. The entry basically behaves like a normal texture now.
- // 3c) If type is TCET_EC_DYNAMIC, treat the EFB copy like a normal texture.
- // Advantage: Non-dynamic EFB copies can be visually enhanced like with EFB to texture.
- // Compatibility is as good as EFB to RAM.
- // Disadvantage: Slower than EFB to texture and often even slower than EFB to RAM.
- // EFB copy cache depends on accurate texture hashing being enabled. However, with accurate hashing you end up being as slow as without a copy cache anyway.
+ // 1a) Whenever this function gets called, encode the requested EFB data to RAM (like EFB to RAM)
+ // 1b) Set type to TCET_EC_DYNAMIC for all texture cache entries in the destination address range.
+ // If EFB copy caching is enabled, further checks will (try to) prevent redundant EFB copies.
+ // 2) Check if a texture cache entry for the specified dstAddr already exists (i.e. if an EFB copy was triggered to that address before):
+ // 2a) Entry doesn't exist:
+ // - Also copy the requested EFB data to a texture object in VRAM (like EFB to texture)
+ // - Create a texture cache entry for the target (type = TCET_EC_VRAM)
+ // - Store a hash of the encoded RAM data in the texcache entry.
+ // 2b) Entry exists AND type is TCET_EC_VRAM:
+ // - Like case 2a, but reuse the old texcache entry instead of creating a new one.
+ // 2c) Entry exists AND type is TCET_EC_DYNAMIC:
+ // - Only encode the texture to RAM (like EFB to RAM) and store a hash of the encoded data in the existing texcache entry.
+ // - Do NOT copy the requested EFB data to a VRAM object. Reason: the texture is dynamic, i.e. the CPU is modifying it. Storing a VRAM copy is useless, because we'd always end up deleting it and reloading the data from RAM anyway.
+ // 3) If the EFB copy gets used as a texture, compare the source RAM hash with the hash you stored when encoding the EFB data to RAM.
+ // 3a) If the two hashes match AND type is TCET_EC_VRAM, reuse the VRAM copy you created
+ // 3b) If the two hashes differ AND type is TCET_EC_VRAM, screw your existing VRAM copy. Set type to TCET_EC_DYNAMIC.
+ // Redecode the source RAM data to a VRAM object. The entry basically behaves like a normal texture now.
+ // 3c) If type is TCET_EC_DYNAMIC, treat the EFB copy like a normal texture.
+ // Advantage: Non-dynamic EFB copies can be visually enhanced like with EFB to texture.
+ // Compatibility is as good as EFB to RAM.
+ // Disadvantage: Slower than EFB to texture and often even slower than EFB to RAM.
+ // EFB copy cache depends on accurate texture hashing being enabled. However, with accurate hashing you end up being as slow as without a copy cache anyway.
//
// Disadvantage of all methods: Calling this function requires the GPU to perform a pipeline flush which stalls any further CPU processing.
//
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h
index f459dab..517f454 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/TextureCacheBase.h
@@ -6,12 +6,12 @@
#include <map>
-#include "VideoCommon.h"
-#include "TextureDecoder.h"
-#include "BPMemory.h"
-#include "Thread.h"
+#include "Common/CommonTypes.h"
+#include "Common/Thread.h"
-#include "CommonTypes.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoCommon.h"
struct VideoConfig;
@@ -21,8 +21,8 @@ public:
enum TexCacheEntryType
{
TCET_NORMAL,
- TCET_EC_VRAM, // EFB copy which sits in VRAM and is ready to be used
- TCET_EC_DYNAMIC, // EFB copy which sits in RAM and needs to be decoded before being used
+ TCET_EC_VRAM, // EFB copy which sits in VRAM and is ready to be used
+ TCET_EC_DYNAMIC, // EFB copy which sits in RAM and needs to be decoded before being used
};
struct TCacheEntryBase
@@ -94,7 +94,7 @@ public:
static void Invalidate();
static void InvalidateRange(u32 start_address, u32 size);
static void MakeRangeDynamic(u32 start_address, u32 size);
- static void ClearRenderTargets(); // currently only used by OGL
+ static void ClearRenderTargets(); // currently only used by OGL
static bool Find(u32 start_address, u64 hash);
virtual TCacheEntryBase* CreateTexture(unsigned int width, unsigned int height,
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp
index 209b7e4..a7db334 100644
--- a/Source/Core/VideoCommon/TextureConversionShader.cpp
+++ b/Source/Core/VideoCommon/TextureConversionShader.cpp
@@ -2,19 +2,18 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-
-#include <stdio.h>
-#include <math.h>
+#include <cmath>
+#include <cstdio>
#include <locale.h>
#ifdef __APPLE__
#include <xlocale.h>
#endif
-#include "TextureConversionShader.h"
-#include "TextureDecoder.h"
-#include "BPMemory.h"
-#include "RenderBase.h"
-#include "VideoConfig.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/TextureConversionShader.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoConfig.h"
#define WRITE p+=sprintf
diff --git a/Source/Core/VideoCommon/TextureConversionShader.h b/Source/Core/VideoCommon/TextureConversionShader.h
index b3c0541..6832cc0 100644
--- a/Source/Core/VideoCommon/TextureConversionShader.h
+++ b/Source/Core/VideoCommon/TextureConversionShader.h
@@ -4,9 +4,9 @@
#pragma once
-#include "Common.h"
-#include "TextureDecoder.h"
-#include "VideoCommon.h"
+#include "Common/Common.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoCommon.h"
namespace TextureConversionShader
{
diff --git a/Source/Core/VideoCommon/TextureDecoder.h b/Source/Core/VideoCommon/TextureDecoder.h
index dd1aef1..284b992 100644
--- a/Source/Core/VideoCommon/TextureDecoder.h
+++ b/Source/Core/VideoCommon/TextureDecoder.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Hash.h"
+#include "Common/Hash.h"
enum
{
diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp
index 4b24409..91fb723 100644
--- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp
+++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp
@@ -15,18 +15,14 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
-#include "Common.h"
-//#include "VideoCommon.h" // to get debug logs
-
-#include "CPUDetect.h"
-#include "TextureDecoder.h"
-#include "VideoConfig.h"
-
-#include "LookUpTables.h"
-
#include <cmath>
-
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/TextureDecoder.h"
+//#include "VideoCommon/VideoCommon.h" // to get debug logs
+#include "VideoCommon/VideoConfig.h"
bool TexFmt_Overlay_Enable=false;
bool TexFmt_Overlay_Center=false;
@@ -1468,25 +1464,25 @@ PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8
const char* texfmt[] = {
// pixel
- "I4", "I8", "IA4", "IA8",
- "RGB565", "RGB5A3", "RGBA8", "0x07",
- "C4", "C8", "C14X2", "0x0B",
- "0x0C", "0x0D", "CMPR", "0x0F",
+ "I4", "I8", "IA4", "IA8",
+ "RGB565", "RGB5A3", "RGBA8", "0x07",
+ "C4", "C8", "C14X2", "0x0B",
+ "0x0C", "0x0D", "CMPR", "0x0F",
// Z-buffer
- "0x10", "Z8", "0x12", "Z16",
- "0x14", "0x15", "Z24X8", "0x17",
- "0x18", "0x19", "0x1A", "0x1B",
- "0x1C", "0x1D", "0x1E", "0x1F",
+ "0x10", "Z8", "0x12", "Z16",
+ "0x14", "0x15", "Z24X8", "0x17",
+ "0x18", "0x19", "0x1A", "0x1B",
+ "0x1C", "0x1D", "0x1E", "0x1F",
// pixel + copy
- "CR4", "0x21", "CRA4", "CRA8",
- "0x24", "0x25", "CYUVA8", "CA8",
- "CR8", "CG8", "CB8", "CRG8",
- "CGB8", "0x2D", "0x2E", "0x2F",
+ "CR4", "0x21", "CRA4", "CRA8",
+ "0x24", "0x25", "CYUVA8", "CA8",
+ "CR8", "CG8", "CB8", "CRG8",
+ "CGB8", "0x2D", "0x2E", "0x2F",
// Z + copy
- "CZ4", "0x31", "0x32", "0x33",
- "0x34", "0x35", "0x36", "0x37",
- "0x38", "CZ8M", "CZ8L", "0x3B",
- "CZ16L", "0x3D", "0x3E", "0x3F",
+ "CZ4", "0x31", "0x32", "0x33",
+ "0x34", "0x35", "0x36", "0x37",
+ "0x38", "CZ8M", "CZ8L", "0x3B",
+ "CZ16L", "0x3D", "0x3E", "0x3F",
};
const unsigned char sfont_map[] = {
diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp
index 3913513..d00a9bb 100644
--- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp
+++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp
@@ -2,16 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-//#include "VideoCommon.h" // to get debug logs
-
-#include "CPUDetect.h"
-#include "TextureDecoder.h"
-#include "VideoConfig.h"
+#include <cmath>
-#include "LookUpTables.h"
+#include "Common/Common.h"
+//#include "VideoCommon.h" // to get debug logs
+#include "Common/CPUDetect.h"
-#include <cmath>
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VideoConfig.h"
#ifdef _OPENMP
#include <omp.h>
@@ -1478,7 +1477,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
const __m128i bV = _mm_or_si128( _mm_slli_epi16(tmpbV, 3), _mm_srli_epi16(tmpbV, 2) );
//newdst[0] = r0 | (g0 << 8) | (b0 << 16) | (a0 << 24);
- const __m128i final = _mm_or_si128( _mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
+ const __m128i final = _mm_or_si128(_mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
_mm_or_si128(_mm_slli_epi32(bV, 16), aVxff00));
_mm_storeu_si128( (__m128i*)newdst, final );
}
@@ -1508,7 +1507,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
);
//newdst[0] = r0 | (g0 << 8) | (b0 << 16) | (a0 << 24);
- const __m128i final = _mm_or_si128( _mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
+ const __m128i final = _mm_or_si128(_mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
_mm_or_si128(_mm_slli_epi32(bV, 16), _mm_slli_epi32(aV, 24)));
_mm_storeu_si128( (__m128i*)newdst, final );
}
@@ -1580,7 +1579,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
const __m128i bV = _mm_or_si128( _mm_slli_epi16(tmpbV, 3), _mm_srli_epi16(tmpbV, 2) );
//newdst[0] = r0 | (g0 << 8) | (b0 << 16) | (a0 << 24);
- const __m128i final = _mm_or_si128( _mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
+ const __m128i final = _mm_or_si128(_mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
_mm_or_si128(_mm_slli_epi32(bV, 16), aVxff00));
// write the final result:
@@ -1615,7 +1614,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
);
//newdst[0] = r0 | (g0 << 8) | (b0 << 16) | (a0 << 24);
- const __m128i final = _mm_or_si128( _mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
+ const __m128i final = _mm_or_si128(_mm_or_si128(rV,_mm_slli_epi32(gV, 8)),
_mm_or_si128(_mm_slli_epi32(bV, 16), _mm_slli_epi32(aV, 24)));
// write the final result:
@@ -1675,7 +1674,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
const __m128i rgba10 = _mm_shuffle_epi8(_mm_unpacklo_epi8(ar1,gb1),mask0312);
const __m128i rgba11 = _mm_shuffle_epi8(_mm_unpackhi_epi8(ar1,gb1),mask0312);
- __m128i *dst128 = (__m128i*)( dst + (y + 0) * width + x );
+ __m128i *dst128 = (__m128i*)( dst + (y + 0) * width + x );
_mm_storeu_si128(dst128, rgba00);
dst128 = (__m128i*)( dst + (y + 1) * width + x );
_mm_storeu_si128(dst128, rgba01);
@@ -1774,7 +1773,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
rgba10 = _mm_or_si128(r__a10, _gb_10);
rgba11 = _mm_or_si128(r__a11, _gb_11);
// Write em out!
- __m128i *dst128 = (__m128i*)( dst + (y + 0) * width + x );
+ __m128i *dst128 = (__m128i*)( dst + (y + 0) * width + x );
_mm_storeu_si128(dst128, rgba00);
dst128 = (__m128i*)( dst + (y + 1) * width + x );
_mm_storeu_si128(dst128, rgba01);
@@ -2447,25 +2446,25 @@ PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8
const char* texfmt[] = {
// pixel
- "I4", "I8", "IA4", "IA8",
- "RGB565", "RGB5A3", "RGBA8", "0x07",
- "C4", "C8", "C14X2", "0x0B",
- "0x0C", "0x0D", "CMPR", "0x0F",
+ "I4", "I8", "IA4", "IA8",
+ "RGB565", "RGB5A3", "RGBA8", "0x07",
+ "C4", "C8", "C14X2", "0x0B",
+ "0x0C", "0x0D", "CMPR", "0x0F",
// Z-buffer
- "0x10", "Z8", "0x12", "Z16",
- "0x14", "0x15", "Z24X8", "0x17",
- "0x18", "0x19", "0x1A", "0x1B",
- "0x1C", "0x1D", "0x1E", "0x1F",
+ "0x10", "Z8", "0x12", "Z16",
+ "0x14", "0x15", "Z24X8", "0x17",
+ "0x18", "0x19", "0x1A", "0x1B",
+ "0x1C", "0x1D", "0x1E", "0x1F",
// pixel + copy
- "CR4", "0x21", "CRA4", "CRA8",
- "0x24", "0x25", "CYUVA8", "CA8",
- "CR8", "CG8", "CB8", "CRG8",
- "CGB8", "0x2D", "0x2E", "0x2F",
+ "CR4", "0x21", "CRA4", "CRA8",
+ "0x24", "0x25", "CYUVA8", "CA8",
+ "CR8", "CG8", "CB8", "CRG8",
+ "CGB8", "0x2D", "0x2E", "0x2F",
// Z + copy
- "CZ4", "0x31", "0x32", "0x33",
- "0x34", "0x35", "0x36", "0x37",
- "0x38", "CZ8M", "CZ8L", "0x3B",
- "CZ16L", "0x3D", "0x3E", "0x3F",
+ "CZ4", "0x31", "0x32", "0x33",
+ "0x34", "0x35", "0x36", "0x37",
+ "0x38", "CZ8M", "CZ8L", "0x3B",
+ "CZ16L", "0x3D", "0x3E", "0x3F",
};
const unsigned char sfont_map[] = {
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index d3806ae..a9bdb46 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -2,32 +2,32 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "VideoConfig.h"
-#include "MemoryUtil.h"
-#include "StringUtil.h"
-#include "x64Emitter.h"
-#include "x64ABI.h"
-#include "PixelEngine.h"
-#include "Host.h"
-
-#include "LookUpTables.h"
-#include "Statistics.h"
-#include "VertexLoaderManager.h"
-#include "VertexLoader.h"
-#include "BPMemory.h"
-#include "DataReader.h"
-#include "VertexManagerBase.h"
-#include "IndexGenerator.h"
-
-#include "VertexLoader_Position.h"
-#include "VertexLoader_Normal.h"
-#include "VertexLoader_Color.h"
-#include "VertexLoader_TextCoord.h"
+#include "Common/Common.h"
+#include "Common/MemoryUtil.h"
+#include "Common/StringUtil.h"
+#include "Common/x64ABI.h"
+#include "Common/x64Emitter.h"
+
+#include "Core/Host.h"
+
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/DataReader.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_Color.h"
+#include "VideoCommon/VertexLoader_Normal.h"
+#include "VideoCommon/VertexLoader_Position.h"
+#include "VideoCommon/VertexLoader_TextCoord.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
//BBox
-#include "XFMemory.h"
+#include "VideoCommon/XFMemory.h"
#ifndef _M_GENERIC
#ifndef __APPLE__
#define USE_JIT
@@ -391,7 +391,7 @@ void LOADERDECL UpdateBoundingBox()
{
m = (p1.x - p0.x) ? ((p1.y - p0.y) / (p1.x - p0.x)) : highNum;
c = p0.y - (m * p0.x);
- if (i0 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
+ if (i0 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i0 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = (s < left) ? s : left; right = (s > right) ? s : right; }
if (i0 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i0 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = (s < left) ? s : left; right = (s > right) ? s : right; }
@@ -405,7 +405,7 @@ void LOADERDECL UpdateBoundingBox()
{
m = (p2.x - p1.x) ? ((p2.y - p1.y) / (p2.x - p1.x)) : highNum;
c = p1.y - (m * p1.x);
- if (i1 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
+ if (i1 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i1 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = (s < left) ? s : left; right = (s > right) ? s : right; }
if (i1 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i1 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = (s < left) ? s : left; right = (s > right) ? s : right; }
@@ -416,7 +416,7 @@ void LOADERDECL UpdateBoundingBox()
{
m = (p2.x - p0.x) ? ((p2.y - p0.y) / (p2.x - p0.x)) : highNum;
c = p0.y - (m * p0.x);
- if (i2 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
+ if (i2 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i2 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = (s < left) ? s : left; right = (s > right) ? s : right; }
if (i2 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = (s < top) ? s : top; bottom = (s > bottom) ? s : bottom; }
if (i2 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = (s < left) ? s : left; right = (s > right) ? s : right; }
@@ -636,12 +636,12 @@ void VertexLoader::CompileVertexTranslator()
case DIRECT:
switch (m_VtxAttr.color[i].Comp)
{
- case FORMAT_16B_565: m_VertexSize += 2; WriteCall(Color_ReadDirect_16b_565); break;
- case FORMAT_24B_888: m_VertexSize += 3; WriteCall(Color_ReadDirect_24b_888); break;
- case FORMAT_32B_888x: m_VertexSize += 4; WriteCall(Color_ReadDirect_32b_888x); break;
- case FORMAT_16B_4444: m_VertexSize += 2; WriteCall(Color_ReadDirect_16b_4444); break;
- case FORMAT_24B_6666: m_VertexSize += 3; WriteCall(Color_ReadDirect_24b_6666); break;
- case FORMAT_32B_8888: m_VertexSize += 4; WriteCall(Color_ReadDirect_32b_8888); break;
+ case FORMAT_16B_565: m_VertexSize += 2; WriteCall(Color_ReadDirect_16b_565); break;
+ case FORMAT_24B_888: m_VertexSize += 3; WriteCall(Color_ReadDirect_24b_888); break;
+ case FORMAT_32B_888x: m_VertexSize += 4; WriteCall(Color_ReadDirect_32b_888x); break;
+ case FORMAT_16B_4444: m_VertexSize += 2; WriteCall(Color_ReadDirect_16b_4444); break;
+ case FORMAT_24B_6666: m_VertexSize += 3; WriteCall(Color_ReadDirect_24b_6666); break;
+ case FORMAT_32B_8888: m_VertexSize += 4; WriteCall(Color_ReadDirect_32b_8888); break;
default: _assert_(0); break;
}
break;
@@ -649,12 +649,12 @@ void VertexLoader::CompileVertexTranslator()
m_VertexSize += 1;
switch (m_VtxAttr.color[i].Comp)
{
- case FORMAT_16B_565: WriteCall(Color_ReadIndex8_16b_565); break;
- case FORMAT_24B_888: WriteCall(Color_ReadIndex8_24b_888); break;
- case FORMAT_32B_888x: WriteCall(Color_ReadIndex8_32b_888x); break;
- case FORMAT_16B_4444: WriteCall(Color_ReadIndex8_16b_4444); break;
- case FORMAT_24B_6666: WriteCall(Color_ReadIndex8_24b_6666); break;
- case FORMAT_32B_8888: WriteCall(Color_ReadIndex8_32b_8888); break;
+ case FORMAT_16B_565: WriteCall(Color_ReadIndex8_16b_565); break;
+ case FORMAT_24B_888: WriteCall(Color_ReadIndex8_24b_888); break;
+ case FORMAT_32B_888x: WriteCall(Color_ReadIndex8_32b_888x); break;
+ case FORMAT_16B_4444: WriteCall(Color_ReadIndex8_16b_4444); break;
+ case FORMAT_24B_6666: WriteCall(Color_ReadIndex8_24b_6666); break;
+ case FORMAT_32B_8888: WriteCall(Color_ReadIndex8_32b_8888); break;
default: _assert_(0); break;
}
break;
@@ -662,12 +662,12 @@ void VertexLoader::CompileVertexTranslator()
m_VertexSize += 2;
switch (m_VtxAttr.color[i].Comp)
{
- case FORMAT_16B_565: WriteCall(Color_ReadIndex16_16b_565); break;
- case FORMAT_24B_888: WriteCall(Color_ReadIndex16_24b_888); break;
- case FORMAT_32B_888x: WriteCall(Color_ReadIndex16_32b_888x); break;
- case FORMAT_16B_4444: WriteCall(Color_ReadIndex16_16b_4444); break;
- case FORMAT_24B_6666: WriteCall(Color_ReadIndex16_24b_6666); break;
- case FORMAT_32B_8888: WriteCall(Color_ReadIndex16_32b_8888); break;
+ case FORMAT_16B_565: WriteCall(Color_ReadIndex16_16b_565); break;
+ case FORMAT_24B_888: WriteCall(Color_ReadIndex16_24b_888); break;
+ case FORMAT_32B_888x: WriteCall(Color_ReadIndex16_32b_888x); break;
+ case FORMAT_16B_4444: WriteCall(Color_ReadIndex16_16b_4444); break;
+ case FORMAT_24B_6666: WriteCall(Color_ReadIndex16_24b_6666); break;
+ case FORMAT_32B_8888: WriteCall(Color_ReadIndex16_32b_8888); break;
default: _assert_(0); break;
}
break;
@@ -844,15 +844,15 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const
g_nativeVertexFmt = m_NativeFmt;
// Load position and texcoord scale factors.
- m_VtxAttr.PosFrac = g_VtxAttr[vtx_attr_group].g0.PosFrac;
- m_VtxAttr.texCoord[0].Frac = g_VtxAttr[vtx_attr_group].g0.Tex0Frac;
- m_VtxAttr.texCoord[1].Frac = g_VtxAttr[vtx_attr_group].g1.Tex1Frac;
- m_VtxAttr.texCoord[2].Frac = g_VtxAttr[vtx_attr_group].g1.Tex2Frac;
- m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac;
- m_VtxAttr.texCoord[4].Frac = g_VtxAttr[vtx_attr_group].g2.Tex4Frac;
- m_VtxAttr.texCoord[5].Frac = g_VtxAttr[vtx_attr_group].g2.Tex5Frac;
- m_VtxAttr.texCoord[6].Frac = g_VtxAttr[vtx_attr_group].g2.Tex6Frac;
- m_VtxAttr.texCoord[7].Frac = g_VtxAttr[vtx_attr_group].g2.Tex7Frac;
+ m_VtxAttr.PosFrac = g_VtxAttr[vtx_attr_group].g0.PosFrac;
+ m_VtxAttr.texCoord[0].Frac = g_VtxAttr[vtx_attr_group].g0.Tex0Frac;
+ m_VtxAttr.texCoord[1].Frac = g_VtxAttr[vtx_attr_group].g1.Tex1Frac;
+ m_VtxAttr.texCoord[2].Frac = g_VtxAttr[vtx_attr_group].g1.Tex2Frac;
+ m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac;
+ m_VtxAttr.texCoord[4].Frac = g_VtxAttr[vtx_attr_group].g2.Tex4Frac;
+ m_VtxAttr.texCoord[5].Frac = g_VtxAttr[vtx_attr_group].g2.Tex5Frac;
+ m_VtxAttr.texCoord[6].Frac = g_VtxAttr[vtx_attr_group].g2.Tex6Frac;
+ m_VtxAttr.texCoord[7].Frac = g_VtxAttr[vtx_attr_group].g2.Tex7Frac;
pVtxAttr = &m_VtxAttr;
posScale = fractionTable[m_VtxAttr.PosFrac];
@@ -913,43 +913,43 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2)
vat.g1.Hex = _group1;
vat.g2.Hex = _group2;
- m_VtxAttr.PosElements = vat.g0.PosElements;
- m_VtxAttr.PosFormat = vat.g0.PosFormat;
- m_VtxAttr.PosFrac = vat.g0.PosFrac;
- m_VtxAttr.NormalElements = vat.g0.NormalElements;
- m_VtxAttr.NormalFormat = vat.g0.NormalFormat;
- m_VtxAttr.color[0].Elements = vat.g0.Color0Elements;
- m_VtxAttr.color[0].Comp = vat.g0.Color0Comp;
- m_VtxAttr.color[1].Elements = vat.g0.Color1Elements;
- m_VtxAttr.color[1].Comp = vat.g0.Color1Comp;
- m_VtxAttr.texCoord[0].Elements = vat.g0.Tex0CoordElements;
- m_VtxAttr.texCoord[0].Format = vat.g0.Tex0CoordFormat;
- m_VtxAttr.texCoord[0].Frac = vat.g0.Tex0Frac;
- m_VtxAttr.ByteDequant = vat.g0.ByteDequant;
- m_VtxAttr.NormalIndex3 = vat.g0.NormalIndex3;
-
- m_VtxAttr.texCoord[1].Elements = vat.g1.Tex1CoordElements;
- m_VtxAttr.texCoord[1].Format = vat.g1.Tex1CoordFormat;
- m_VtxAttr.texCoord[1].Frac = vat.g1.Tex1Frac;
- m_VtxAttr.texCoord[2].Elements = vat.g1.Tex2CoordElements;
- m_VtxAttr.texCoord[2].Format = vat.g1.Tex2CoordFormat;
- m_VtxAttr.texCoord[2].Frac = vat.g1.Tex2Frac;
- m_VtxAttr.texCoord[3].Elements = vat.g1.Tex3CoordElements;
- m_VtxAttr.texCoord[3].Format = vat.g1.Tex3CoordFormat;
- m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac;
- m_VtxAttr.texCoord[4].Elements = vat.g1.Tex4CoordElements;
- m_VtxAttr.texCoord[4].Format = vat.g1.Tex4CoordFormat;
-
- m_VtxAttr.texCoord[4].Frac = vat.g2.Tex4Frac;
- m_VtxAttr.texCoord[5].Elements = vat.g2.Tex5CoordElements;
- m_VtxAttr.texCoord[5].Format = vat.g2.Tex5CoordFormat;
- m_VtxAttr.texCoord[5].Frac = vat.g2.Tex5Frac;
- m_VtxAttr.texCoord[6].Elements = vat.g2.Tex6CoordElements;
- m_VtxAttr.texCoord[6].Format = vat.g2.Tex6CoordFormat;
- m_VtxAttr.texCoord[6].Frac = vat.g2.Tex6Frac;
- m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
- m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
- m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
+ m_VtxAttr.PosElements = vat.g0.PosElements;
+ m_VtxAttr.PosFormat = vat.g0.PosFormat;
+ m_VtxAttr.PosFrac = vat.g0.PosFrac;
+ m_VtxAttr.NormalElements = vat.g0.NormalElements;
+ m_VtxAttr.NormalFormat = vat.g0.NormalFormat;
+ m_VtxAttr.color[0].Elements = vat.g0.Color0Elements;
+ m_VtxAttr.color[0].Comp = vat.g0.Color0Comp;
+ m_VtxAttr.color[1].Elements = vat.g0.Color1Elements;
+ m_VtxAttr.color[1].Comp = vat.g0.Color1Comp;
+ m_VtxAttr.texCoord[0].Elements = vat.g0.Tex0CoordElements;
+ m_VtxAttr.texCoord[0].Format = vat.g0.Tex0CoordFormat;
+ m_VtxAttr.texCoord[0].Frac = vat.g0.Tex0Frac;
+ m_VtxAttr.ByteDequant = vat.g0.ByteDequant;
+ m_VtxAttr.NormalIndex3 = vat.g0.NormalIndex3;
+
+ m_VtxAttr.texCoord[1].Elements = vat.g1.Tex1CoordElements;
+ m_VtxAttr.texCoord[1].Format = vat.g1.Tex1CoordFormat;
+ m_VtxAttr.texCoord[1].Frac = vat.g1.Tex1Frac;
+ m_VtxAttr.texCoord[2].Elements = vat.g1.Tex2CoordElements;
+ m_VtxAttr.texCoord[2].Format = vat.g1.Tex2CoordFormat;
+ m_VtxAttr.texCoord[2].Frac = vat.g1.Tex2Frac;
+ m_VtxAttr.texCoord[3].Elements = vat.g1.Tex3CoordElements;
+ m_VtxAttr.texCoord[3].Format = vat.g1.Tex3CoordFormat;
+ m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac;
+ m_VtxAttr.texCoord[4].Elements = vat.g1.Tex4CoordElements;
+ m_VtxAttr.texCoord[4].Format = vat.g1.Tex4CoordFormat;
+
+ m_VtxAttr.texCoord[4].Frac = vat.g2.Tex4Frac;
+ m_VtxAttr.texCoord[5].Elements = vat.g2.Tex5CoordElements;
+ m_VtxAttr.texCoord[5].Format = vat.g2.Tex5CoordFormat;
+ m_VtxAttr.texCoord[5].Frac = vat.g2.Tex5Frac;
+ m_VtxAttr.texCoord[6].Elements = vat.g2.Tex6CoordElements;
+ m_VtxAttr.texCoord[6].Format = vat.g2.Tex6CoordFormat;
+ m_VtxAttr.texCoord[6].Frac = vat.g2.Tex6Frac;
+ m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
+ m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
+ m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
if(!m_VtxAttr.ByteDequant) {
ERROR_LOG(VIDEO, "ByteDequant is set to zero");
diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h
index eeb9ec7..6b720b5 100644
--- a/Source/Core/VideoCommon/VertexLoader.h
+++ b/Source/Core/VideoCommon/VertexLoader.h
@@ -10,13 +10,13 @@
#include <algorithm>
#include <string>
-#include "Common.h"
+#include "Common/Common.h"
+#include "Common/x64Emitter.h"
-#include "CPMemory.h"
-#include "DataReader.h"
-#include "NativeVertexFormat.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/DataReader.h"
+#include "VideoCommon/NativeVertexFormat.h"
-#include "x64Emitter.h"
class VertexLoaderUID
{
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp
index fbc48e5..b7ad98e 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp
@@ -6,13 +6,13 @@
#include <unordered_map>
#include <vector>
-#include "VideoCommon.h"
-#include "Statistics.h"
+#include "Core/HW/Memmap.h"
-#include "VertexShaderManager.h"
-#include "VertexLoader.h"
-#include "VertexLoaderManager.h"
-#include "HW/Memmap.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoaderManager.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoCommon.h"
static int s_attr_dirty; // bitfield
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.h b/Source/Core/VideoCommon/VertexLoaderManager.h
index e7461ac..7e6c468 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.h
+++ b/Source/Core/VideoCommon/VertexLoaderManager.h
@@ -4,9 +4,10 @@
#pragma once
-#include "Common.h"
#include <string>
+#include "Common/Common.h"
+
namespace VertexLoaderManager
{
void Init();
diff --git a/Source/Core/VideoCommon/VertexLoader_Color.cpp b/Source/Core/VideoCommon/VertexLoader_Color.cpp
index e32af62..03fee03 100644
--- a/Source/Core/VideoCommon/VertexLoader_Color.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Color.cpp
@@ -2,12 +2,13 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "LookUpTables.h"
-#include "VertexLoader.h"
-#include "VertexLoader_Color.h"
-#include "VertexManagerBase.h"
+#include "Common/Common.h"
+
+#include "VideoCommon/LookUpTables.h"
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_Color.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VideoCommon.h"
#define RSHIFT 0
#define GSHIFT 8
@@ -29,11 +30,11 @@ __forceinline void _SetCol(u32 val)
//BARG -> AABBGGRR
__forceinline void _SetCol4444(u16 val)
{
- u32 col = (val & 0xF0); // col = 000000R0;
- col |= (val & 0xF ) << 12; // col |= 0000G000;
- col |= (((u32)val) & 0xF000) << 8; // col |= 00B00000;
- col |= (((u32)val) & 0x0F00) << 20; // col |= A0000000;
- col |= col >> 4; // col = A0B0G0R0 | 0A0B0G0R;
+ u32 col = (val & 0xF0); // col = 000000R0;
+ col |= (val & 0xF ) << 12; // col |= 0000G000;
+ col |= (((u32)val) & 0xF000) << 8; // col |= 00B00000;
+ col |= (((u32)val) & 0x0F00) << 20; // col |= A0000000;
+ col |= col >> 4; // col = A0B0G0R0 | 0A0B0G0R;
_SetCol(col);
}
@@ -100,9 +101,9 @@ void LOADERDECL Color_ReadDirect_24b_6666()
// F|RES: i am not 100 percent sure, but the colElements seems to be important for rendering only
// at least it fixes mario party 4
//
-// if (colElements[colIndex])
-// else
-// col |= 0xFF<<ASHIFT;
+// if (colElements[colIndex])
+// else
+// col |= 0xFF<<ASHIFT;
//
void LOADERDECL Color_ReadDirect_32b_8888()
{
diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
index e4fb2c5..5cc366f 100644
--- a/Source/Core/VideoCommon/VertexLoader_Normal.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
@@ -2,15 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "VertexLoader.h"
-#include "VertexLoader_Normal.h"
-#include "VertexManagerBase.h"
-#include "CPUDetect.h"
#include <cmath>
#include <limits>
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_Normal.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VideoCommon.h"
+
#if _M_SSE >= 0x401
#include <smmintrin.h>
#include <emmintrin.h>
@@ -110,74 +112,74 @@ struct Normal_Index_Indices3
void VertexLoader_Normal::Init(void)
{
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Direct<u8, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Direct<u8, 1>();
m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Normal_Direct<s8, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Direct<u16, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Direct<s16, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Direct<float, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct<u8, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Direct<s8, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Direct<u16, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Direct<s16, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct<float, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Direct<u16, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Direct<s16, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Direct<float, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct<u8, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Direct<s8, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Direct<u16, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Direct<s16, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct<float, 3>();
// Same as above
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Direct<u8, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Direct<s8, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Direct<u16, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Direct<s16, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Direct<float, 1>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct<u8, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Direct<s8, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Direct<u16, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Direct<s16, 3>();
- m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct<float, 3>();
-
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u8, u8, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u8, s8, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u8, u16, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u8, s16, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u8, float, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index<u8, u8, 3>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index<u8, s8, 3>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index<u8, u16, 3>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index<u8, s16, 3>();
- m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index<u8, float, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Direct<u8, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Direct<s8, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Direct<u16, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Direct<s16, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Direct<float, 1>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct<u8, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Direct<s8, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Direct<u16, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Direct<s16, 3>();
+ m_Table[NRM_DIRECT] [NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct<float, 3>();
+
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u8, u8, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u8, s8, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u8, u16, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u8, s16, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u8, float, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index<u8, u8, 3>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index<u8, s8, 3>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index<u8, u16, 3>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index<u8, s16, 3>();
+ m_Table[NRM_INDEX8] [NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index<u8, float, 3>();
// Same as above for NRM_NBT
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u8, u8, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u8, s8, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u8, u16, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u8, s16, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u8, float, 1>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3<u8, u8>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3<u8, s8>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3<u8, u16>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3<u8, s16>();
- m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3<u8, float>();
-
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u16, u8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u16, s8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u16, u16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u16, s16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u16, float, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index<u16, u8, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index<u16, s8, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index<u16, u16, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index<u16, s16, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index<u16, float, 3>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u8, u8, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u8, s8, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u8, u16, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u8, s16, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u8, float, 1>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3<u8, u8>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3<u8, s8>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3<u8, u16>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3<u8, s16>();
+ m_Table[NRM_INDEX8] [NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3<u8, float>();
+
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u16, u8, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u16, s8, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u16, u16, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u16, s16, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u16, float, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index<u16, u8, 3>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index<u16, s8, 3>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index<u16, u16, 3>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index<u16, s16, 3>();
+ m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index<u16, float, 3>();
// Same as above for NRM_NBT
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u16, u8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u16, s8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u16, u16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u16, s16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u16, float, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3<u16, u8>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3<u16, s8>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3<u16, u16>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3<u16, s16>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3<u16, float>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_UBYTE] = Normal_Index<u16, u8, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_BYTE] = Normal_Index<u16, s8, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_USHORT] = Normal_Index<u16, u16, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_SHORT] = Normal_Index<u16, s16, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT] [FORMAT_FLOAT] = Normal_Index<u16, float, 1>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3<u16, u8>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3<u16, s8>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3<u16, u16>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3<u16, s16>();
+ m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3<u16, float>();
}
unsigned int VertexLoader_Normal::GetSize(unsigned int _type,
diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.h b/Source/Core/VideoCommon/VertexLoader_Normal.h
index f74d0e9..5cbe623 100644
--- a/Source/Core/VideoCommon/VertexLoader_Normal.h
+++ b/Source/Core/VideoCommon/VertexLoader_Normal.h
@@ -4,8 +4,7 @@
#pragma once
-#include "Common.h"
-#include "CommonTypes.h"
+#include "Common/Common.h"
class VertexLoader_Normal
{
@@ -25,34 +24,34 @@ public:
private:
enum ENormalType
{
- NRM_NOT_PRESENT = 0,
- NRM_DIRECT = 1,
- NRM_INDEX8 = 2,
- NRM_INDEX16 = 3,
+ NRM_NOT_PRESENT = 0,
+ NRM_DIRECT = 1,
+ NRM_INDEX8 = 2,
+ NRM_INDEX16 = 3,
NUM_NRM_TYPE
};
enum ENormalFormat
{
- FORMAT_UBYTE = 0,
- FORMAT_BYTE = 1,
- FORMAT_USHORT = 2,
- FORMAT_SHORT = 3,
- FORMAT_FLOAT = 4,
+ FORMAT_UBYTE = 0,
+ FORMAT_BYTE = 1,
+ FORMAT_USHORT = 2,
+ FORMAT_SHORT = 3,
+ FORMAT_FLOAT = 4,
NUM_NRM_FORMAT
};
enum ENormalElements
{
- NRM_NBT = 0,
- NRM_NBT3 = 1,
+ NRM_NBT = 0,
+ NRM_NBT3 = 1,
NUM_NRM_ELEMENTS
};
enum ENormalIndices
{
- NRM_INDICES1 = 0,
- NRM_INDICES3 = 1,
+ NRM_INDICES1 = 0,
+ NRM_INDICES3 = 1,
NUM_NRM_INDICES
};
diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp
index ee26acf..5ca07e7 100644
--- a/Source/Core/VideoCommon/VertexLoader_Position.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp
@@ -4,12 +4,13 @@
#include <limits>
-#include "Common.h"
-#include "VideoCommon.h"
-#include "VertexLoader.h"
-#include "VertexLoader_Position.h"
-#include "VertexManagerBase.h"
-#include "CPUDetect.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_Position.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VideoCommon.h"
extern float posScale;
extern TVtxAttr *pVtxAttr;
diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
index dae72e2..d8fcf9b 100644
--- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
@@ -2,12 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "VertexLoader.h"
-#include "VertexLoader_TextCoord.h"
-#include "VertexManagerBase.h"
-#include "CPUDetect.h"
+#include "Common/Common.h"
+#include "Common/CPUDetect.h"
+
+#include "VideoCommon/VertexLoader.h"
+#include "VideoCommon/VertexLoader_TextCoord.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VideoCommon.h"
+
#if _M_SSE >= 0x401
#include <smmintrin.h>
diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.h b/Source/Core/VideoCommon/VertexLoader_TextCoord.h
index 8d3f618..30550b9 100644
--- a/Source/Core/VideoCommon/VertexLoader_TextCoord.h
+++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.h
@@ -4,7 +4,7 @@
#pragma once
-#include "NativeVertexFormat.h"
+#include "VideoCommon/NativeVertexFormat.h"
class VertexLoader_TextCoord
{
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp
index c4980ae..6213485 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.cpp
+++ b/Source/Core/VideoCommon/VertexManagerBase.cpp
@@ -1,20 +1,20 @@
-
-#include "Common.h"
-
-#include "Statistics.h"
-#include "OpcodeDecoding.h"
-#include "IndexGenerator.h"
-#include "VertexShaderManager.h"
-#include "PixelShaderManager.h"
-#include "NativeVertexFormat.h"
-#include "TextureCacheBase.h"
-#include "RenderBase.h"
-#include "BPStructs.h"
-#include "XFMemory.h"
-
-#include "VertexManagerBase.h"
-#include "MainBase.h"
-#include "VideoConfig.h"
+#include "Common/Common.h"
+
+#include "VideoCommon/BPStructs.h"
+#include "VideoCommon/Debugger.h"
+#include "VideoCommon/IndexGenerator.h"
+#include "VideoCommon/MainBase.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/OpcodeDecoding.h"
+#include "VideoCommon/PerfQueryBase.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/TextureCacheBase.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/XFMemory.h"
VertexManager *g_vertex_manager;
@@ -216,8 +216,16 @@ void VertexManager::Flush()
VertexShaderManager::SetConstants();
PixelShaderManager::SetConstants();
- // TODO: need to merge more stuff into VideoCommon
- g_vertex_manager->vFlush();
+ bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
+ && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
+
+ if(PerfQueryBase::ShouldEmulate())
+ g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
+ g_vertex_manager->vFlush(useDstAlpha);
+ if(PerfQueryBase::ShouldEmulate())
+ g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
+
+ GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
IsFlushed = true;
}
diff --git a/Source/Core/VideoCommon/VertexManagerBase.h b/Source/Core/VideoCommon/VertexManagerBase.h
index 6854bc5..e98db7b 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.h
+++ b/Source/Core/VideoCommon/VertexManagerBase.h
@@ -1,7 +1,7 @@
#pragma once
-#include "Common.h"
#include <vector>
+#include "Common/Common.h"
class NativeVertexFormat;
class PointerWrap;
@@ -58,7 +58,7 @@ private:
//virtual void Draw(u32 stride, bool alphapass) = 0;
// temp
- virtual void vFlush() = 0;
+ virtual void vFlush(bool useDstAlpha) = 0;
};
extern VertexManager *g_vertex_manager;
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 5d1855d..67cb4c1 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -2,20 +2,19 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <math.h>
+#include <cmath>
#include <locale.h>
#ifdef __APPLE__
#include <xlocale.h>
#endif
-#include "NativeVertexFormat.h"
-
-#include "BPMemory.h"
-#include "CPMemory.h"
-#include "DriverDetails.h"
-#include "LightingShaderGen.h"
-#include "VertexShaderGen.h"
-#include "VideoConfig.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/DriverDetails.h"
+#include "VideoCommon/LightingShaderGen.h"
+#include "VideoCommon/NativeVertexFormat.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VideoConfig.h"
static char text[16768];
diff --git a/Source/Core/VideoCommon/VertexShaderGen.h b/Source/Core/VideoCommon/VertexShaderGen.h
index d2e39a3..e705845 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.h
+++ b/Source/Core/VideoCommon/VertexShaderGen.h
@@ -4,10 +4,10 @@
#pragma once
-#include "XFMemory.h"
-#include "VideoCommon.h"
-#include "ShaderGenCommon.h"
-#include "LightingShaderGen.h"
+#include "VideoCommon/LightingShaderGen.h"
+#include "VideoCommon/ShaderGenCommon.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/XFMemory.h"
// TODO should be reordered
#define SHADER_POSITION_ATTRIB 0
@@ -50,7 +50,7 @@
#define C_NORMALMATRICES (C_TRANSFORMMATRICES + 64)
#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES + 32)
#define C_DEPTHPARAMS (C_POSTTRANSFORMMATRICES + 64)
-#define C_VENVCONST_END (C_DEPTHPARAMS + 1)
+#define C_VENVCONST_END (C_DEPTHPARAMS + 1)
#pragma pack(1)
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index 4632d09..a9a9f4d 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -2,24 +2,22 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoConfig.h"
-#include "MathUtil.h"
-
#include <cmath>
#include <sstream>
-#include "Statistics.h"
-
-#include "VertexShaderGen.h"
-#include "VertexShaderManager.h"
-#include "BPMemory.h"
-#include "CPMemory.h"
-#include "XFMemory.h"
-#include "VideoCommon.h"
-#include "VertexManagerBase.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/Statistics.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VertexShaderGen.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
+#include "VideoCommon/XFMemory.h"
-#include "RenderBase.h"
float GC_ALIGNED16(g_fProjectionMatrix[16]);
// track changes
@@ -146,22 +144,22 @@ static void ViewportCorrectionMatrix(Matrix44& result)
float intendedWd = 2.0f * xfregs.viewport.wd;
float intendedHt = -2.0f * xfregs.viewport.ht;
- if (intendedWd < 0.f)
- {
- intendedX += intendedWd;
- intendedWd = -intendedWd;
- }
- if (intendedHt < 0.f)
- {
- intendedY += intendedHt;
- intendedHt = -intendedHt;
- }
+ if (intendedWd < 0.f)
+ {
+ intendedX += intendedWd;
+ intendedWd = -intendedWd;
+ }
+ if (intendedHt < 0.f)
+ {
+ intendedY += intendedHt;
+ intendedHt = -intendedHt;
+ }
// fit to EFB size
- float X = (intendedX >= 0.f) ? intendedX : 0.f;
- float Y = (intendedY >= 0.f) ? intendedY : 0.f;
- float Wd = (X + intendedWd <= EFB_WIDTH) ? intendedWd : (EFB_WIDTH - X);
- float Ht = (Y + intendedHt <= EFB_HEIGHT) ? intendedHt : (EFB_HEIGHT - Y);
+ float X = (intendedX >= 0.f) ? intendedX : 0.f;
+ float Y = (intendedY >= 0.f) ? intendedY : 0.f;
+ float Wd = (X + intendedWd <= EFB_WIDTH) ? intendedWd : (EFB_WIDTH - X);
+ float Ht = (Y + intendedHt <= EFB_HEIGHT) ? intendedHt : (EFB_HEIGHT - Y);
Matrix44::LoadIdentity(result);
if (Wd == 0 || Ht == 0)
@@ -173,8 +171,6 @@ static void ViewportCorrectionMatrix(Matrix44& result)
result.data[4*1+3] = (-intendedHt + 2.f * (Y - intendedY)) / Ht + 1.f;
}
-void UpdateViewport();
-
void VertexShaderManager::Init()
{
Dirty();
@@ -373,13 +369,13 @@ void VertexShaderManager::SetConstants()
constants.depthparams[1] = xfregs.viewport.zRange / 16777216.0f;
dirty = true;
// This is so implementation-dependent that we can't have it here.
- UpdateViewport();
+ g_renderer->SetViewport();
// Update projection if the viewport isn't 1:1 useable
if(!g_ActiveConfig.backend_info.bSupportsOversizedViewports)
{
ViewportCorrectionMatrix(s_viewportCorrection);
- bProjectionChanged = true;
+ bProjectionChanged = true;
}
}
diff --git a/Source/Core/VideoCommon/VertexShaderManager.h b/Source/Core/VideoCommon/VertexShaderManager.h
index 08b6e81..d99f07f 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.h
+++ b/Source/Core/VideoCommon/VertexShaderManager.h
@@ -4,8 +4,8 @@
#pragma once
-#include "VertexShaderGen.h"
-#include "ConstantManager.h"
+#include "VideoCommon/ConstantManager.h"
+#include "VideoCommon/VertexShaderGen.h"
class PointerWrap;
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp
index 7e9fbfd..36e52b6 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.cpp
+++ b/Source/Core/VideoCommon/VideoBackendBase.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoBackendBase.h"
-
// TODO: ugly
#ifdef _WIN32
-#include "../VideoBackends/D3D/VideoBackend.h"
+#include "VideoBackends/D3D/VideoBackend.h"
#endif
-#include "../VideoBackends/OGL/VideoBackend.h"
-#include "../VideoBackends/Software/VideoBackend.h"
+#include "VideoBackends/OGL/VideoBackend.h"
+#include "VideoBackends/Software/VideoBackend.h"
+
+#include "VideoCommon/VideoBackendBase.h"
std::vector<VideoBackend*> g_available_video_backends;
VideoBackend* g_video_backend = NULL;
diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h
index 197e1a7..66ea785 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.h
+++ b/Source/Core/VideoCommon/VideoBackendBase.h
@@ -7,12 +7,10 @@
#include <string>
#include <vector>
-#include "ChunkFile.h"
-#include "../VideoCommon/PerfQueryBase.h"
+#include "Common/ChunkFile.h"
+#include "VideoCommon/PerfQueryBase.h"
-typedef void (*writeFn16)(const u16,const u32);
-typedef void (*writeFn32)(const u32,const u32);
-typedef void (*readFn16)(u16&, const u32);
+namespace MMIO { class Mapping; }
enum FieldType
@@ -110,11 +108,9 @@ public:
virtual bool Video_IsHiWatermarkActive() = 0;
virtual void Video_AbortFrame() = 0;
- virtual readFn16 Video_CPRead16() = 0;
- virtual writeFn16 Video_CPWrite16() = 0;
- virtual readFn16 Video_PERead16() = 0;
- virtual writeFn16 Video_PEWrite16() = 0;
- virtual writeFn32 Video_PEWrite32() = 0;
+ // Registers MMIO handlers for the CommandProcessor registers.
+ virtual void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) = 0;
+ virtual void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) = 0;
static void PopulateList();
static void ClearList();
@@ -162,11 +158,8 @@ class VideoBackendHardware : public VideoBackend
bool Video_IsHiWatermarkActive();
void Video_AbortFrame();
- readFn16 Video_CPRead16();
- writeFn16 Video_CPWrite16();
- readFn16 Video_PERead16();
- writeFn16 Video_PEWrite16();
- writeFn32 Video_PEWrite32();
+ void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
+ void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) override;
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
void DoState(PointerWrap &p);
diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h
index d71390c..b18afce 100644
--- a/Source/Core/VideoCommon/VideoCommon.h
+++ b/Source/Core/VideoCommon/VideoCommon.h
@@ -9,9 +9,9 @@
#include <windows.h>
#endif
-#include "Common.h"
-#include "MathUtil.h"
-#include "VideoBackendBase.h"
+#include "Common/Common.h"
+#include "Common/MathUtil.h"
+#include "VideoCommon/VideoBackendBase.h"
#if defined(_MSC_VER) && !defined(__x86_64__) && !defined(_M_X64)
void * memcpy_amd(void *dest, const void *src, size_t n);
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 37c6878..c6e37b9 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -4,15 +4,15 @@
#include <cmath>
-#include "Common.h"
-#include "IniFile.h"
-#include "VideoConfig.h"
-#include "VideoCommon.h"
-#include "FileUtil.h"
-#include "Core.h"
-#include "Movie.h"
-#include "OnScreenDisplay.h"
-#include "ConfigManager.h"
+#include "Common/Common.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+#include "VideoCommon/OnScreenDisplay.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/VideoConfig.h"
VideoConfig g_Config;
VideoConfig g_ActiveConfig;
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index d9e0f7e..4c30305 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -11,17 +11,17 @@
#pragma once
-#include "Common.h"
-#include "VideoCommon.h"
-
-#include <vector>
#include <string>
+#include <vector>
+
+#include "Common/Common.h"
+#include "VideoCommon/VideoCommon.h"
// Log in two categories, and save three other options in the same byte
-#define CONF_LOG 1
-#define CONF_PRIMLOG 2
-#define CONF_SAVETARGETS 8
-#define CONF_SAVESHADERS 16
+#define CONF_LOG 1
+#define CONF_PRIMLOG 2
+#define CONF_SAVETARGETS 8
+#define CONF_SAVESHADERS 16
enum AspectMode
{
diff --git a/Source/Core/VideoCommon/VideoState.cpp b/Source/Core/VideoCommon/VideoState.cpp
index 9bfbeea..b73088a 100644
--- a/Source/Core/VideoCommon/VideoState.cpp
+++ b/Source/Core/VideoCommon/VideoState.cpp
@@ -2,18 +2,17 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "VideoState.h"
-
-#include "BPMemory.h"
-#include "CPMemory.h"
-#include "XFMemory.h"
-#include "TextureDecoder.h"
-#include "Fifo.h"
-#include "CommandProcessor.h"
-#include "PixelEngine.h"
-#include "PixelShaderManager.h"
-#include "VertexShaderManager.h"
-#include "VertexManagerBase.h"
+#include "VideoCommon/BPMemory.h"
+#include "VideoCommon/CommandProcessor.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/Fifo.h"
+#include "VideoCommon/PixelEngine.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/TextureDecoder.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoState.h"
+#include "VideoCommon/XFMemory.h"
static void DoState(PointerWrap &p)
{
diff --git a/Source/Core/VideoCommon/VideoState.h b/Source/Core/VideoCommon/VideoState.h
index eeb7fb6..ba366ca 100644
--- a/Source/Core/VideoCommon/VideoState.h
+++ b/Source/Core/VideoCommon/VideoState.h
@@ -4,8 +4,8 @@
#pragma once
-#include "Common.h"
-#include "ChunkFile.h"
+#include "Common/ChunkFile.h"
+#include "Common/Common.h"
void VideoCommon_DoState(PointerWrap &p);
void VideoCommon_RunLoop(bool enable);
diff --git a/Source/Core/VideoCommon/XFMemory.cpp b/Source/Core/VideoCommon/XFMemory.cpp
index 139cc35..ded7611 100644
--- a/Source/Core/VideoCommon/XFMemory.cpp
+++ b/Source/Core/VideoCommon/XFMemory.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "XFMemory.h"
+#include "VideoCommon/XFMemory.h"
// STATE_TO_SAVE
XFRegisters xfregs;
diff --git a/Source/Core/VideoCommon/XFMemory.h b/Source/Core/VideoCommon/XFMemory.h
index 50934ad..e5f9ae0 100644
--- a/Source/Core/VideoCommon/XFMemory.h
+++ b/Source/Core/VideoCommon/XFMemory.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common.h"
+#include "Common/Common.h"
// Lighting
diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp
index 2b9e0d4..15b7568 100644
--- a/Source/Core/VideoCommon/XFStructs.cpp
+++ b/Source/Core/VideoCommon/XFStructs.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "Common.h"
-#include "VideoCommon.h"
-#include "XFMemory.h"
-#include "CPMemory.h"
-#include "VertexManagerBase.h"
-#include "VertexShaderManager.h"
-#include "PixelShaderManager.h"
-#include "HW/Memmap.h"
+#include "Common/Common.h"
+#include "Core/HW/Memmap.h"
+#include "VideoCommon/CPMemory.h"
+#include "VideoCommon/PixelShaderManager.h"
+#include "VideoCommon/VertexManagerBase.h"
+#include "VideoCommon/VertexShaderManager.h"
+#include "VideoCommon/VideoCommon.h"
+#include "VideoCommon/XFMemory.h"
void XFMemWritten(u32 transferSize, u32 baseAddress)
{
diff --git a/Source/Core/VideoCommon/XFStructs.h b/Source/Core/VideoCommon/XFStructs.h
index 9d72bbf..1c09116 100644
--- a/Source/Core/VideoCommon/XFStructs.h
+++ b/Source/Core/VideoCommon/XFStructs.h
@@ -4,4 +4,4 @@
#pragma once
-#include "XFMemory.h"
+#include "VideoCommon/XFMemory.h"
diff --git a/Source/Core/VideoCommon/stdafx.cpp b/Source/Core/VideoCommon/stdafx.cpp
index b602b39..29b70f0 100644
--- a/Source/Core/VideoCommon/stdafx.cpp
+++ b/Source/Core/VideoCommon/stdafx.cpp
@@ -2,4 +2,4 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "stdafx.h"
+#include "VideoCommon/stdafx.h"
diff --git a/Source/Core/VideoCommon/stdafx.h b/Source/Core/VideoCommon/stdafx.h
index bc50463..167fccc 100644
--- a/Source/Core/VideoCommon/stdafx.h
+++ b/Source/Core/VideoCommon/stdafx.h
@@ -9,6 +9,6 @@
#define _WIN32_IE 0x0500 // Default value is 0x0400
#endif
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <algorithm>
diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props
index 11bf856..36fe12a 100644
--- a/Source/VSProps/Base.props
+++ b/Source/VSProps/Base.props
@@ -31,16 +31,7 @@
Order matters! (first hit, first use).
Note: Directory containing source file being compiled is always searched first.
-->
- <AdditionalIncludeDirectories>$(CoreDir)AudioCommon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)Core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)DiscIO;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)DolphinWX;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)InputCommon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)VideoBackends\D3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)VideoBackends\OGL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)VideoBackends\Software;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories>$(CoreDir)VideoCommon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(CoreDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)Bochs_disasm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)GL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -119,4 +110,4 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup />
-</Project>
+</Project>
\ No newline at end of file
diff --git a/Source/pch.h b/Source/pch.h
index 2851ade..a8d687d 100644
--- a/Source/pch.h
+++ b/Source/pch.h
@@ -1,5 +1,3 @@
-#include "Common.h"
-#include "Thread.h"
#include <algorithm>
#include <array>
#include <assert.h>
@@ -56,3 +54,6 @@
#include <unordered_set>
#include <utility>
#include <vector>
+
+#include "Common/Common.h"
+#include "Common/Thread.h"
diff --git a/Tools/check-includes.py b/Tools/check-includes.py
new file mode 100755
index 0000000..aa1e8be
--- /dev/null
+++ b/Tools/check-includes.py
@@ -0,0 +1,89 @@
+#! /usr/bin/env python
+
+"""
+check-includes.py <file...>
+
+Checks if the includes are sorted properly and following the "system headers
+before local headers" rule.
+
+Ignores what is in #if blocks to avoid false negatives.
+"""
+
+import re
+import sys
+
+def exclude_if_blocks(lines):
+ '''Removes lines from #if ... #endif blocks.'''
+ level = 0
+ for l in lines:
+ if l.startswith('#if'):
+ level += 1
+ elif l.startswith('#endif'):
+ level -= 1
+ elif level == 0:
+ yield l
+
+def filter_includes(lines):
+ '''Removes lines that are not #include and keeps only the file part.'''
+ for l in lines:
+ if l.startswith('#include'):
+ if 'NOLINT' not in l:
+ yield l.split(' ', 1)[1]
+
+class IncludeFileSorter(object):
+ def __init__(self, path):
+ self.path = path
+
+ def __lt__(self, other):
+ '''Sorting function for include files.
+
+ * System headers go before local headers (check the first character -
+ if it's different, then the one starting with " is the 'larger').
+ * Then, iterate on all the path components:
+ * If they are equal, try to continue to the next path component.
+ * If not, return whether the path component are smaller/larger.
+ * Paths with less components should go first, so after iterating, check
+ whether one path still has some / in it.
+ '''
+ a, b = self.path, other.path
+ if a[0] != b[0]:
+ return False if a[0] == '"' else True
+ a, b = a[1:-1].lower(), b[1:-1].lower()
+ while '/' in a and '/' in b:
+ ca, a = a.split('/', 1)
+ cb, b = b.split('/', 1)
+ if ca != cb:
+ return ca < cb
+ if '/' in a:
+ return False
+ elif '/' in b:
+ return True
+ else:
+ return a < b
+
+ def __eq__(self, other):
+ return self.path.lower() == other.path.lower()
+
+def sort_includes(includes):
+ return sorted(includes, key=IncludeFileSorter)
+
+def show_differences(bad, good):
+ bad = [' Current'] + bad
+ good = [' Should be'] + good
+ longest = max(len(i) for i in bad)
+ padded = [i + ' ' * (longest + 4 - len(i)) for i in bad]
+ return '\n'.join('%s%s' % t for t in zip(padded, good))
+
+def check_file(path):
+ print('Checking %s' % path)
+ lines = (l.strip() for l in open(path).read().split('\n'))
+ lines = exclude_if_blocks(lines)
+ includes = list(filter_includes(lines))
+ sorted_includes = sort_includes(includes)
+ if includes != sorted_includes:
+ sys.stderr.write('%s: includes are incorrect\n' % path)
+ sys.stderr.write(show_differences(includes, sorted_includes) + '\n')
+
+if __name__ == '__main__':
+ for path in sys.argv[1:]:
+ check_file(path)