├── 1964.sln ├── 1964.suo ├── 1964.vcproj ├── 1964ini.c ├── 1964ini.h ├── DbgPrint.h ├── DebugR4300i.c ├── FPU.c ├── GC.cfg ├── Globals.h ├── LICENSE ├── R4300i.c ├── README.md ├── Readme-HOW-TO-COMPILE.txt ├── Tlb.c ├── cheatcode.c ├── cheatcode.h ├── compiler.c ├── compiler.h ├── debug_option.c ├── debug_option.h ├── dma.c ├── dma.h ├── dynaRec ├── Analyze.c ├── OpcodeDebugger.c ├── dynaBranch.h ├── dynaCOP1.c ├── dynaCOP1.h ├── dynaCPU.c ├── dynaCPU.h ├── dynaCPU_defines.h ├── dynaHelper.h ├── dynaLog.c ├── dynaLog.h ├── dynaRec.h ├── opcodeDebugger.h ├── regcache.c ├── regcache.h ├── vssver.scc ├── x86.c └── x86.h ├── emulator.c ├── emulator.h ├── fileio.c ├── fileio.h ├── gamesave.c ├── gamesave.h ├── globals.c ├── hardware.h ├── hle.c ├── hle.h ├── iPIF.c ├── iPIF.h ├── interrupt.c ├── interrupt.h ├── memory.c ├── memory.h ├── memory2.c ├── n64rcp.c ├── n64rcp.h ├── plugins.h ├── profiler.c ├── r4300i.h ├── romlist.c ├── romlist.h ├── timer.c ├── timer.h ├── tooltips.c ├── win32 ├── 1964.bmp ├── DLL_Rsp.c ├── DLL_Rsp.h ├── Dll_Audio.c ├── Dll_Audio.h ├── Dll_Input.c ├── Dll_Input.h ├── Dll_Video.c ├── Dll_Video.h ├── Thumbs.db ├── Wingui.c ├── audio.bmp ├── icon2.ico ├── input.bmp ├── registry.c ├── registry.h ├── resource.h ├── resource.hm ├── toolbar1.bmp ├── video.bmp ├── windebug.c ├── windebug.h ├── wingui.h ├── wingui.rc └── wingui2.c └── zlib ├── ioapi.h ├── readme.txt ├── unzip.h ├── vssver.scc ├── zconf.h ├── zip.h ├── zlib.h └── zlib.lib /1964.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 7.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1964", "1964.vcproj", "{9B3935DB-768E-497D-A5DA-0C9E52E7998B}" 3 | EndProject 4 | Global 5 | GlobalSection(SourceCodeControl) = preSolution 6 | SccNumberOfProjects = 1 7 | SccProjectUniqueName0 = 1964.vcproj 8 | SccProjectName0 = \u0022$/1964\u0022,\u0020RDAAAAAA 9 | SccLocalPath0 = . 10 | SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe 11 | EndGlobalSection 12 | GlobalSection(SolutionConfiguration) = preSolution 13 | ConfigName.0 = Debug 14 | ConfigName.1 = Release 15 | ConfigName.2 = Release Opcode Debugger 16 | ConfigName.3 = Release with .NET Debugging 17 | EndGlobalSection 18 | GlobalSection(ProjectDependencies) = postSolution 19 | EndGlobalSection 20 | GlobalSection(ProjectConfiguration) = postSolution 21 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Debug.ActiveCfg = Debug|Win32 22 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Debug.Build.0 = Debug|Win32 23 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release.ActiveCfg = Release|Win32 24 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release.Build.0 = Release|Win32 25 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release Opcode Debugger.ActiveCfg = Release Opcode Debugger|Win32 26 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release Opcode Debugger.Build.0 = Release Opcode Debugger|Win32 27 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release with .NET Debugging.ActiveCfg = Release with .NET Debugging|Win32 28 | {9B3935DB-768E-497D-A5DA-0C9E52E7998B}.Release with .NET Debugging.Build.0 = Release with .NET Debugging|Win32 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityGlobals) = postSolution 31 | EndGlobalSection 32 | GlobalSection(ExtensibilityAddIns) = postSolution 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /1964.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/1964.suo -------------------------------------------------------------------------------- /1964ini.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/1964ini.c -------------------------------------------------------------------------------- /1964ini.h: -------------------------------------------------------------------------------- 1 | /*$T 1964ini.h GC 1.136 02/28/02 07:55:22 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _1964INI_H__1964_ 24 | #define _1964INI_H__1964_ 25 | 26 | #include "globals.h" 27 | #include 28 | #include 29 | 30 | enum GAMESAVETYPE 31 | { 32 | DEFAULT_SAVETYPE, 33 | EEPROM_SAVETYPE, 34 | MEMPAK_SAVETYPE, 35 | SRAM_SAVETYPE, 36 | FLASHRAM_SAVETYPE, 37 | FIRSTUSE_SAVETYPE, 38 | ANYUSED_SAVETYPE 39 | }; 40 | 41 | enum EMULATORTYPE { DEFAULT_EMULATORTYPE, DYNACOMPILER, INTERPRETER }; 42 | 43 | enum EEPROMSIZE { EEPROMSIZE_DEFAULT, EEPROMSIZE_NONE, EEPROMSIZE_4KB, EEPROMSIZE_16KB }; 44 | 45 | enum CODECHECKTYPE 46 | { 47 | CODE_CHECK_DEFAULT, 48 | CODE_CHECK_NONE, 49 | CODE_CHECK_DMA_ONLY, 50 | CODE_CHECK_MEMORY_DWORD, 51 | CODE_CHECK_MEMORY_QWORD, 52 | CODE_CHECK_MEMORY_QWORD_AND_DMA, 53 | CODE_CHECK_MEMORY_BLOCK, 54 | CODE_CHECK_MEMORY_BLOCK_AND_DMA, 55 | CODE_CHECK_PROTECT_MEMORY 56 | }; 57 | 58 | enum USETLBTYPE { USETLB_DEFAULT, USETLB_YES, USETLB_NO }; 59 | 60 | enum MAXFPSTYPE { MAXFPS_DEFAULT, MAXFPS_NONE, MAXFPS_NTSC_60, MAXFPS_PAL_50, MAXFPS_AUTO_SYNC }; 61 | 62 | enum RDRAMSIZETYPE { RDRAMSIZE_DEFAULT, RDRAMSIZE_4MB, RDRAMSIZE_8MB }; 63 | 64 | enum USEREGISTERCACHING { USEREGC_DEFAULT, USEREGC_YES, USEREGC_NO }; 65 | 66 | enum COUNTERFACTOR 67 | { 68 | COUTERFACTOR_DEFAULT = 0, 69 | COUTERFACTOR_1, 70 | COUTERFACTOR_2, 71 | COUTERFACTOR_3, 72 | COUTERFACTOR_4, 73 | COUTERFACTOR_5, 74 | COUTERFACTOR_6, 75 | COUTERFACTOR_7, 76 | COUTERFACTOR_8 77 | }; 78 | 79 | enum USEFPUHACK { USEFPUHACK_DEFAULT, USEFPUHACK_YES, USEFPUHACK_NO }; 80 | 81 | enum USEDMASEGMENTATION { USEDMASEG_DEFAULT, USEDMASEG_YES, USEDMASEG_NO }; 82 | 83 | enum USE4KBLINKBLOCK { USE4KBLINKBLOCK_DEFAULT, USE4KBLINKBLOCK_YES, USE4KBLINKBLOCK_NO }; 84 | 85 | enum USEADVANCEDBLOCKANALYSIS { USEBLOCKANALYSIS_DEFAULT, USEBLOCKANALYSIS_YES, BLOCKANALYSIS_NO }; 86 | 87 | enum ASSUME32BIT { ASSUME_32BIT_DEFAULT, ASSUME_32BIT_YES, ASSUME_32BIT_NO }; 88 | 89 | enum USEHLE { USEHLE_DEFAULT, USEHLE_YES, USEHLE_NO }; 90 | 91 | struct INI_ENTRY_STRUCT 92 | { 93 | uint32 crc1; 94 | uint32 crc2; 95 | enum EMULATORTYPE Emulator; 96 | enum GAMESAVETYPE Save_Type; 97 | enum CODECHECKTYPE Code_Check; 98 | char Game_Name[40]; 99 | char Comments[80]; 100 | char Alt_Title[51]; 101 | uint8 countrycode; 102 | uint8 RDRAM_Size; 103 | uint8 Max_FPS; 104 | uint8 Use_TLB; 105 | uint8 Eeprom_size; 106 | uint8 Counter_Factor; 107 | uint8 Use_Register_Caching; 108 | uint8 FPU_Hack; 109 | uint8 DMA_Segmentation; 110 | uint8 Link_4KB_Blocks; 111 | uint8 Advanced_Block_Analysis; 112 | uint8 Assume_32bit; 113 | uint8 Use_HLE; 114 | }; 115 | typedef struct INI_ENTRY_STRUCT INI_ENTRY; 116 | 117 | /* Support update to 50000 entries, should be enough for all the N64 Games + hacks */ 118 | #define MAX_INI_ENTRIES 50000 119 | 120 | /* Globals definition */ 121 | char *rdram_size_names[]; 122 | char *save_type_names[]; 123 | char *emulator_type_names[]; 124 | char *codecheck_type_names[]; 125 | char *maxfps_type_names[]; 126 | char *usetlb_type_names[]; 127 | char *eepromsize_type_names[]; 128 | char *counter_factor_names[]; 129 | char *register_caching_names[]; 130 | char *use_fpu_hack_names[]; 131 | char *use_dma_segmentation[]; 132 | char *use_4kb_link_block_names[]; 133 | char *use_block_analysis_names[]; 134 | char *use_HLE_names[]; 135 | char *assume_32bit_names[]; 136 | 137 | float vips_speed_limits[]; 138 | 139 | extern INI_ENTRY currentromoptions; 140 | extern INI_ENTRY *ini_entries[MAX_INI_ENTRIES]; /* Only allocate memory for entry pointers */ 141 | 142 | /* entries will be dynamically allocated */ 143 | extern int ini_entry_count; 144 | 145 | /* Function definition */ 146 | void InitIniEntries(void); 147 | INI_ENTRY *GetNewIniEntry(void); 148 | int AddIniEntry(const INI_ENTRY *); 149 | void DeleteIniEntry(const int index); 150 | void DeleteAllIniEntries(void); 151 | int FindIniEntry(const char *gamename, const uint32 crc1, const uint32 crc2, const uint8 country); 152 | int FindIniEntry2(const INI_ENTRY *); 153 | int ReadIniEntry(FILE *, INI_ENTRY *); 154 | int WriteIniEntry(FILE *, const INI_ENTRY *); 155 | int ReadAllIniEntries(FILE *); 156 | int WriteAllIniEntries(FILE *); 157 | void CopyIniEntry(INI_ENTRY *, const INI_ENTRY *); 158 | void DeleteIniEntryByEntry(INI_ENTRY *pentry); 159 | void SetDefaultOptions(void); 160 | void GenerateCurrentRomOptions(void); 161 | void WriteProject64RDB(const uint32 crc1, const uint32 crc2, const uint8 countrycode); 162 | int Write1964DefaultOptionsEntry(FILE *pstream); 163 | int Read1964DefaultOptionsEntry(FILE *pstream); 164 | void chopm(char *str); 165 | uint32 ConvertHexStringToInt(const char *str, int nchars); 166 | 167 | /* 1964 default options */ 168 | extern INI_ENTRY defaultoptions; 169 | extern int romlist_sort_method; 170 | 171 | extern char default_rom_directory[_MAX_PATH]; 172 | extern char default_save_directory[_MAX_PATH]; 173 | extern char default_state_save_directory[_MAX_PATH]; 174 | extern char default_plugin_directory[_MAX_PATH]; 175 | extern char user_set_rom_directory[_MAX_PATH]; 176 | extern char user_set_save_directory[_MAX_PATH]; 177 | extern char state_save_directory[_MAX_PATH]; 178 | extern char user_set_plugin_directory[_MAX_PATH]; 179 | #endif 180 | -------------------------------------------------------------------------------- /DbgPrint.h: -------------------------------------------------------------------------------- 1 | /*$T DbgPrint.h GC 1.136 03/09/02 17:28:42 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | Debug print macros 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #ifndef _DBGPRINT_H__1964_ 25 | #define _DBGPRINT_H__1964_ 26 | 27 | #include "dynarec/dynalog.h" 28 | 29 | extern char op_str[0xFF]; 30 | 31 | char *DebugPrintInstruction(uint32 instruction); 32 | char *DebugPrintInstructionWithOutRefresh(uint32 Instruction); 33 | char *Get_Interrupt_Name(void); 34 | void DebugPrintPC(uint32 thePC); 35 | 36 | /* 37 | ======================================================================================================================= 38 | argument printing macros 39 | ======================================================================================================================= 40 | */ 41 | #define DBGPRINT_RT_IMM(_op_name) \ 42 | sprintf \ 43 | ( \ 44 | op_str, \ 45 | "%08X: %s%s[%08X],%04Xh", \ 46 | gHWS_pc, \ 47 | _op_name, \ 48 | r4300i_RegNames[RT_FT], \ 49 | (uint32) gHWS_GPR[RT_FT], \ 50 | OFFSET_IMMEDIATE \ 51 | ); 52 | 53 | #define DBGPRINT_RT_FS_COP0(_op_name) \ 54 | sprintf \ 55 | ( \ 56 | op_str, \ 57 | "%08X: %s%s[%08X],%s", \ 58 | gHWS_pc, \ 59 | _op_name, \ 60 | r4300i_RegNames[RT_FT], \ 61 | (uint32) gHWS_GPR[RT_FT], \ 62 | r4300i_COP0_RegNames[RD_FS] \ 63 | ); 64 | 65 | #define DBGPRINT_RT_FS_COP1(_op_name) \ 66 | sprintf \ 67 | ( \ 68 | op_str, \ 69 | "%08X: %s%s[%08X],%s", \ 70 | gHWS_pc, \ 71 | _op_name, \ 72 | r4300i_RegNames[RT_FT], \ 73 | (uint32) gHWS_GPR[RT_FT], \ 74 | r4300i_COP1_RegNames[RD_FS] \ 75 | ); 76 | 77 | #define DBGPRINT_BASE_RT_OFFSET(_op_name) \ 78 | sprintf \ 79 | ( \ 80 | op_str, \ 81 | "%08X: %s%2s[%08X],%04Xh(%s[%08X])", \ 82 | gHWS_pc, \ 83 | _op_name, \ 84 | r4300i_RegNames[RT_FT], \ 85 | (uint32) gHWS_GPR[RT_FT], \ 86 | OFFSET_IMMEDIATE, \ 87 | r4300i_RegNames[RS_BASE_FMT], \ 88 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 89 | ); 90 | 91 | #define DBGPRINT_BASE_RT64BIT_OFFSET(_op_name) \ 92 | sprintf \ 93 | ( \ 94 | op_str, \ 95 | "%08X: %s%2s[%8X], %04Xh(%s[%08X])", \ 96 | gHWS_pc, \ 97 | _op_name, \ 98 | r4300i_RegNames[RT_FT], \ 99 | (uint32) gHWS_GPR[RT_FT], \ 100 | OFFSET_IMMEDIATE, \ 101 | r4300i_RegNames[RS_BASE_FMT], \ 102 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 103 | ); 104 | 105 | #define DBGPRINT_RS_RT_IMM(_op_name) \ 106 | sprintf \ 107 | ( \ 108 | op_str, \ 109 | "%08X: %s%2s[%08X],%s[%08X],%04Xh", \ 110 | gHWS_pc, \ 111 | _op_name, \ 112 | r4300i_RegNames[RT_FT], \ 113 | (uint32) gHWS_GPR[RT_FT], \ 114 | r4300i_RegNames[RS_BASE_FMT], \ 115 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 116 | (signed) (OFFSET_IMMEDIATE) \ 117 | ); 118 | 119 | #define DBGPRINT_RS_RT_IMMH(_op_name) \ 120 | sprintf \ 121 | ( \ 122 | op_str, \ 123 | "%08X: %s%2s[%08X],%s[%08X],%04Xh", \ 124 | gHWS_pc, \ 125 | _op_name, \ 126 | r4300i_RegNames[RT_FT], \ 127 | ((uint32) gHWS_GPR[RT_FT]), \ 128 | r4300i_RegNames[RS_BASE_FMT], \ 129 | ((uint32) gHWS_GPR[RS_BASE_FMT]), \ 130 | (uint16) OFFSET_IMMEDIATE \ 131 | ); 132 | 133 | #define DBGPRINT_RS_OFF(_op_name) \ 134 | sprintf \ 135 | ( \ 136 | op_str, \ 137 | "%08X: %s%s[%08X],%04Xh", \ 138 | gHWS_pc, \ 139 | _op_name, \ 140 | r4300i_RegNames[RS_BASE_FMT], \ 141 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 142 | OFFSET_IMMEDIATE \ 143 | ); 144 | 145 | #define DBGPRINT_RS_IMM(_op_name) \ 146 | sprintf \ 147 | ( \ 148 | op_str, \ 149 | "%08X: %s%s[%08X],%04Xh", \ 150 | gHWS_pc, \ 151 | (uint32) _op_name, \ 152 | r4300i_RegNames[RS_BASE_FMT], \ 153 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 154 | OFFSET_IMMEDIATE \ 155 | ); 156 | 157 | #define DBGPRINT_RS_RD(_op_name) \ 158 | sprintf \ 159 | ( \ 160 | op_str, \ 161 | "%08X: %s%s[%08X],%s[%08X]", \ 162 | gHWS_pc, \ 163 | (uint32) _op_name, \ 164 | r4300i_RegNames[RS_BASE_FMT], \ 165 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 166 | r4300i_RegNames[RD_FS], \ 167 | (uint32) gHWS_GPR[RD_FS] \ 168 | ); 169 | 170 | #define DBGPRINT_RS_RT_RD(_op_name) \ 171 | sprintf \ 172 | ( \ 173 | op_str, \ 174 | "%08X: %s%2s[%08X],%s[%08X],%s[%08X]", \ 175 | gHWS_pc, \ 176 | (uint32) _op_name, \ 177 | r4300i_RegNames[RD_FS], \ 178 | (uint32) gHWS_GPR[RD_FS], \ 179 | r4300i_RegNames[RS_BASE_FMT], \ 180 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 181 | r4300i_RegNames[RT_FT], \ 182 | (uint32) gHWS_GPR[RT_FT] \ 183 | ); 184 | 185 | #define DBGPRINT_RT_RD_SA(_op_name) \ 186 | if((RT_FT | SA_FD | RD_FS) == 0) \ 187 | sprintf(op_str, "%08X: NOP", gHWS_pc); \ 188 | else \ 189 | { \ 190 | sprintf \ 191 | ( \ 192 | op_str, \ 193 | "%08X: %s%2s,%s,%04Xh", \ 194 | gHWS_pc, \ 195 | (uint32) _op_name, \ 196 | (uint32) r4300i_RegNames[RD_FS], \ 197 | (uint32) r4300i_RegNames[RT_FT], \ 198 | SA_FD \ 199 | ); \ 200 | } 201 | 202 | #define DBGPRINT_RS_RT(_op_name) \ 203 | sprintf \ 204 | ( \ 205 | op_str, \ 206 | "%08X: %s%s[%08X],%s[%08X]", \ 207 | gHWS_pc, \ 208 | (uint32) _op_name, \ 209 | r4300i_RegNames[RS_BASE_FMT], \ 210 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 211 | r4300i_RegNames[RT_FT], \ 212 | (uint32) gHWS_GPR[RT_FT] \ 213 | ); 214 | 215 | #define DBGPRINT_RD(_op_name) \ 216 | sprintf \ 217 | ( \ 218 | op_str, \ 219 | "%08X: %s%s[%08X]", \ 220 | gHWS_pc, \ 221 | (uint32) _op_name, \ 222 | r4300i_RegNames[RD_FS], \ 223 | (uint32) gHWS_GPR[RD_FS] \ 224 | ); 225 | 226 | #define DBGPRINT_RS(_op_name) \ 227 | sprintf \ 228 | ( \ 229 | op_str, \ 230 | "%08X: %s%s[%08X]", \ 231 | gHWS_pc, \ 232 | (uint32) _op_name, \ 233 | r4300i_RegNames[RS_BASE_FMT], \ 234 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 235 | ); 236 | 237 | #define DBGPRINT_RS_RT_OFF(_op_name) DBGPRINT_RS(_op_name) 238 | #define DBGPRINT_RS_RT_OFF_BRANCH(_op_name) \ 239 | sprintf \ 240 | ( \ 241 | op_str, \ 242 | "%08X: %s%s[%08X],%s[%08X],%04Xh", \ 243 | gHWS_pc, \ 244 | (uint32) _op_name, \ 245 | r4300i_RegNames[RS_BASE_FMT], \ 246 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 247 | r4300i_RegNames[RT_FT], \ 248 | (uint32) gHWS_GPR[RT_FT], \ 249 | ((OFFSET_IMMEDIATE * 4) + gHWS_pc + 4) \ 250 | ); 251 | 252 | #define DBGPRINT_RS_OFF_BRANCH(_op_name) \ 253 | sprintf \ 254 | ( \ 255 | op_str, \ 256 | "%08X: %s%s[%08X],%04Xh", \ 257 | gHWS_pc, \ 258 | (uint32) _op_name, \ 259 | r4300i_RegNames[RS_BASE_FMT], \ 260 | (uint32) gHWS_GPR[RS_BASE_FMT], \ 261 | ((OFFSET_IMMEDIATE * 4) + gHWS_pc + 4) \ 262 | ); 263 | 264 | #define DBGPRINT_FPR_OFF_BRANCH(_op_name) \ 265 | sprintf \ 266 | ( \ 267 | op_str, \ 268 | "%08X: %s%04Xh", \ 269 | gHWS_pc, \ 270 | (uint32) _op_name, \ 271 | ((OFFSET_IMMEDIATE * 4) + gHWS_pc + 4) \ 272 | ); 273 | 274 | #define DBGPRINT_INSTR_INDEX(_op_name) sprintf(op_str, "%08X: %s%08X", gHWS_pc, (uint32) _op_name, instr_index); 275 | 276 | #define DBGPRINT_RT_RD_RS(_op_name) \ 277 | sprintf \ 278 | ( \ 279 | op_str, \ 280 | "%08X: %s%2s[%08X],%s[%08X],%s[%08X]", \ 281 | gHWS_pc, \ 282 | (uint32) _op_name, \ 283 | r4300i_RegNames[RD_FS], \ 284 | (uint32) gHWS_GPR[RD_FS], \ 285 | r4300i_RegNames[RT_FT], \ 286 | (uint32) gHWS_GPR[RT_FT], \ 287 | r4300i_RegNames[RS_BASE_FMT], \ 288 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 289 | ); 290 | 291 | #define DBGPRINT_OPCODE(_op_name) sprintf(op_str, "%08X: %s", gHWS_pc, (uint32) _op_name); 292 | 293 | #define DBGPRINT_FD_FS(_op_name) \ 294 | sprintf \ 295 | ( \ 296 | op_str, \ 297 | "%08X: %s%s,%s", \ 298 | gHWS_pc, \ 299 | (uint32) _op_name, \ 300 | r4300i_COP1_RegNames[SA_FD], \ 301 | r4300i_COP1_RegNames[RD_FS] \ 302 | ); 303 | 304 | #define DBGPRINT_FD_FS_FT(_op_name) \ 305 | sprintf \ 306 | ( \ 307 | op_str, \ 308 | "%08X: %s%s[%08X],%s[%08X],%s[%08X]", \ 309 | gHWS_pc, \ 310 | (uint32) _op_name, \ 311 | r4300i_RegNames[SA_FD], \ 312 | (uint32) gHWS_GPR[SA_FD], \ 313 | r4300i_RegNames[RD_FS], \ 314 | (uint32) gHWS_GPR[RD_FS], \ 315 | r4300i_RegNames[RT_FT], \ 316 | (uint32) gHWS_GPR[RT_FT] \ 317 | ); 318 | 319 | #define DBGPRINT_BASE_FPR_OFFSET(_op_name) \ 320 | sprintf \ 321 | ( \ 322 | op_str, \ 323 | "%08X: %s%2s[%08X],%04Xh(%s[%08X])", \ 324 | gHWS_pc, \ 325 | _op_name, \ 326 | r4300i_COP1_RegNames[RT_FT], \ 327 | (uint32) gHWS_fpr32[RT_FT], \ 328 | OFFSET_IMMEDIATE, \ 329 | r4300i_RegNames[RS_BASE_FMT], \ 330 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 331 | ); 332 | 333 | #define DBGPRINT_BASE_FPR64BIT_OFFSET(_op_name) \ 334 | sprintf \ 335 | ( \ 336 | op_str, \ 337 | "%08X: %s%2s,%04Xh(%s[%08X])", \ 338 | gHWS_pc, \ 339 | _op_name, \ 340 | r4300i_COP1_RegNames[RT_FT], \ 341 | OFFSET_IMMEDIATE, \ 342 | r4300i_RegNames[RS_BASE_FMT], \ 343 | (uint32) gHWS_GPR[RS_BASE_FMT] \ 344 | ); 345 | 346 | #define DBGPRINT_FPR_FT_FS(_op_name) \ 347 | sprintf \ 348 | ( \ 349 | op_str, \ 350 | "%08X: %s%s,%s", \ 351 | gHWS_pc, \ 352 | (uint32) _op_name, \ 353 | r4300i_COP1_RegNames[RD_FS], \ 354 | r4300i_COP1_RegNames[RT_FT] \ 355 | ); 356 | 357 | #define DBGPRINT_FPR64BIT_FT_FS(_op_name) \ 358 | sprintf \ 359 | ( \ 360 | op_str, \ 361 | "%08X: %s%s,%s", \ 362 | gHWS_pc, \ 363 | (uint32) _op_name, \ 364 | r4300i_COP1_RegNames[RD_FS], \ 365 | r4300i_COP1_RegNames[RT_FT] \ 366 | ); 367 | 368 | #define DBGPRINT_FPR64BIT_FS_FD(_op_name) \ 369 | sprintf \ 370 | ( \ 371 | op_str, \ 372 | "%08X: %s%s,%s", \ 373 | gHWS_pc, \ 374 | (uint32) _op_name, \ 375 | r4300i_COP1_RegNames[RD_FS], \ 376 | r4300i_COP1_RegNames[SA_FD] \ 377 | ); 378 | 379 | #define DBGPRINT_FPU_FD_FS_FT(_op_name) \ 380 | sprintf \ 381 | ( \ 382 | op_str, \ 383 | "%08X: %s%s,%s,%s", \ 384 | gHWS_pc, \ 385 | (uint32) _op_name, \ 386 | r4300i_COP1_RegNames[SA_FD], \ 387 | r4300i_COP1_RegNames[RD_FS], \ 388 | r4300i_COP1_RegNames[RT_FT] \ 389 | ); 390 | #endif 391 | -------------------------------------------------------------------------------- /FPU.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/FPU.c -------------------------------------------------------------------------------- /GC.cfg: -------------------------------------------------------------------------------- 1 | -no-cmt_add_gc_tag- -------------------------------------------------------------------------------- /Globals.h: -------------------------------------------------------------------------------- 1 | /*$T Globals.h GC 1.136 02/28/02 08:01:26 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _GLOBALS_H__1964_ 24 | #define _GLOBALS_H__1964_ 25 | 26 | 27 | /* Data Types */ 28 | #define uint64 unsigned __int64 29 | #define uint32 unsigned __int32 30 | #define uint16 unsigned __int16 31 | #define uint8 unsigned __int8 32 | 33 | /* unsigned types */ 34 | #define _u64 unsigned __int64 /* 64 bit */ 35 | #define _u32 unsigned __int32 /* 32 bit */ 36 | #define _u16 unsigned __int16 /* 16 bit */ 37 | #define _u8 unsigned __int8 /* 8 bit */ 38 | 39 | /* signed types */ 40 | #define _s64 __int64 /* 64 bit */ 41 | #define _s32 __int32 /* 32 bit */ 42 | #define _s16 __int16 /* 16 bit */ 43 | #define _s8 __int8 /* 8 bit */ 44 | 45 | extern void __cdecl DisplayError(char *Message, ...); 46 | extern void HideCursor(int state); 47 | extern char *strnstr(const char *haystack, const char *needle, uint32 len); 48 | 49 | typedef struct 50 | { 51 | char *real_name; 52 | char *dmem_name; 53 | char *imem_name; 54 | char rom_name[256]; 55 | uint16 validation; /* 0x00 */ 56 | uint8 compression; /* 0x02 */ 57 | uint8 unknown1; /* 0x03 */ 58 | uint32 clockrate; /* 0x04 */ 59 | uint32 programcounter; /* 0x08 */ 60 | uint32 release; /* 0x0c */ 61 | uint32 crc1; /* 0x10 */ 62 | uint32 crc2; /* 0x14 */ 63 | uint64 unknown2; /* 0x18 */ 64 | uint8 name[20]; /* 0x20 - 0x33 */ 65 | uint8 unknown3; /* 0x34 */ 66 | uint8 unknown4; /* 0x35 */ 67 | uint8 unknown5; /* 0x36 */ 68 | uint8 unknown6; /* 0x37 */ 69 | uint8 unknown7; /* 0x38 */ 70 | uint8 unknown8; /* 0x39 */ 71 | uint8 unknown9; /* 0x3a */ 72 | uint8 manufacturerid; /* 0x3b */ 73 | uint16 cartridgeid; /* 0x3c */ 74 | uint8 countrycode; /* 0x3e */ 75 | uint8 unknown10; /* 0x3f */ 76 | uint64 CIC; 77 | uint64 TV_System; 78 | uint32 RDRam_Size_Hack; 79 | } t_rominfo; 80 | 81 | extern uint32 gAllocationLength; 82 | extern t_rominfo rominfo; 83 | extern volatile int Rom_Loaded; 84 | extern char *CURRENT1964VERSION; 85 | extern char generalmessage[256]; 86 | int showcursor; 87 | #endif /* _GLOBALS_H__1964_ */ 88 | -------------------------------------------------------------------------------- /R4300i.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/R4300i.c -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 1964 GEPD Edition 2 | 3 | * https://github.com/Graslu/1964GEPD/releases 4 | 5 | 1964 0.8.5, modified for use with the Mouse Injector for GE/PD 6 | 7 | Please note: The only games that benefit from this branch are GoldenEye 007 and Perfect Dark for Nintendo 64. Any other game will have negative or no impact at all. ROM files not included. 8 | 9 | # Copyright 10 | 1964 is Copyright (c) 1999-2002 Joel Middendorf 11 | 12 | Unmodified 1964 0.8.5 source code can be found at https://sourceforge.net/projects/schibo/files/1964%200.8.5/1964-2002-0922.zip/1964-2002-0922.zip 13 | -------------------------------------------------------------------------------- /Readme-HOW-TO-COMPILE.txt: -------------------------------------------------------------------------------- 1 | Please visit http://1964emu.emulation64.com 2 | or http://www.1964emu.com for the latest in 1964 news and information. 3 | 4 | To compile this source code you will need Microsoft Visual C.NET. 5 | Be sure to update your compiler with the latest service pack. 6 | 7 | In the Configuration Manager are 4 build configurations: 8 | 9 | Release (default) = 1964 final public build. This is the build for end-users. 10 | Release with .NET debugging = Permits you to use the .NET debugger. 11 | Release with Opcode Debugger = This is my debugger that compares interpretive opcodes 12 | to dyna ops and barks at you if there are any discrepancies. 13 | Debug = 1964's N64 Debugger. 14 | 15 | If you have source code related questions or If you 16 | want to hire one of us for a job in this difficult job market, 17 | you may leave us an email. If you have any other questions, 18 | please use our messageboard. 19 | 20 | Compiler settings 21 | ================= 22 | Please note that 1964 uses the __fastcall calling convention by default, and 23 | is built as a multithreaded application, needed for _beginthread(), _endthread(). 24 | 25 | The Release build is built using following additional Visual Studio .NET compiler settings: 26 | - Maximize speed 27 | - No .NET debugging tools 28 | 29 | Preprocessor Definitions: 30 | ========================= 31 | Release build has the following preprocessor definitions: 32 | DYNAREC,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,WIN32_LEAN_AND_MEAN,ENABLE_64BIT_FPU 33 | 34 | Debug build uses these preprocessor definitions: 35 | DYNAREC,DYN_DEBUG,WIN32,_WINDOWS,VIDEO,ZIP_SUPPORT,HLE,GRAPHICS_TRACER,ZLIB_DLL,ENABLE_64BIT_FPU,DEBUG_COMMON,WINDEBUG_1964,_DEBUG 36 | 37 | Release mode with opcode debugger uses the same as Release build, but adds: 38 | ENABLE_OPCODE_DEBUGGER 39 | 40 | 41 | 1964 is copyright 1999-2002 by schibo and Rice 42 | 43 | schibo - Joel Middendorf 44 | schibo@emulation64.com 45 | 46 | Rice 47 | rice1964@yahoo.com -------------------------------------------------------------------------------- /Tlb.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/Tlb.c -------------------------------------------------------------------------------- /cheatcode.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/cheatcode.c -------------------------------------------------------------------------------- /cheatcode.h: -------------------------------------------------------------------------------- 1 | /*$T cheatcode.h GC 1.136 02/28/02 07:49:38 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _CHEATCODE_H__1964_ 24 | #define _CHEATCODE_H__1964_ 25 | 26 | #define MAX_CHEATCODE_PER_GROUP 100 27 | #define MAX_CHEATCODE_GROUP_PER_ROM 254 //Cannot exceed 254 groups, must be represented by using 1 byte 28 | 29 | //Option to apply cheat code and lock memory 30 | //#define CHEATCODE_LOCK_MEMORY 31 | 32 | enum APPLYCHEATMODE { INGAME, BOOTUPONCE, GSBUTTON, ONLYIN1964 }; 33 | 34 | struct CODENODE_STRUCT 35 | { 36 | uint32 addr; 37 | uint16 val; 38 | }; 39 | 40 | typedef struct CODENODE_STRUCT CHEATCODENODE; 41 | 42 | struct CODEGROUP_STRUCT 43 | { 44 | int country; 45 | int codecount; 46 | BOOL active; 47 | char name[80]; 48 | char note[256]; 49 | CHEATCODENODE codelist[MAX_CHEATCODE_PER_GROUP]; 50 | }; 51 | typedef struct CODEGROUP_STRUCT CODEGROUP; 52 | 53 | extern int codegroupcount; 54 | extern CODEGROUP *codegrouplist; 55 | extern char current_cheatcode_rom_internal_name[30]; 56 | 57 | extern void InitCodeListForCurrentGame(void); 58 | extern void CodeList_Clear(void); 59 | extern void CodeList_GotoBeginning(void); 60 | extern BOOL CodeList_ApplyAllCode(enum APPLYCHEATMODE mode); 61 | extern BOOL CodeList_ReadCode(char *intername_rom_name); 62 | BOOL IsCodeMatchRomCountryCode(int cheat_country_code, int rom_country_code); 63 | 64 | #ifdef CHEATCODE_LOCK_MEMORY 65 | extern uint16 *cheatCodeBlockMap[0x800]; 66 | void InitCheatCodeEngineMemoryLock(void); 67 | void CloseCheatCodeEngineMemoryLock(void); 68 | BOOL CodeList_ApplyCode_At_Address(int index, uint32 addr_to_apply); 69 | 70 | #define BYTE_AFFECTED_BY_CHEAT_CODES 0xFF 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /compiler.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/compiler.c -------------------------------------------------------------------------------- /compiler.h: -------------------------------------------------------------------------------- 1 | /*$T compiler.h GC 1.136 03/09/02 15:47:18 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _COMPILER_H__1964_ 24 | #define _COMPILER_H__1964_ 25 | 26 | #include 27 | #include "debug_option.h" 28 | 29 | struct BLOCK_ENTRY_STRUCT 30 | { 31 | BOOL HasBeenCompiled; 32 | uint32 block_ptr; 33 | uint32 block_pc; 34 | BOOL need_target_1; 35 | uint32 jmp_to_target_1_code_addr; /* need to write target 1 block addr into this memory */ 36 | uint32 target_1_pc; 37 | BOOL need_target_2; 38 | uint32 jmp_to_target_2_code_addr; /* need to write target 2 block addr into this memory */ 39 | uint32 target_2_pc; 40 | struct BLOCK_ENTRY_STRUCT *next; 41 | }; 42 | 43 | struct CompilerStatus 44 | { 45 | uint32 TempPC; 46 | BOOL DynaBufferOverError; 47 | uint32 cp0Counter; 48 | uint32 KEEP_RECOMPILING; 49 | uint32 BlockStart; 50 | int Is_Compiling; 51 | unsigned long lCodePosition; 52 | uint32 *pcptr; 53 | uint32 realpc_fetched; 54 | uint32 FlagJAL; 55 | uint32 InstructionCount; 56 | }; 57 | 58 | typedef struct BLOCK_ENTRY_STRUCT BLOCK_ENTRY; 59 | extern struct CompilerStatus compilerstatus; 60 | extern BLOCK_ENTRY *current_block_entry; 61 | extern uint8 *sDYN_PC_LOOKUP[0x10000]; 62 | extern uint8 *dyna_CodeTable; 63 | extern uint8 *dyna_RecompCode; 64 | uint32 Dyna_Compile_Block(void); 65 | uint32 Dyna_Compile_4KB_Block(void); 66 | 67 | BOOL IsTargetPcInTheSame4KB(uint32 pc, uint32 target); 68 | void InvalidateOneBlock(uint32 pc); 69 | void Invalidate4KBlock(uint32 addr, char *opcodename, int type, uint64 newvalue); 70 | void Check_And_Invalidate_Compiled_Blocks_By_DMA 71 | ( 72 | uint32 startaddr, 73 | uint32 len, 74 | char *operation 75 | ); 76 | void Dyna_Code_Check_None(void); 77 | void Set_Translate_PC(void); 78 | uint32 DynaFetchInstruction2(uint32 pc); 79 | 80 | /* dynarec globals */ 81 | extern uint8 *Block; 82 | #endif 83 | -------------------------------------------------------------------------------- /debug_option.c: -------------------------------------------------------------------------------- 1 | /*$T debug_option.c GC 1.136 03/09/02 17:36:09 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | Global variables representing flags for switching on/off debugger output 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #include "debug_option.h" 25 | 26 | #ifdef DEBUG_COMMON 27 | struct DEBUGOPTIONS debugoptions; 28 | 29 | /* 30 | ======================================================================================================================= 31 | ======================================================================================================================= 32 | */ 33 | 34 | void init_debug_options(void) 35 | { 36 | debugoptions.debug_io = 0; 37 | debugoptions.debug_io_vi = 0; 38 | debugoptions.debug_io_sp = 0; 39 | debugoptions.debug_io_pi = 0; 40 | debugoptions.debug_io_ai = 0; 41 | debugoptions.debug_io_mi = 0; 42 | debugoptions.debug_io_si = 0; 43 | debugoptions.debug_io_ri = 0; 44 | debugoptions.debug_io_dp = 0; 45 | debugoptions.debug_io_dps = 0; 46 | debugoptions.debug_io_rdram = 0; 47 | debugoptions.debug_audio = 0; 48 | debugoptions.debug_trap = 1; 49 | debugoptions.debug_si_controller = 1; 50 | debugoptions.debug_compare_interrupt = 0; 51 | debugoptions.debug_cpu_counter = 0; 52 | debugoptions.debug_sp_task = 1; 53 | debugoptions.debug_si_task = 0; 54 | debugoptions.debug_sp_dma = 0; 55 | debugoptions.debug_si_dma = 0; 56 | debugoptions.debug_pi_dma = 1; 57 | debugoptions.debug_si_mempak = 1; 58 | debugoptions.debug_dump_mempak = 0; 59 | debugoptions.debug_tlb = 1; 60 | debugoptions.debug_tlb_detail = 0; 61 | debugoptions.debug_tlb_extra = 0; 62 | debugoptions.debug_si_eeprom = 1; 63 | debugoptions.debug_vi_interrupt = 0; 64 | debugoptions.debug_ai_interrupt = 0; 65 | debugoptions.debug_si_interrupt = 0; 66 | debugoptions.debug_pi_interrupt = 0; 67 | debugoptions.debug_interrupt = 0; 68 | debugoptions.debug_sram = 1; 69 | debugoptions.debug_dyna_compiler = 0; 70 | debugoptions.debug_dyna_execution = 0; 71 | debugoptions.debug_dyna_log = 0; 72 | debugoptions.debug_64bit_fpu = 0; 73 | debugoptions.debug_cache = 0; 74 | debugoptions.debug_dyna_mod_code = 0; 75 | debugoptions.debug_protect_memory = 0; 76 | debugoptions.debug_exception_services = 1; 77 | } 78 | #endif 79 | #ifdef ENABLE_OPCODE_DEBUGGER 80 | int debug_opcode = 1; 81 | #else 82 | int debug_opcode = 0; 83 | #endif 84 | int debug_opcode_block = 0; 85 | int debug_dirty_only = 1; 86 | int debug_annoying_messages = 0; 87 | 88 | char tracemessage[256]; /* message buffer to display message into debug box */ 89 | -------------------------------------------------------------------------------- /dma.h: -------------------------------------------------------------------------------- 1 | /*$T dma.h GC 1.136 03/09/02 14:02:21 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _DMA_H__1964_ 24 | #define _DMA_H__1964_ 25 | 26 | enum DMATYPE { NO_DMA_IN_PROGRESS, DMA_PI_READ, DMA_PI_WRITE, DMA_SP_READ, DMA_SP_WRITE, DMA_SI_READ, DMA_SI_WRITE, DMA_AI_WRITE }; 27 | 28 | extern BOOL DMAInProgress; 29 | extern uint32 DMA_SP_Transfer_Source_Begin_Address; 30 | extern uint32 DMA_SP_Transfer_Target_Begin_Address; 31 | extern int DMA_SP_Transfer_Count; 32 | extern int DMA_SI_Transfer_Count; 33 | 34 | extern enum DMATYPE PIDMAInProgress; 35 | extern enum DMATYPE SIDMAInProgress; 36 | extern enum DMATYPE SPDMAInProgress; 37 | 38 | extern void DoDMASegment(void); 39 | extern void DynDoDMASegment(void); 40 | extern void DoPIDMASegment(void); 41 | extern void DoSPDMASegment(void); 42 | extern void DoSIDMASegment(void); 43 | extern void DMA_AI(void); 44 | extern void InitDMA(void); 45 | 46 | /* DMA external functions */ 47 | extern void DMA_PI_MemCopy_From_Cart_To_DRAM(void); 48 | extern void DMA_PI_MemCopy_From_DRAM_To_Cart(void); 49 | extern void DMA_MemCopy_SP_to_DRAM(int WasCalledByRSP); 50 | extern void DMA_MemCopy_DRAM_To_SP(int WasCalledByRSP); 51 | extern void DMA_MemCopy_DRAM_to_SI(void); 52 | extern void DMA_MemCopy_SI_To_DRAM(void); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /dynaRec/Analyze.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/Analyze.c -------------------------------------------------------------------------------- /dynaRec/OpcodeDebugger.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/OpcodeDebugger.c -------------------------------------------------------------------------------- /dynaRec/dynaBranch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/dynaBranch.h -------------------------------------------------------------------------------- /dynaRec/dynaCOP1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/dynaCOP1.c -------------------------------------------------------------------------------- /dynaRec/dynaCOP1.h: -------------------------------------------------------------------------------- 1 | /*$T dynaCOP1.h GC 1.136 03/09/02 16:04:44 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _DYNACOP1_H_ 24 | #define _DYNACOP1_H_ 25 | 26 | extern void rs4300i_cop1_mfc1(_u32 Instruction); 27 | extern void rs4300i_cop1_dmfc1(_u32 Instruction); 28 | extern void rs4300i_cop1_cfc1(_u32 Instruction); 29 | extern void rs4300i_cop1_mtc1(_u32 Instruction); 30 | extern void rs4300i_cop1_dmtc1(_u32 Instruction); 31 | extern void rs4300i_cop1_ctc1(_u32 Instruction); 32 | extern void cop1_BC_instr(_u32 Instruction); 33 | extern void cop1_S_instr(_u32 Instruction); 34 | extern void cop1_D_instr(_u32 Instruction); 35 | extern void cop1_W_instr(_u32 Instruction); 36 | extern void cop1_L_instr(_u32 Instruction); 37 | extern void rs4300i_cop1_bc1f(_u32 Instruction); 38 | extern void rs4300i_cop1_bc1t(_u32 Instruction); 39 | extern void rs4300i_cop1_bc1fl(_u32 Instruction); 40 | extern void rs4300i_cop1_bc1tl(_u32 Instruction); 41 | extern void rs4300i_cop1_add_s(_u32 Instruction); 42 | extern void rs4300i_cop1_sub_s(_u32 Instruction); 43 | extern void rs4300i_cop1_mul_s(_u32 Instruction); 44 | extern void rs4300i_cop1_div_s(_u32 Instruction); 45 | extern void rs4300i_cop1_sqrt_s(_u32 Instruction); 46 | extern void rs4300i_cop1_abs_s(_u32 Instruction); 47 | extern void rs4300i_cop1_mov_s(_u32 Instruction); 48 | extern void rs4300i_cop1_neg_s(_u32 Instruction); 49 | extern void rs4300i_cop1_roundl_s(_u32 Instruction); 50 | extern void rs4300i_cop1_truncl_s(_u32 Instruction); 51 | extern void rs4300i_cop1_ceill_s(_u32 Instruction); 52 | extern void rs4300i_cop1_floorl_s(_u32 Instruction); 53 | extern void rs4300i_cop1_roundw_s(_u32 Instruction); 54 | extern void rs4300i_cop1_truncw_s(_u32 Instruction); 55 | extern void rs4300i_cop1_ceilw_s(_u32 Instruction); 56 | extern void rs4300i_cop1_floorw_s(_u32 Instruction); 57 | extern void rs4300i_cop1_cvtd_s(_u32 Instruction); 58 | extern void rs4300i_cop1_cvtw_s(_u32 Instruction); 59 | extern void rs4300i_cop1_cvtl_s(_u32 Instruction); 60 | extern void rs4300i_c_s(_u32 Instruction); /* cop1 compare single */ 61 | extern void rs4300i_c_f_s(_u32 Instruction); 62 | extern void rs4300i_c_un_s(_u32 Instruction); 63 | extern void rs4300i_c_eq_s(_u32 Instruction); 64 | extern void rs4300i_c_ueq_s(_u32 Instruction); 65 | extern void rs4300i_c_olt_s(_u32 Instruction); 66 | extern void rs4300i_c_ult_s(_u32 Instruction); 67 | extern void rs4300i_c_ole_s(_u32 Instruction); 68 | extern void rs4300i_c_ule_s(_u32 Instruction); 69 | extern void rs4300i_c_sf_s(_u32 Instruction); 70 | extern void rs4300i_c_ngle_s(_u32 Instruction); 71 | extern void rs4300i_c_seq_s(_u32 Instruction); 72 | extern void rs4300i_c_ngl_s(_u32 Instruction); 73 | extern void rs4300i_c_lt_s(_u32 Instruction); 74 | extern void rs4300i_c_nge_s(_u32 Instruction); 75 | extern void rs4300i_c_le_s(_u32 Instruction); 76 | extern void rs4300i_c_ngt_s(_u32 Instruction); 77 | extern void rs4300i_cop1_add_d(_u32 Instruction); 78 | extern void rs4300i_cop1_sub_d(_u32 Instruction); 79 | extern void rs4300i_cop1_mul_d(_u32 Instruction); 80 | extern void rs4300i_cop1_div_d(_u32 Instruction); 81 | extern void rs4300i_cop1_sqrt_d(_u32 Instruction); 82 | extern void rs4300i_cop1_abs_d(_u32 Instruction); 83 | extern void rs4300i_cop1_mov_d(_u32 Instruction); 84 | extern void rs4300i_cop1_neg_d(_u32 Instruction); 85 | extern void rs4300i_cop1_roundl_d(_u32 Instruction); 86 | extern void rs4300i_cop1_truncl_d(_u32 Instruction); 87 | extern void rs4300i_cop1_ceill_d(_u32 Instruction); 88 | extern void rs4300i_cop1_floorl_d(_u32 Instruction); 89 | extern void rs4300i_cop1_roundw_d(_u32 Instruction); 90 | extern void rs4300i_cop1_truncw_d(_u32 Instruction); 91 | extern void rs4300i_cop1_ceilw_d(_u32 Instruction); 92 | extern void rs4300i_cop1_floorw_d(_u32 Instruction); 93 | extern void rs4300i_cop1_cvts_d(_u32 Instruction); 94 | extern void rs4300i_cop1_cvtw_d(_u32 Instruction); 95 | extern void rs4300i_cop1_cvtl_d(_u32 Instruction); 96 | extern void rs4300i_c_d(_u32 Instruction); /* cop1 compare double */ 97 | extern void rs4300i_c_f_d(_u32 Instruction); 98 | extern void rs4300i_c_un_d(_u32 Instruction); 99 | extern void rs4300i_c_eq_d(_u32 Instruction); 100 | extern void rs4300i_c_ueq_d(_u32 Instruction); 101 | extern void rs4300i_c_olt_d(_u32 Instruction); 102 | extern void rs4300i_c_ult_d(_u32 Instruction); 103 | extern void rs4300i_c_ole_d(_u32 Instruction); 104 | extern void rs4300i_c_ule_d(_u32 Instruction); 105 | extern void rs4300i_c_sf_d(_u32 Instruction); 106 | extern void rs4300i_c_ngle_d(_u32 Instruction); 107 | extern void rs4300i_c_seq_d(_u32 Instruction); 108 | extern void rs4300i_c_ngl_d(_u32 Instruction); 109 | extern void rs4300i_c_lt_d(_u32 Instruction); 110 | extern void rs4300i_c_nge_d(_u32 Instruction); 111 | extern void rs4300i_c_le_d(_u32 Instruction); 112 | extern void rs4300i_c_ngt_d(_u32 Instruction); 113 | extern void rs4300i_cop1_cvts_w(_u32 Instruction); 114 | extern void rs4300i_cop1_cvtd_w(_u32 Instruction); 115 | extern void rs4300i_cop1_cvts_l(_u32 Instruction); 116 | extern void rs4300i_cop1_cvtd_l(_u32 Instruction); 117 | extern void rs4300i_lwc1(_u32 Instruction, _u32 pc); 118 | extern void rs4300i_ldc1(_u32 Instruction, _u32 pc); 119 | extern void rs4300i_swc1(_u32 Instruction, _u32 pc); 120 | extern void rs4300i_sdc1(_u32 Instruction, _u32 pc); 121 | #endif 122 | -------------------------------------------------------------------------------- /dynaRec/dynaCPU.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/dynaCPU.c -------------------------------------------------------------------------------- /dynaRec/dynaCPU.h: -------------------------------------------------------------------------------- 1 | /*$T dynaCPU.h GC 1.136 03/09/02 16:12:25 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef __1964_DYNACPU_H 24 | #define __1964_DYNACPU_H 25 | 26 | void COMPARE_Run(uint32 Inter_Opcode_Address, uint32 code); 27 | #define _SAFTY_CPU_(x) \ 28 | if(debug_opcode!=0) COMPARE_Run((uint32) & x, reg->code); 29 | 30 | extern void dyna4300i_reserved(OP_PARAMS); 31 | extern void dyna4300i_reserved1(OP_PARAMS); 32 | extern void dyna4300i_invalid(OP_PARAMS); 33 | extern void dyna4300i_special(OP_PARAMS); 34 | extern void dyna4300i_regimm(OP_PARAMS); 35 | extern void dyna4300i_j(OP_PARAMS); 36 | extern void dyna4300i_jal(OP_PARAMS); 37 | extern void dyna4300i_beq(OP_PARAMS); 38 | extern void dyna4300i_bne(OP_PARAMS); 39 | extern void dyna4300i_blez(OP_PARAMS); 40 | extern void dyna4300i_bgtz(OP_PARAMS); 41 | extern void dyna4300i_addi(OP_PARAMS); 42 | extern void dyna4300i_addiu(OP_PARAMS); 43 | extern void dyna4300i_slti(OP_PARAMS); 44 | extern void dyna4300i_sltiu(OP_PARAMS); 45 | extern void dyna4300i_andi(OP_PARAMS); 46 | extern void dyna4300i_ori(OP_PARAMS); 47 | extern void dyna4300i_xori(OP_PARAMS); 48 | extern void dyna4300i_lui(OP_PARAMS); 49 | extern void dyna4300i_cop0(OP_PARAMS); 50 | extern void dyna4300i_cop1(OP_PARAMS); 51 | extern void dyna4300i_cop1_with_exception(OP_PARAMS); 52 | extern void dyna4300i_cop2(OP_PARAMS); 53 | extern void dyna4300i_beql(OP_PARAMS); 54 | extern void dyna4300i_bnel(OP_PARAMS); 55 | extern void dyna4300i_blezl(OP_PARAMS); 56 | extern void dyna4300i_bgtzl(OP_PARAMS); 57 | extern void dyna4300i_daddi(OP_PARAMS); 58 | extern void dyna4300i_daddiu(OP_PARAMS); 59 | extern void dyna4300i_ldl(OP_PARAMS); 60 | extern void dyna4300i_ldr(OP_PARAMS); 61 | extern void dyna4300i_lb(OP_PARAMS); 62 | extern void dyna4300i_lh(OP_PARAMS); 63 | extern void dyna4300i_lwl(OP_PARAMS); 64 | extern void dyna4300i_lw(OP_PARAMS); 65 | extern void dyna4300i_lbu(OP_PARAMS); 66 | extern void dyna4300i_lhu(OP_PARAMS); 67 | extern void dyna4300i_lwr(OP_PARAMS); 68 | extern void dyna4300i_lwu(OP_PARAMS); 69 | extern void dyna4300i_sb(OP_PARAMS); 70 | extern void dyna4300i_sh(OP_PARAMS); 71 | extern void dyna4300i_swl(OP_PARAMS); 72 | extern void dyna4300i_sw(OP_PARAMS); 73 | extern void dyna4300i_sdl(OP_PARAMS); 74 | extern void dyna4300i_sdr(OP_PARAMS); 75 | extern void dyna4300i_swr(OP_PARAMS); 76 | extern void dyna4300i_cache(OP_PARAMS); 77 | extern void dyna4300i_ll(OP_PARAMS); 78 | extern void dyna4300i_lwc1(OP_PARAMS); 79 | extern void dyna4300i_lwc2(OP_PARAMS); 80 | extern void dyna4300i_lld(OP_PARAMS); 81 | extern void dyna4300i_ldc1(OP_PARAMS); 82 | extern void dyna4300i_ldc2(OP_PARAMS); 83 | extern void dyna4300i_ld(OP_PARAMS); 84 | extern void dyna4300i_sc(OP_PARAMS); 85 | extern void dyna4300i_swc1(OP_PARAMS); 86 | extern void dyna4300i_swc2(OP_PARAMS); 87 | extern void dyna4300i_scd(OP_PARAMS); 88 | extern void dyna4300i_sdc1(OP_PARAMS); 89 | extern void dyna4300i_sdc2(OP_PARAMS); 90 | extern void dyna4300i_sd(OP_PARAMS); 91 | extern void dyna4300i_special_shift(OP_PARAMS); /* sll, srl, sra */ 92 | extern void dyna4300i_shift_var(OP_PARAMS); /* sllv, srlv, srav */ 93 | extern void dyna4300i_special_jr(OP_PARAMS); 94 | extern void dyna4300i_special_jalr(OP_PARAMS); 95 | extern void dyna4300i_special_syscall(OP_PARAMS); 96 | extern void dyna4300i_special_break(OP_PARAMS); 97 | extern void dyna4300i_special_sync(OP_PARAMS); 98 | extern void dyna4300i_mf_mt(OP_PARAMS); 99 | extern void dyna4300i_special_dsllv(OP_PARAMS); 100 | extern void dyna4300i_special_dsrlv(OP_PARAMS); 101 | extern void dyna4300i_special_dsrav(OP_PARAMS); 102 | extern void dyna4300i_special_mul(OP_PARAMS); 103 | extern void dyna4300i_special_div(OP_PARAMS); 104 | extern void dyna4300i_special_divides(OP_PARAMS); 105 | extern void dyna4300i_special_divu(OP_PARAMS); 106 | extern void dyna4300i_special_dmult(OP_PARAMS); 107 | extern void dyna4300i_special_dmultu(OP_PARAMS); 108 | extern void dyna4300i_special_ddiv(OP_PARAMS); 109 | extern void dyna4300i_special_ddivu(OP_PARAMS); 110 | extern void dyna4300i_special_add(OP_PARAMS); 111 | extern void dyna4300i_special_addu(OP_PARAMS); 112 | extern void dyna4300i_special_sub(OP_PARAMS); 113 | extern void dyna4300i_special_subu(OP_PARAMS); 114 | extern void dyna4300i_special_and(OP_PARAMS); 115 | extern void dyna4300i_special_or(OP_PARAMS); 116 | extern void dyna4300i_special_xor(OP_PARAMS); 117 | extern void dyna4300i_special_nor(OP_PARAMS); 118 | extern void dyna4300i_special_slt(OP_PARAMS); 119 | extern void dyna4300i_special_sltu(OP_PARAMS); 120 | extern void dyna4300i_special_dadd(OP_PARAMS); 121 | extern void dyna4300i_special_daddu(OP_PARAMS); 122 | extern void dyna4300i_special_dsub(OP_PARAMS); 123 | extern void dyna4300i_special_dsubu(OP_PARAMS); 124 | extern void dyna4300i_special_tge(OP_PARAMS); 125 | extern void dyna4300i_special_tgeu(OP_PARAMS); 126 | extern void dyna4300i_special_tlt(OP_PARAMS); 127 | extern void dyna4300i_special_tltu(OP_PARAMS); 128 | extern void dyna4300i_special_teq(OP_PARAMS); 129 | extern void dyna4300i_special_tne(OP_PARAMS); 130 | extern void dyna4300i_special_dsll(OP_PARAMS); 131 | extern void dyna4300i_special_dsrl(OP_PARAMS); 132 | extern void dyna4300i_special_dsra(OP_PARAMS); 133 | extern void dyna4300i_special_dsll32(OP_PARAMS); 134 | extern void dyna4300i_special_dsrl32(OP_PARAMS); 135 | extern void dyna4300i_special_dsra32(OP_PARAMS); 136 | extern void dyna4300i_regimm_bltz(OP_PARAMS); 137 | extern void dyna4300i_regimm_bgez(OP_PARAMS); 138 | extern void dyna4300i_regimm_bltzl(OP_PARAMS); 139 | extern void dyna4300i_regimm_bgezl(OP_PARAMS); 140 | extern void dyna4300i_regimm_tgei(OP_PARAMS); 141 | extern void dyna4300i_regimm_tgeiu(OP_PARAMS); 142 | extern void dyna4300i_regimm_tlti(OP_PARAMS); 143 | extern void dyna4300i_regimm_tltiu(OP_PARAMS); 144 | extern void dyna4300i_regimm_teqi(OP_PARAMS); 145 | extern void dyna4300i_regimm_tnei(OP_PARAMS); 146 | extern void dyna4300i_regimm_bltzal(OP_PARAMS); 147 | extern void dyna4300i_regimm_bgezal(OP_PARAMS); 148 | extern void dyna4300i_regimm_bltzall(OP_PARAMS); 149 | extern void dyna4300i_regimm_bgezall(OP_PARAMS); 150 | extern void dyna4300i_cop0_rs_mf(OP_PARAMS); 151 | extern void dyna4300i_cop0_rs_dmf(OP_PARAMS); 152 | extern void dyna4300i_cop0_rs_cf(OP_PARAMS); 153 | extern void dyna4300i_cop0_rs_mt(OP_PARAMS); 154 | extern void dyna4300i_cop0_rs_dmt(OP_PARAMS); 155 | extern void dyna4300i_cop0_rs_ct(OP_PARAMS); 156 | extern void dyna4300i_cop0_rs_bc(OP_PARAMS); 157 | extern void dyna4300i_cop0_tlb(OP_PARAMS); 158 | extern void dyna4300i_cop0_rt_bcf(OP_PARAMS); 159 | extern void dyna4300i_cop0_rt_bct(OP_PARAMS); 160 | extern void dyna4300i_cop0_rt_bcfl(OP_PARAMS); 161 | extern void dyna4300i_cop0_rt_bctl(OP_PARAMS); 162 | extern void dyna4300i_cop0_tlbr(OP_PARAMS); 163 | extern void dyna4300i_cop0_tlbwi(OP_PARAMS); 164 | extern void dyna4300i_cop0_tlbwr(OP_PARAMS); 165 | extern void dyna4300i_cop0_tlbp(OP_PARAMS); 166 | extern void dyna4300i_cop0_eret(OP_PARAMS); 167 | extern void dyna4300i_cop2_rs_not_implemented(OP_PARAMS); 168 | 169 | typedef void (*dyn_cpu_instr) (OP_PARAMS); 170 | 171 | extern dyn_cpu_instr asm_instruction[64]; 172 | extern dyn_cpu_instr asm_special_instruction[64]; 173 | extern dyn_cpu_instr asm_regimm_instruction[32]; 174 | extern dyn_cpu_instr asm_cop0_rs_instruction[32]; 175 | extern dyn_cpu_instr asm_cop0_rt_instruction[32]; 176 | extern dyn_cpu_instr asm_cop0_instruction[64]; 177 | extern dyn_cpu_instr asm_cop2_rs_instruction[32]; 178 | extern dyn_cpu_instr dyna_instruction[64]; 179 | extern dyn_cpu_instr now_do_dyna_instruction[64]; 180 | extern dyn_cpu_instr dyna_special_instruction[64]; 181 | extern dyn_cpu_instr dyna_regimm_instruction[32]; 182 | extern dyn_cpu_instr dyna_cop0_rs_instruction[32]; 183 | extern dyn_cpu_instr dyna_cop0_rt_instruction[32]; 184 | extern dyn_cpu_instr dyna_tlb_instruction[64]; 185 | extern dyn_cpu_instr dyna_cop2_rs_instruction[32]; 186 | 187 | extern void SetRdRsRt32bit(HardwareState *reg); 188 | extern void SetRdRsRt64bit(HardwareState *reg); 189 | #endif 190 | -------------------------------------------------------------------------------- /dynaRec/dynaCPU_defines.h: -------------------------------------------------------------------------------- 1 | /*$T dynaCPU_defines.h GC 1.136 03/09/02 16:22:38 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | 24 | /* 25 | ======================================================================================================================= 26 | ======================================================================================================================= 27 | */ 28 | void LoadLowMipsCpuRegister(unsigned long mips_reg, unsigned char x86_reg) 29 | { 30 | if(mips_reg == 0) 31 | XOR_Reg2ToReg1(1, x86_reg, x86_reg); 32 | else 33 | { 34 | FetchEBP_Params(mips_reg); 35 | MOV_MemoryToReg(1, x86_reg, x86params.ModRM, x86params.Address); 36 | } 37 | } 38 | 39 | /* 40 | ======================================================================================================================= 41 | ======================================================================================================================= 42 | */ 43 | void LoadHighMipsCpuRegister(unsigned long mips_reg, unsigned char x86_reg) 44 | { 45 | if(mips_reg == 0) 46 | XOR_Reg2ToReg1(1, x86_reg, x86_reg); 47 | else 48 | { 49 | FetchEBP_Params(mips_reg); 50 | MOV_MemoryToReg(1, x86_reg, x86params.ModRM, 4 + x86params.Address); 51 | } 52 | } 53 | 54 | /* 55 | ======================================================================================================================= 56 | ======================================================================================================================= 57 | */ 58 | void StoreLowMipsCpuRegister(unsigned long iMipsReg, unsigned char iIntelReg) 59 | { 60 | MOV_RegToMemory(1, iIntelReg, ModRM_disp32, (unsigned long) &gHWS_GPR[iMipsReg]); 61 | } -------------------------------------------------------------------------------- /dynaRec/dynaHelper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/dynaHelper.h -------------------------------------------------------------------------------- /dynaRec/dynaLog.c: -------------------------------------------------------------------------------- 1 | /*$T dynaLog.c GC 1.136 02/28/02 08:31:26 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | Functions for logging the dynarec in x86 assembly form. 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #include 25 | #include 26 | #include "../globals.h" 27 | #include "../debug_option.h" 28 | #include "regcache.h" 29 | #include "../win32/wingui.h" 30 | 31 | extern MultiPass gMultiPass; 32 | 33 | int dynalog_count; 34 | BOOL dynalog_fileisopen; 35 | FILE *dynalog_stream; 36 | 37 | const int dynalog_maxcount = 1000; 38 | 39 | /* 40 | ======================================================================================================================= 41 | ======================================================================================================================= 42 | */ 43 | void __cdecl LogDyna(char *debug, ...) 44 | { 45 | #ifdef _DEBUG 46 | if(debugoptions.debug_dyna_log) 47 | #endif 48 | if(gMultiPass.WriteCode) 49 | { 50 | /*~~~~~~~~~~~~~~~~~~*/ 51 | va_list argptr; 52 | char text[1024]; 53 | char filename[256]; 54 | /*~~~~~~~~~~~~~~~~~~*/ 55 | 56 | strcpy(filename, directories.main_directory); 57 | strcat(filename, "dyna.log"); 58 | 59 | if(!dynalog_fileisopen) 60 | { 61 | dynalog_stream = fopen(filename, "at"); 62 | if(dynalog_stream == NULL) return; 63 | dynalog_fileisopen = TRUE; 64 | } 65 | 66 | va_start(argptr, debug); 67 | vsprintf(text, debug, argptr); 68 | va_end(argptr); 69 | 70 | fprintf(dynalog_stream, "%s", text); 71 | 72 | dynalog_count++; 73 | if(dynalog_count % dynalog_maxcount == 0) 74 | { 75 | fclose(dynalog_stream); 76 | dynalog_fileisopen = FALSE; 77 | } 78 | } 79 | } 80 | 81 | /* 82 | ======================================================================================================================= 83 | ======================================================================================================================= 84 | */ 85 | void InitLogDyna(void) 86 | { 87 | #ifdef _DEBUG 88 | if(debugoptions.debug_dyna_log) 89 | #endif 90 | { 91 | /*~~~~~~~~~~~~~~~~~~*/ 92 | char filename[256]; 93 | /*~~~~~~~~~~~~~~~~~~*/ 94 | 95 | strcpy(filename, directories.main_directory); 96 | strcat(filename, "dyna.log"); 97 | 98 | dynalog_stream = fopen(filename, "wt"); 99 | if(dynalog_stream == NULL) return; 100 | 101 | fprintf(dynalog_stream, "1964 Dynarec Log -- "); 102 | if(gMultiPass.UseOnePassOnly == 0) 103 | fprintf(dynalog_stream, "Multiple Pass\n"); 104 | else 105 | fprintf(dynalog_stream, "Single Pass\n"); 106 | 107 | fprintf(dynalog_stream, "Image Name = "); 108 | fprintf(dynalog_stream, rominfo.name); 109 | fprintf(dynalog_stream, "\n\n"); 110 | 111 | dynalog_count = 0; 112 | fclose(dynalog_stream); 113 | dynalog_fileisopen = FALSE; 114 | } 115 | } 116 | 117 | /* 118 | ======================================================================================================================= 119 | ======================================================================================================================= 120 | */ 121 | void CloseLogDyna(void) 122 | { 123 | if(dynalog_fileisopen) 124 | { 125 | fclose(dynalog_stream); 126 | dynalog_fileisopen = FALSE; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /dynaRec/dynaLog.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/dynaLog.h -------------------------------------------------------------------------------- /dynaRec/dynaRec.h: -------------------------------------------------------------------------------- 1 | /*$T dynaRec.h GC 1.136 02/28/02 08:32:49 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef __DYNAREC_H 24 | #define __DYNAREC_H 25 | 26 | #include "hardware.h" 27 | 28 | extern BOOL Init_Dynarec(void); 29 | extern void Free_Dynarec(void); 30 | extern void Start_Dynarec(void); 31 | #endif 32 | -------------------------------------------------------------------------------- /dynaRec/opcodeDebugger.h: -------------------------------------------------------------------------------- 1 | /*$T opcodeDebugger.h GC 1.136 02/28/02 08:33:48 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef __OPCODE_DEBUGGER_H 24 | #define __OPCODE_DEBUGGER_H 25 | 26 | extern uint8 *TLB_sDWord[0x100000]; 27 | extern uint8 *sDWord[0x10000]; 28 | extern uint8 *sDWord2[0x10000]; 29 | 30 | extern unsigned _int8 **sDWord_ptr; 31 | extern unsigned _int8 **sDWord_ptr2; 32 | extern unsigned _int8 **TLB_sDWord_ptr; 33 | 34 | 35 | #ifdef ENABLE_OPCODE_DEBUGGER 36 | #define sDWORD_R (sDWord_ptr) 37 | #define sDWORD_R_2 (sDWord2_ptr) 38 | #define TLB_sDWORD_R (TLB_sDWord_ptr) 39 | #define gHWS_GPR p_gHardwareState->GPR 40 | #define gHWS_COP0Reg p_gHardwareState->COP0Reg 41 | #define gHWS_fpr32 p_gHardwareState->fpr32 42 | #define gHWS_COP1Reg p_gHardwareState->COP1Reg 43 | #define gHWS_RememberFprHi p_gHardwareState->RememberFprHi 44 | #define gHWS_COP1Con p_gHardwareState->COP1Con 45 | #define gHWS_COP0Con p_gHardwareState->COP0Con 46 | #define gHWS_LLbit p_gHardwareState->LLbit 47 | #define gHWS_pc p_gHardwareState->pc 48 | #define gHWS_code p_gHardwareState->code 49 | #define gMS_ramRegs0 p_gMemoryState->ramRegs0 50 | #define gMS_ramRegs4 p_gMemoryState->ramRegs4 51 | #define gMS_ramRegs8 p_gMemoryState->ramRegs8 52 | #define gMS_SP_MEM p_gMemoryState->SP_MEM 53 | #define gMS_SP_REG_1 p_gMemoryState->SP_REG_1 54 | #define gMS_SP_REG_2 p_gMemoryState->SP_REG_2 55 | #define gMS_DPC p_gMemoryState->DPC 56 | #define gMS_DPS p_gMemoryState->DPS 57 | #define gMS_MI p_gMemoryState->MI 58 | #define gMS_VI p_gMemoryState->VI 59 | #define gMS_AI p_gMemoryState->AI 60 | #define gMS_PI p_gMemoryState->PI 61 | #define gMS_RI p_gMemoryState->RI 62 | #define gMS_SI p_gMemoryState->SI 63 | #define gMS_RDRAM p_gMemoryState->RDRAM 64 | #define gMS_C2A1 p_gMemoryState->C2A1 65 | #define gMS_C1A1 p_gMemoryState->C1A1 66 | #define gMS_C1A3 p_gMemoryState->C1A3 67 | #define gMS_C2A2 p_gMemoryState->C2A2 68 | #define gMS_ROM_Image p_gMemoryState->ROM_Image 69 | #define gMS_GIO_REG p_gMemoryState->GIO_REG 70 | #define gMS_PIF p_gMemoryState->PIF 71 | #define gMS_ExRDRAM p_gMemoryState->ExRDRAM 72 | #define gMS_dummyNoAccess p_gMemoryState->dummyNoAccess 73 | #define gMS_dummyReadWrite p_gMemoryState->dummyReadWrite 74 | #define gMS_dummyAllZero p_gMemoryState->dummyAllZero 75 | #define gMS_TLB p_gMemoryState->TLB 76 | #define OPCODE_DEBUGGER_EPILOGUE(x) \ 77 | { \ 78 | int k; \ 79 | for(k = 0; k <= 1; k++) \ 80 | { \ 81 | if(k == 0 && debug_opcode != 0) COMPARE_SwitchToInterpretive(); \ 82 | if(k == 1) COMPARE_SwitchToDynarec(); \ 83 | x; \ 84 | if(debug_opcode != 1) break; \ 85 | } \ 86 | } 87 | #else 88 | #define sDWORD_R sDWord 89 | #define sDWORD_R_2 sDWord2 90 | #define TLB_sDWORD_R TLB_sDWord 91 | #define gHWS_GPR gHardwareState.GPR 92 | #define gHWS_COP0Reg gHardwareState.COP0Reg 93 | #define gHWS_fpr32 gHardwareState.fpr32 94 | #define gHWS_COP1Reg gHardwareState.COP1Reg 95 | #define gHWS_RememberFprHi gHardwareState.RememberFprHi 96 | #define gHWS_COP1Con gHardwareState.COP1Con 97 | #define gHWS_COP0Con gHardwareState.COP0Con 98 | #define gHWS_LLbit gHardwareState.LLbit 99 | #define gHWS_pc gHardwareState.pc 100 | #define gHWS_code gHardwareState.code 101 | #define gMS_ramRegs0 gMemoryState.ramRegs0 102 | #define gMS_ramRegs4 gMemoryState.ramRegs4 103 | #define gMS_ramRegs8 gMemoryState.ramRegs8 104 | #define gMS_SP_MEM gMemoryState.SP_MEM 105 | #define gMS_SP_REG_1 gMemoryState.SP_REG_1 106 | #define gMS_SP_REG_2 gMemoryState.SP_REG_2 107 | #define gMS_DPC gMemoryState.DPC 108 | #define gMS_DPS gMemoryState.DPS 109 | #define gMS_MI gMemoryState.MI 110 | #define gMS_VI gMemoryState.VI 111 | #define gMS_AI gMemoryState.AI 112 | #define gMS_PI gMemoryState.PI 113 | #define gMS_RI gMemoryState.RI 114 | #define gMS_SI gMemoryState.SI 115 | #define gMS_RDRAM gMemoryState.RDRAM 116 | #define gMS_C2A1 gMemoryState.C2A1 117 | #define gMS_C1A1 gMemoryState.C1A1 118 | #define gMS_C1A3 gMemoryState.C1A3 119 | #define gMS_C2A2 gMemoryState.C2A2 120 | #define gMS_ROM_Image gMemoryState.ROM_Image 121 | #define gMS_GIO_REG gMemoryState.GIO_REG 122 | #define gMS_PIF gMemoryState.PIF 123 | #define gMS_ExRDRAM gMemoryState.ExRDRAM 124 | #define gMS_dummyNoAccess gMemoryState.dummyNoAccess 125 | #define gMS_dummyReadWrite gMemoryState.dummyReadWrite 126 | #define gMS_dummyAllZero gMemoryState.dummyAllZero 127 | #define gMS_TLB gMemoryState.TLB 128 | #define OPCODE_DEBUGGER_EPILOGUE(x) x 129 | #endif 130 | void COMPARE_SwitchToInterpretive(void); 131 | void COMPARE_SwitchToDynarec(void); 132 | 133 | #ifdef ENABLE_OPCODE_DEBUGGER 134 | extern uint8 *sDWORD_R__Debug[0x10000]; 135 | extern uint8 *sDWORD_R_2__Debug[0x10000]; 136 | #endif 137 | extern uint8 **sDWord_ptr; 138 | extern uint8 **sDWord2_ptr; 139 | extern uint8 **TLB_sDWord_ptr; 140 | extern HardwareState gHardwareState_Interpreter_Compare; 141 | extern HardwareState gHardwareState_Flushed_Dynarec_Compare; 142 | extern MemoryState gMemoryState_Interpreter_Compare; 143 | 144 | extern uint32 PcBeforeBranch; 145 | extern uint32 BlockStartPC; 146 | #endif 147 | -------------------------------------------------------------------------------- /dynaRec/regcache.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/regcache.c -------------------------------------------------------------------------------- /dynaRec/regcache.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/regcache.h -------------------------------------------------------------------------------- /dynaRec/vssver.scc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/vssver.scc -------------------------------------------------------------------------------- /dynaRec/x86.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/x86.c -------------------------------------------------------------------------------- /dynaRec/x86.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/dynaRec/x86.h -------------------------------------------------------------------------------- /emulator.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/emulator.c -------------------------------------------------------------------------------- /emulator.h: -------------------------------------------------------------------------------- 1 | /*$T emulator.h GC 1.136 02/28/02 07:57:45 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _EMULATOR_H__1964_ 24 | #define _EMULATOR_H__1964_ 25 | 26 | #include "debug_option.h" 27 | #include "dynarec/dynalog.h" 28 | 29 | enum { WORDTYPE, HWORDTYPE, BYTETYPE, DWORDTYPE, NOCHECKTYPE }; 30 | enum { INIT_EMU_AFTER_PAUSE, REFRESH_DYNA_AFTER_PAUSE, DO_NOTHING_AFTER_PAUSE }; 31 | enum GAME_STOP_REASON { EMURUNNING, EMUSTOP, EMUPAUSE, EMUSWITCHCORE, EMURESUME, VIDEOCRASH, CPUCRASH }; 32 | enum GAME_HACK_DETECTED { GHACK_NONE, GHACK_GE, GHACK_PD }; 33 | 34 | extern HANDLE CPUThreadHandle; 35 | extern int Audio_Is_Initialized; 36 | 37 | struct EmuStatus 38 | { 39 | int DListCount; 40 | int AListCount; 41 | int PIDMACount; 42 | int ControllerReadCount; 43 | BOOL Emu_Is_Running; 44 | BOOL Emu_Is_Paused; /* means the emu is still in running state, but just paused */ 45 | BOOL Emu_Is_Resetting; /* means the emu is still in running state, but just paused */ 46 | int CodeCheckMethod; 47 | int exception_entry_count; 48 | int cpucore; 49 | enum GAME_STOP_REASON reason_to_stop; 50 | int action_after_resume; 51 | volatile BOOL Emu_Keep_Running; 52 | int gepd_pause; 53 | enum GAME_HACK_DETECTED game_hack; 54 | }; 55 | extern struct EmuStatus emustatus; 56 | 57 | struct EmuOptions 58 | { 59 | BOOL auto_apply_cheat_code; 60 | BOOL auto_run_rom; 61 | BOOL auto_full_screen; 62 | BOOL dma_in_segments; 63 | BOOL SyncVI; 64 | BOOL UsingRspPlugin; 65 | int OverclockFactor; 66 | BOOL GEFiringRateHack; 67 | BOOL GEDisableHeadRoll; 68 | BOOL PDSpeedHack; 69 | }; 70 | extern struct EmuOptions emuoptions; 71 | 72 | extern uint8 *RDRAM_Copy; 73 | extern uint8 HeaderDllPass[0x40]; 74 | 75 | void RunEmulator(unsigned _int32 WhichCore); 76 | void ClearCPUTasks(void); 77 | void InterpreterStepCPU(void); 78 | uint32 FetchInstruction(void); 79 | __forceinline void RunDynaBlock(void); 80 | void PauseEmulating(void); 81 | BOOL PauseEmulator(void); 82 | void ResumeEmulator(int action_after_pause); 83 | void StopEmulator(void); 84 | void EmulatorSetCore(int core); 85 | void (*Dyna_Code_Check[]) (); 86 | void (*Dyna_Check_Codes) (); 87 | void Dyna_Code_Check_None_Boot(void); 88 | void Dyna_Code_Check_QWORD(void); 89 | void Dyna_Exception_Service_Routine(uint32 vector); 90 | void Invalidate4KBlock(uint32 addr, char *opcodename, int type, uint64 newvalue); 91 | void CPU_Task_To_String(char *str); 92 | 93 | #ifdef DEBUG_COMMON 94 | #define INTERPRETER_DEBUG_INSTRUCTION(inst) \ 95 | if(DebuggerActive) \ 96 | { \ 97 | HandleBreakpoint(inst); \ 98 | if(DebuggerOpcodeTraceEnabled) \ 99 | { \ 100 | DebugPrintInstruction(inst); \ 101 | RefreshDebugger(); \ 102 | } \ 103 | } 104 | #else 105 | #define INTERPRETER_DEBUG_INSTRUCTION(inst) 106 | #endif 107 | #ifdef DEBUG_COMMON 108 | #define DYNA_DEBUG_INSTRUCTION(inst) \ 109 | /* FlushAllRegisters(); */ \ 110 | if(DebuggerActive && (DebuggerOpcodeTraceEnabled || DebuggerBreakPointActive)) \ 111 | { \ 112 | rc_DYNDEBUG_UPDATE(inst) DEBUG_BPT(inst) \ 113 | } 114 | #else 115 | #define DYNA_DEBUG_INSTRUCTION(inst) 116 | #endif 117 | #ifdef DEBUG_COMMON 118 | #ifdef LOG_DYNA 119 | #define DYNA_LOG_INSTRUCTION if(debugoptions.debug_dyna_log) \ 120 | LogDyna("\n%s\n", DebugPrintInstructionWithOutRefresh(gHWS_code)); 121 | #else 122 | #define DYNA_LOG_INSTRUCTION 123 | #endif 124 | #else /* release */ 125 | #ifdef LOG_DYNA 126 | #define DYNA_LOG_INSTRUCTION if((gMultiPass.WhichPass != COMPILE_MAP_ONLY) || (gMultiPass.UseOnePassOnly == 1)) \ 127 | LogDyna("\n%s\n", DebugPrintInstructionWithOutRefresh(gHWS_code)); 128 | #else 129 | #define DYNA_LOG_INSTRUCTION 130 | #endif 131 | #endif 132 | #ifdef DEBUG_DYNAEXECUTION 133 | #define DEBUG_PRINT_DYNA_EXECUTION_INFO if(debugoptions.debug_dyna_execution) \ 134 | { \ 135 | sprintf(generalmessage, "Dyna execution: PC = %08X", gHWS_pc); \ 136 | RefreshOpList(generalmessage); \ 137 | } 138 | #else 139 | #define DEBUG_PRINT_DYNA_EXECUTION_INFO 140 | #endif 141 | #ifdef DEBUG_DYNA 142 | #define DEBUG_PRINT_DYNA_COMPILE_INFO if(debugoptions.debug_dyna_compiler) \ 143 | { \ 144 | sprintf(generalmessage, "Dyna compile: memory %08X - %08X", compilerstatus.TempPC, gHWS_pc); \ 145 | RefreshOpList(generalmessage); \ 146 | } 147 | #else 148 | #define DEBUG_PRINT_DYNA_COMPILE_INFO 149 | #endif 150 | #define C_CALL( /* address */ OPCODE) \ 151 | MOV_ImmToReg(1, Reg_EAX, (uint32) /* & */ OPCODE); \ 152 | CALL_Reg(Reg_EAX); 153 | 154 | #ifdef WINDEBUG_1964 155 | #define rc_DYNDEBUG_UPDATE(Inst) \ 156 | /* FlushAllRegisters(); */ \ 157 | MOV_ImmToMemory(1, ModRM_disp32, (_u32) & gHWS_pc, gHWS_pc); \ 158 | MOV_ImmToReg(1, Reg_ECX, Inst); \ 159 | C_CALL((uint32) & WinDynDebugPrintInstruction) 160 | #define DEBUG_BPT(inst) \ 161 | MOV_ImmToReg(1, Reg_ECX, inst); \ 162 | C_CALL((uint32) & HandleBreakpoint); 163 | 164 | #else 165 | #define rc_DYNDEBUG_UPDATE 166 | #define DEBUG_BPT 167 | #endif 168 | #endif 169 | -------------------------------------------------------------------------------- /fileio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/fileio.c -------------------------------------------------------------------------------- /fileio.h: -------------------------------------------------------------------------------- 1 | /*$T fileio.h GC 1.136 03/09/02 15:51:03 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _FILEIO_H__1964_ 24 | #define _FILEIO_H__1964_ 25 | 26 | #include "1964ini.h" 27 | 28 | /* function declarations */ 29 | BOOL ReadRomData(char *RomPath); 30 | long ReadRomHeader(char *RomPath, INI_ENTRY *ini_entry); 31 | long ReadZippedRomHeader(char *RomPath, INI_ENTRY *ini_entry); 32 | BOOL ReadZippedRomData(char *RomPath); 33 | BOOL ByteSwap(uint32 Size, uint8 *Image); 34 | int LoadGNUDistConditions(char *ConditionsBuf); 35 | void FileIO_WriteMemPak(int pak_no); 36 | void FileIO_LoadMemPak(int pak_no); 37 | void FileIO_WriteEEprom(void); 38 | void FileIO_LoadEEprom(void); 39 | void FileIO_WriteFLASHRAM(int, int, int); 40 | void FileIO_ReadFLASHRAM(int, int, int); 41 | void FileIO_SaveState(void); 42 | void FileIO_LoadState(void); 43 | void FileIO_gzSaveState(void); 44 | void FileIO_gzLoadState(void); 45 | void FileIO_gzSaveStateFile(const char *filename); 46 | void FileIO_gzLoadStateFile(const char *filename); 47 | void FileIO_ImportPJ64State(const char *filename); 48 | void FileIO_ExportPJ64State(const char *filename); 49 | BOOL FileIO_Load1964Ini(void); 50 | BOOL FileIO_Write1964Ini(void); 51 | void SwapRomName(uint8 *name); 52 | 53 | extern BOOL Is_Reading_Rom_File; 54 | extern BOOL To_Stop_Reading_Rom_File; 55 | extern void Close_Save(); 56 | #endif 57 | -------------------------------------------------------------------------------- /gamesave.c: -------------------------------------------------------------------------------- 1 | /*$T gamesave.c GC 1.136 03/09/02 17:37:23 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | FlashRAM. Thanks to F|RES and icepir8 for the reversing and info 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #include 25 | #include "r4300i.h" 26 | #include "n64rcp.h" 27 | #include "gamesave.h" 28 | #include "hardware.h" 29 | #include "memory.h" 30 | #include "iPIF.h" 31 | #include "1964ini.h" 32 | #include "fileio.h" 33 | #include "win32/windebug.h" 34 | #include "debug_option.h" 35 | 36 | struct GAMESAVESTATUS gamesave; 37 | 38 | enum { FLASH_NOOP = 0, FLASH_ERASE = 1, FLASH_WRITE = 2, FLASH_STATUS = 3 }; 39 | 40 | DWORD FlashRAM_Mode = FLASH_NOOP; 41 | BOOL dmastatus = TRUE; 42 | char FlashRAM_Buffer[128]; 43 | DWORD FlashRAM_Offset = 0; 44 | DWORD FlashRAM_Status[2]; 45 | 46 | /* 47 | ======================================================================================================================= 48 | ======================================================================================================================= 49 | */ 50 | void Flashram_Init(void) 51 | { 52 | FlashRAM_Mode = FLASH_NOOP; 53 | dmastatus = TRUE; 54 | FlashRAM_Offset = 0; 55 | } 56 | 57 | /* 58 | ======================================================================================================================= 59 | ======================================================================================================================= 60 | */ 61 | void Flashram_Command(unsigned __int32 data) 62 | { 63 | DEBUG_FLASHRAM_TRACE(TRACE1("*** CMD = %08X ***", data)); 64 | switch(data >> 24) 65 | { 66 | case 0x4b: /* Set Erase Block Mode (128 Byte - aligned ) */ 67 | DEBUG_FLASHRAM_TRACE(TRACE0("Flash Erase Mode")); 68 | FlashRAM_Mode = FLASH_ERASE; 69 | FlashRAM_Offset = (data & 0xFFFF) * 128; 70 | break; 71 | 72 | case 0x78: /* Second part of the Erase Block */ 73 | DEBUG_FLASHRAM_TRACE(TRACE0("Flash Erase Block")); 74 | FlashRAM_Status[0] = 0x11118008; 75 | FlashRAM_Status[1] = 0x00c20000; 76 | break; 77 | 78 | /* Init a FlashWrite */ 79 | case 0xb4: 80 | DEBUG_FLASHRAM_TRACE(TRACE0("Flash FlashWrite Init")); 81 | FlashRAM_Mode = FLASH_WRITE; 82 | break; 83 | 84 | /* Sets the Block for the FlashWrite (128 Byte - aligned ) */ 85 | case 0xa5: 86 | DEBUG_FLASHRAM_TRACE(TRACE0("Flash FlashWrite")); 87 | FlashRAM_Offset = (data & 0xFFFF) * 128; 88 | FlashRAM_Status[0] = 0x11118004; 89 | FlashRAM_Status[1] = 0x00c20000; 90 | break; 91 | 92 | case 0xD2: 93 | { /* Flash RAM Execute */ 94 | switch(FlashRAM_Mode) 95 | { 96 | case FLASH_NOOP: 97 | break; 98 | case FLASH_ERASE: 99 | DEBUG_FLASHRAM_TRACE(TRACE1("Executed Erase: %08X", FlashRAM_Offset)); 100 | memset(pLOAD_UBYTE_PARAM_2(0xA8000000) + FlashRAM_Offset, 0xFF, 128); 101 | FileIO_WriteFLASHRAM(0,0,0); //Write to disk 102 | break; 103 | case FLASH_WRITE: 104 | DEBUG_FLASHRAM_TRACE(TRACE1("Executed Write: %08X", FlashRAM_Offset)); 105 | memcpy(pLOAD_UBYTE_PARAM_2(0xA8000000) + FlashRAM_Offset, &FlashRAM_Buffer[0], 128); 106 | FileIO_WriteFLASHRAM(0,0,0); //Write to disk 107 | break; 108 | } 109 | } 110 | break; 111 | case 0xE1: 112 | { /* Set FlashRAM Status */ 113 | DEBUG_FLASHRAM_TRACE(TRACE0("Flash Status")); 114 | FlashRAM_Mode = FLASH_STATUS; 115 | FlashRAM_Status[0] = 0x11118001; 116 | FlashRAM_Status[1] = 0x00c20000; 117 | } 118 | break; 119 | case 0xF0: /* Set FlashRAM Read */ 120 | /* DEBUG_FLASHRAM_TRACE(TRACE0 ("Flash Read")); */ 121 | FlashRAM_Mode = FLASH_NOOP; 122 | FlashRAM_Offset = 0; 123 | FlashRAM_Status[0] = 0x11118004; 124 | FlashRAM_Status[1] = 0xf0000000; 125 | break; 126 | } 127 | } 128 | 129 | /* 130 | ======================================================================================================================= 131 | ======================================================================================================================= 132 | */ 133 | unsigned __int32 Flashram_Get_Status(uint32 addr) 134 | { 135 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 136 | uint32 temp = FlashRAM_Status[addr & 1]; 137 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 138 | 139 | DEBUG_FLASHRAM_TRACE(TRACE2("Reading Flashram status reg at %08X, val=%08X", addr, temp)); 140 | return temp; 141 | } 142 | 143 | /* 144 | ======================================================================================================================= 145 | ======================================================================================================================= 146 | */ 147 | void DMA_Flashram_To_RDRAM(unsigned __int32 rdramaddr, unsigned __int32 flashramaddr, unsigned __int32 len) 148 | { 149 | /* 150 | * DEBUG_FLASHRAM_TRACE(TRACE3("DMA FlashRAM->RDRAM: %08X, %08X, %i", 151 | * flashramaddr, rdramaddr, len)); 152 | */ 153 | 154 | FileIO_ReadFLASHRAM(0,0,0); 155 | 156 | if(FlashRAM_Mode == FLASH_STATUS) 157 | { 158 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 159 | uint8 *rdramoffset = (uint8 *) &gMS_RDRAM[0] + (rdramaddr & 0x007FFFFF); 160 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 161 | 162 | memcpy(rdramoffset, &FlashRAM_Status, len); 163 | DEBUG_FLASHRAM_TRACE(TRACE0("STATUS")); 164 | } 165 | else 166 | { 167 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 168 | uint8 *rdramoffset = (uint8 *) &gMS_RDRAM[0] + (rdramaddr & 0x007FFFFF); 169 | uint8 *flashramoffset = pLOAD_UBYTE_PARAM_2(0x88000000); 170 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 171 | 172 | flashramaddr = (flashramaddr & 0x001FFFF) * 2; 173 | if(flashramaddr < 0x20000) 174 | { 175 | flashramoffset += flashramaddr; 176 | memcpy(rdramoffset, flashramoffset, len); 177 | DEBUG_FLASHRAM_TRACE(TRACE1("READ: %08X", flashramaddr)); 178 | } 179 | else 180 | { 181 | DEBUG_FLASHRAM_TRACE(TRACE1("READ: %08X", flashramaddr)); 182 | } 183 | } 184 | 185 | DEBUG_FLASHRAM_TRACE 186 | ( 187 | TRACE4 188 | ( 189 | "DMA Read flashram: %08X-%08X-08X-08X ...", 190 | MEM_READ_UWORD(rdramaddr), 191 | MEM_READ_UWORD(rdramaddr + 4), 192 | MEM_READ_UWORD(rdramaddr + 8), 193 | MEM_READ_UWORD(rdramaddr + 12) 194 | ) 195 | ); 196 | } 197 | 198 | /* 199 | ======================================================================================================================= 200 | ======================================================================================================================= 201 | */ 202 | void DMA_RDRAM_To_Flashram(unsigned __int32 rdramaddr, unsigned __int32 flashramaddr, unsigned __int32 len) 203 | { 204 | /* 205 | * DEBUG_FLASHRAM_TRACE(TRACE3 ("DMA RDRAM->FlashRAM: %08X, %08X, %i", rdramaddr, 206 | * flashramaddr, len)); 207 | */ 208 | if(gamesave.firstusedsavemedia == 0) gamesave.firstusedsavemedia = FLASHRAM_SAVETYPE; 209 | 210 | FileIO_ReadFLASHRAM(0,0,0); 211 | 212 | if(flashramaddr == 0xA8000000 || flashramaddr == 0x88000000) 213 | { 214 | if(len == 128) /* ok, we are writing into flashram write buffer */ 215 | { 216 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 217 | uint8 *rdramoffset = (uint8 *) &gMS_RDRAM[0] + (rdramaddr & 0x007FFFFF); 218 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 219 | 220 | DEBUG_FLASHRAM_TRACE 221 | ( 222 | TRACE4 223 | ( 224 | "Value in RDRAM: %08X-%08X-%08X-%08X ...", 225 | *(uint32 *) rdramoffset, 226 | *(uint32 *) (rdramoffset + 4), 227 | *(uint32 *) (rdramoffset + 8), 228 | *(uint32 *) (rdramoffset + 12) 229 | ) 230 | ); 231 | memcpy(&FlashRAM_Buffer[0], rdramoffset, 128); 232 | } 233 | else 234 | { 235 | DEBUG_FLASHRAM_TRACE(TRACE1("Warning, Flashram write, len<>128, len=%d", len)); 236 | } 237 | } 238 | else 239 | { 240 | DEBUG_FLASHRAM_TRACE(TRACE1("Warning, Flashram write, addr<>0xA8000000, addr=%8X", flashramaddr)); 241 | } 242 | } 243 | 244 | /* 245 | ======================================================================================================================= 246 | ======================================================================================================================= 247 | */ 248 | void SW_Flashram(unsigned __int32 addr, unsigned __int32 val) 249 | { 250 | /* TRACE2("SW directly to flashram: Addr=%08X, val=%08X", addr, val); */ 251 | } 252 | -------------------------------------------------------------------------------- /gamesave.h: -------------------------------------------------------------------------------- 1 | /*$T gamesave.h GC 1.136 02/28/02 08:00:55 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _GAMESAVE_H__1964_ 24 | #define _GAMESAVE_H__1964_ 25 | 26 | /* SRam */ 27 | #define SRAM_SIZE 0x8000 28 | #define SRAM_MASK 0x7FFF 29 | 30 | /* FlashRam */ 31 | #define FLASHRAM_SIZE 0x20000 32 | #define FLASHRAM_MASK 0x1FFFF 33 | 34 | struct GAMESAVESTATUS 35 | { 36 | BOOL EEprom_used; 37 | BOOL EEprom_written; 38 | BOOL Sram_used; 39 | BOOL Sram_written; 40 | BOOL FlashRam_written; 41 | uint8 EEprom[0x1000]; /* 4KB */ 42 | uint8 SRam[SRAM_SIZE]; /* 0x8000 Bytes */ 43 | int firstusedsavemedia; 44 | uint8 mempak[4][1024 * 32]; /* Define 4 mempak, each one is 32K */ 45 | BOOL mempak_used[4]; /* status of each mempak */ 46 | BOOL mempak_written[4]; /* write status of each mempak. If it is never writen, will not save it */ 47 | }; 48 | extern struct GAMESAVESTATUS gamesave; 49 | 50 | #define FLASHRAM_STATUS_REG_WORD1_ADDR 0xA8000000 51 | #define FLASHRAM_STATUS_REG_WORD2_ADDR 0xA8000004 52 | #define FLASHRAM_COMMAND_REG_ADDR 0xA8010000 53 | #define FLASHRAM_STATUS_REG_1 (LOAD_UWORD_PARAM_2(FLASHRAM_STATUS_REG_WORD1_ADDR)) 54 | #define FLASHRAM_STATUS_REG_2 (LOAD_UWORD_PARAM_2(FLASHRAM_STATUS_REG_WORD2_ADDR)) 55 | 56 | void Flashram_Command(unsigned __int32 val); 57 | unsigned __int32 Flashram_Get_Status(uint32 addr); 58 | 59 | /* 60 | ======================================================================================================================= 61 | Trigger from r4300i opcode LW and SW 62 | ======================================================================================================================= 63 | */ 64 | #define CHECK_FLASHRAM_SW(addr, val) \ 65 | if(addr == FLASHRAM_COMMAND_REG_ADDR) \ 66 | { \ 67 | Flashram_Command(val); \ 68 | return; \ 69 | } 70 | #define CHECK_FLASHRAM_LW(addr) \ 71 | if((addr & 0xFFFFFFF8) == FLASHRAM_STATUS_REG_WORD1_ADDR) \ 72 | { \ 73 | return(Flashram_Get_Status(addr)); \ 74 | } 75 | 76 | /* 77 | * if( addr == FLASHRAM_STATUS_REG_WORD1_ADDR || addr == 78 | * FLASHRAM_STATUS_REG_WORD2_ADDR) \ { \ if( addr == 79 | * FLASHRAM_STATUS_REG_ADDR_WORD2 ) DisplayError("Reading flashram statue word 80 | * 2"); \ reg = Flashram_Get_Status(); \ } 81 | */ 82 | void DMA_Flashram_To_RDRAM(unsigned __int32 rdramaddr, unsigned __int32 flashramaddr, unsigned __int32 len); 83 | void DMA_RDRAM_To_Flashram(unsigned __int32 rdramaddr, unsigned __int32 flashramaddr, unsigned __int32 len); 84 | void SW_Flashram(unsigned __int32 addr, unsigned __int32 val); 85 | 86 | void Flashram_Init(void); 87 | #endif 88 | -------------------------------------------------------------------------------- /globals.c: -------------------------------------------------------------------------------- 1 | /*$T globals.c GC 1.136 02/28/02 08:01:08 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #include "1964ini.h" 24 | #include "windows.h" 25 | #include "./win32/wingui.h" 26 | 27 | char *CURRENT1964VERSION = "1964_085"; 28 | uint32 gAllocationLength; 29 | uint8 HeaderDllPass[0x40]; 30 | volatile int Rom_Loaded = 0; 31 | t_rominfo rominfo; /* Rom information */ 32 | char generalmessage[256]; /* general purpose buffer to display messages */ 33 | int showcursor = 1; 34 | 35 | /* 36 | ======================================================================================================================= 37 | This function should be called if you want to change the cursor status £ 38 | as calling 'ShowCursor' multiple times will glitch and have issues so £ 39 | this prevents the multiple call problem 40 | ======================================================================================================================= 41 | */ 42 | void HideCursor(int state) 43 | { 44 | if(state == TRUE) 45 | { 46 | if(showcursor) 47 | { 48 | ShowCursor(FALSE); 49 | showcursor = 0; 50 | } 51 | } 52 | else 53 | { 54 | if(!showcursor) 55 | { 56 | ShowCursor(TRUE); 57 | showcursor = 1; 58 | } 59 | } 60 | ShowWindow(gui.hStatusBar, guistatus.IsFullScreen || !guioptions.display_statusbar ? SW_HIDE : SW_SHOW); 61 | } 62 | 63 | /* 64 | ======================================================================================================================= 65 | MSVC doesn't have strnstr() yet so let's add it here 66 | ======================================================================================================================= 67 | */ 68 | __forceinline uint32 strnlen(const char *needle, uint32 len) 69 | { 70 | const char *pStr = needle; 71 | 72 | while (((len--) > 0) && (*pStr != '\0')) 73 | { 74 | pStr++; 75 | } 76 | return (pStr-needle); 77 | } 78 | 79 | char *strnstr(const char *haystack, const char *needle, uint32 len) 80 | { 81 | int i; 82 | uint32 needle_len; 83 | 84 | if ((needle_len = strnlen(needle, len)) == 0) 85 | return (char *)haystack; 86 | 87 | for (i=0; i<=(int)(len-needle_len); i++) 88 | { 89 | if ((haystack[0] == needle[0]) && 90 | (0 == strncmp(haystack, needle, needle_len))) 91 | return (char *)haystack; 92 | 93 | haystack++; 94 | } 95 | return NULL; 96 | } -------------------------------------------------------------------------------- /hardware.h: -------------------------------------------------------------------------------- 1 | /*$T hardware.h GC 1.136 02/28/02 08:03:01 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | The structures for the ultra processors and memory 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #ifndef _HARDWARE_H__1964_ 25 | #define _HARDWARE_H__1964_ 26 | 27 | typedef int BOOL; 28 | 29 | #include "globals.h" /* loads the rom and handle endian stuff */ 30 | 31 | /* 32 | ----------------------------------------------------------------------------------------------------------------------- 33 | includes for all Hardware parts 34 | ----------------------------------------------------------------------------------------------------------------------- 35 | */ 36 | typedef struct sHardwareState 37 | { 38 | _int64 GPR[34]; /* General Purpose Registers GPR[32] = lo, GPR[33] = hi */ 39 | uint32 COP0Reg[32]; /* Coprocessor0 Registers */ 40 | uint32 fpr32[64]; /* 32bit 64 items needed! */ 41 | uint32 LLbit; /* LoadLinked Bit */ 42 | uint32 pc; /* program counter */ 43 | uint32 COP1Con[32]; /* FPControl Registers, only 0 and 31 is used */ 44 | uint32 COP0Con[64]; /* FPControl Registers */ 45 | uint32 RememberFprHi[32]; 46 | uint32 code; /* The instruction */ 47 | } HardwareState; 48 | 49 | extern HardwareState gHardwareState; 50 | extern HardwareState *p_gHardwareState; 51 | 52 | #define HARDWARESTATE_SIZE (sizeof(HardwareState)) 53 | #define MAXTLB 32 54 | 55 | typedef struct 56 | { 57 | uint32 valid; 58 | uint32 EntryHi; 59 | uint32 EntryLo1; 60 | uint32 EntryLo0; 61 | uint64 PageMask; 62 | uint32 LoCompare; 63 | uint32 MyHiMask; 64 | } tlb_struct; 65 | 66 | typedef struct sMemorySTATE 67 | { 68 | uint32 *ramRegs0; 69 | uint32 *ramRegs4; 70 | uint32 *ramRegs8; 71 | uint32 *SP_MEM; 72 | uint32 *SP_REG_1; 73 | uint32 *SP_REG_2; 74 | uint32 *DPC; 75 | uint32 *DPS; 76 | uint32 *MI; 77 | uint32 *VI; 78 | uint32 *AI; 79 | uint32 *PI; 80 | uint32 *RI; 81 | uint32 *SI; 82 | uint8 *RDRAM; /* Size = 4MB */ 83 | uint32 *C2A1; 84 | uint32 *C1A1; 85 | uint32 *C1A3; 86 | uint32 *C2A2; 87 | uint8 *ROM_Image; 88 | uint32 *GIO_REG; 89 | uint8 *PIF; 90 | uint8 *ExRDRAM; /* Size = 4MB */ 91 | uint8 *dummyNoAccess; /* handles crap pointers for now..band-aid'ish */ 92 | uint8 *dummyReadWrite; /* handles crap pointers for now..band-aid'ish */ 93 | uint8 *dummyAllZero; /* handles crap pointers for all zeros */ 94 | tlb_struct TLB[MAXTLB]; 95 | } MemoryState; 96 | 97 | extern MemoryState gMemoryState; 98 | extern MemoryState *p_gMemoryState; 99 | #define OP_PARAMS HardwareState * reg 100 | #define PASS_PARAMS reg 101 | 102 | #define __LO 32 103 | #define __HI 33 104 | 105 | #define _r0 0 106 | #define _at 1 107 | #define _v0 2 108 | #define _v1 3 109 | #define _a0 4 110 | #define _a1 5 111 | #define _a2 6 112 | #define _a3 7 113 | #define _t0 8 114 | #define _t1 9 115 | #define _t2 10 116 | #define _t3 11 117 | #define _t4 12 118 | #define _t5 13 119 | #define _t6 14 120 | #define _t7 15 121 | #define _s0 16 122 | #define _s1 17 123 | #define _s2 18 124 | #define _s3 19 125 | #define _s4 20 126 | #define _s5 21 127 | #define _s6 22 128 | #define _s7 23 129 | #define _t8 24 130 | #define _t9 25 131 | #define _k0 26 132 | #define _k1 27 133 | #define _gp 28 134 | #define _sp 29 135 | #define __s8 30 136 | #define _ra 31 137 | #endif 138 | -------------------------------------------------------------------------------- /hle.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/hle.c -------------------------------------------------------------------------------- /hle.h: -------------------------------------------------------------------------------- 1 | extern int Instruction_Order[]; // Return pointer to the compiled block 2 | extern void RecompileFunction(void); 3 | extern void osEnqueueAndYield(void); //Mario(US) 80327c80 4 | extern void osSendMessage(void); 5 | extern void osDisableInt(void); //Mario(US) 803274d0 6 | extern void osRestoreInt(void); //Mario(US) 803274f0 7 | extern void osPopThread(void); //Mario(US) 80327d58 8 | extern void osDispatchThread(void); //Mario(US) 80327d68 9 | 10 | 11 | #define _r0 0 12 | #define _at 1 13 | #define _v0 2 14 | #define _v1 3 15 | #define _a0 4 16 | #define _a1 5 17 | #define _a2 6 18 | #define _a3 7 19 | #define _t0 8 20 | #define _t1 9 21 | #define _t2 10 22 | #define _t3 11 23 | #define _t4 12 24 | #define _t5 13 25 | #define _t6 14 26 | #define _t7 15 27 | 28 | #define _s0 16 29 | #define _s1 17 30 | #define _s2 18 31 | #define _s3 19 32 | #define _s4 20 33 | #define _s5 21 34 | #define _s6 22 35 | #define _s7 23 36 | #define _t8 24 37 | #define _t9 25 38 | #define _k0 26 39 | #define _k1 27 40 | #define _gp 28 41 | #define _sp 29 42 | #define __s8 30 43 | #define _ra 31 44 | 45 | #define _r0_ ebp-128 46 | #define _at_ ebp-120 47 | #define _v0_ ebp-112 48 | #define _v1_ ebp-104 49 | #define _a0_ ebp-96 50 | #define _a1_ ebp-88 51 | #define _a2_ ebp-80 52 | #define _a3_ ebp-72 53 | #define _t0_ ebp-64 54 | #define _t1_ ebp-56 55 | #define _t2_ ebp-48 56 | #define _t3_ ebp-40 57 | #define _t4_ ebp-32 58 | #define _t5_ ebp-24 59 | #define _t6_ ebp-16 60 | #define _t7_ ebp-8 61 | 62 | #define _s0_ ebp 63 | #define _s1_ ebp+8 64 | #define _s2_ ebp+16 65 | #define _s3_ ebp+24 66 | #define _s4_ ebp+32 67 | #define _s5_ ebp+40 68 | #define _s6_ ebp+48 69 | #define _s7_ ebp+56 70 | #define _t8_ ebp+64 71 | #define _t9_ ebp+72 72 | #define _k0_ ebp+80 73 | #define _k1_ ebp+88 74 | #define _gp_ ebp+96 75 | #define _sp_ ebp+104 76 | #define _s8_ ebp+112 77 | #define _ra_ ebp+120 78 | 79 | #define _status_ gHardwareState+320 80 | #define _COP1Con31_ gHardwareState+788 81 | 82 | #define _f0_lo_ gHardwareState+400 83 | #define _f0_hi_ gHardwareState+404 84 | #define _f1_lo_ gHardwareState+408 85 | #define _f1_hi_ gHardwareState+412 86 | #define _f2_lo_ gHardwareState+416 87 | #define _f2_hi_ gHardwareState+420 88 | #define _f3_lo_ gHardwareState+424 89 | #define _f3_hi_ gHardwareState+428 90 | #define _f4_lo_ gHardwareState+432 91 | #define _f4_hi_ gHardwareState+436 92 | #define _f5_lo_ gHardwareState+440 93 | #define _f5_hi_ gHardwareState+444 94 | #define _f6_lo_ gHardwareState+448 95 | #define _f6_hi_ gHardwareState+452 96 | #define _f7_lo_ gHardwareState+456 97 | #define _f7_hi_ gHardwareState+460 98 | #define _f8_lo_ gHardwareState+464 99 | #define _f8_hi_ gHardwareState+468 100 | #define _f9_lo_ gHardwareState+472 101 | #define _f9_hi_ gHardwareState+476 102 | #define _f10_lo_ gHardwareState+480 103 | #define _f10_hi_ gHardwareState+484 104 | #define _f11_lo_ gHardwareState+488 105 | #define _f11_hi_ gHardwareState+492 106 | #define _f12_lo_ gHardwareState+496 107 | #define _f12_hi_ gHardwareState+500 108 | #define _f13_lo_ gHardwareState+504 109 | #define _f13_hi_ gHardwareState+508 110 | #define _f14_lo_ gHardwareState+512 111 | #define _f14_hi_ gHardwareState+516 112 | #define _f15_lo_ gHardwareState+520 113 | #define _f15_hi_ gHardwareState+524 114 | #define _f16_lo_ gHardwareState+528 115 | #define _f16_hi_ gHardwareState+532 116 | #define _f17_lo_ gHardwareState+536 117 | #define _f17_hi_ gHardwareState+540 118 | #define _f18_lo_ gHardwareState+544 119 | #define _f18_hi_ gHardwareState+548 120 | #define _f19_lo_ gHardwareState+552 121 | #define _f19_hi_ gHardwareState+556 122 | #define _f20_lo_ gHardwareState+560 123 | #define _f20_hi_ gHardwareState+564 124 | #define _f21_lo_ gHardwareState+568 125 | #define _f21_hi_ gHardwareState+572 126 | #define _f22_lo_ gHardwareState+576 127 | #define _f22_hi_ gHardwareState+580 128 | #define _f23_lo_ gHardwareState+584 129 | #define _f23_hi_ gHardwareState+588 130 | #define _f24_lo_ gHardwareState+592 131 | #define _f24_hi_ gHardwareState+596 132 | #define _f25_lo_ gHardwareState+600 133 | #define _f25_hi_ gHardwareState+604 134 | #define _f26_lo_ gHardwareState+608 135 | #define _f26_hi_ gHardwareState+612 136 | #define _f27_lo_ gHardwareState+616 137 | #define _f27_hi_ gHardwareState+620 138 | #define _f28_lo_ gHardwareState+624 139 | #define _f28_hi_ gHardwareState+628 140 | #define _f29_lo_ gHardwareState+632 141 | #define _f29_hi_ gHardwareState+636 142 | #define _f30_lo_ gHardwareState+640 143 | #define _f30_hi_ gHardwareState+644 144 | #define _f31_lo_ gHardwareState+648 145 | #define _f31_hi_ gHardwareState+652 146 | -------------------------------------------------------------------------------- /iPIF.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/iPIF.c -------------------------------------------------------------------------------- /iPIF.h: -------------------------------------------------------------------------------- 1 | /*$T iPIF.h GC 1.136 02/28/02 08:16:35 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef __PIF_H 24 | #define __PIF_H 25 | 26 | #define PIF_RAM_PHYS 0x7C0 27 | #define IPIF_EXIT 6 28 | 29 | typedef struct 30 | { 31 | int enabled; 32 | int mempak; 33 | int use_mempak; 34 | } t_controller; 35 | 36 | void Init_iPIF(void); 37 | void Close_iPIF(void); 38 | void iPifCheck(void); 39 | 40 | void ReadControllerPak(int device, char *cmd); 41 | void WriteControllerPak(int device, char *cmd); 42 | int ControllerCommand(unsigned __int8 *cmd, int device); 43 | 44 | void ReadEEprom(char *dest, long offset); 45 | void WriteEEprom(char *src, long offset); 46 | int EEpromCommand(unsigned __int8 *cmd, int device); 47 | 48 | void LogPIFData(char *data, int input); 49 | #endif 50 | -------------------------------------------------------------------------------- /interrupt.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/interrupt.c -------------------------------------------------------------------------------- /interrupt.h: -------------------------------------------------------------------------------- 1 | /*$T interrupt.h GC 1.136 03/09/02 17:29:14 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | Some interrupt flag macros here 7 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 | */ 9 | 10 | 11 | /* 12 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 13 | * program is free software; you can redistribute it and/or modify it under the 14 | * terms of the GNU General Public License as published by the Free Software 15 | * Foundation; either version 2 of the License, or (at your option) any later 16 | * version. This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 | * details. You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software Foundation, Inc., 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 22 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 23 | */ 24 | #ifndef _INTERRUPT_H__1964_ 25 | #define _INTERRUPT_H__1964_ 26 | 27 | #define MI_INTR_SP 0x00000001 28 | #define MI_INTR_SI 0x00000002 29 | #define MI_INTR_AI 0x00000004 30 | #define MI_INTR_VI 0x00000008 31 | #define MI_INTR_PI 0x00000010 32 | #define MI_INTR_DP 0x00000020 33 | #define NOT_MI_INTR_SP 0xFFFFFFFE 34 | #define NOT_MI_INTR_SI 0xFFFFFFFD 35 | #define NOT_MI_INTR_AI 0xFFFFFFFB 36 | #define NOT_MI_INTR_VI 0xFFFFFFF7 37 | #define NOT_MI_INTR_PI 0xFFFFFFEF 38 | #define NOT_MI_INTR_DP 0xFFFFFFDF 39 | #define MI_INTR_MASK_SP 0x01 /* Bit 0: SP intr mask */ 40 | #define MI_INTR_MASK_SI 0x02 /* Bit 1: SI intr mask */ 41 | #define MI_INTR_MASK_AI 0x04 /* Bit 2: AI intr mask */ 42 | #define MI_INTR_MASK_VI 0x08 /* Bit 3: VI intr mask */ 43 | #define MI_INTR_MASK_PI 0x10 /* Bit 4: PI intr mask */ 44 | #define MI_INTR_MASK_DP 0x20 /* Bit 5: DP intr mask */ 45 | #define MI_INTR_MASK_SP_CLR 0x01 46 | #define MI_INTR_MASK_SI_CLR 0x04 47 | #define MI_INTR_MASK_AI_CLR 0x10 48 | #define MI_INTR_MASK_VI_CLR 0x40 49 | #define MI_INTR_MASK_PI_CLR 0x100 50 | #define MI_INTR_MASK_DP_CLR 0x400 51 | #define MI_INTR_MASK_SP_SET 0x02 52 | #define MI_INTR_MASK_SI_SET 0x08 53 | #define MI_INTR_MASK_AI_SET 0x20 54 | #define MI_INTR_MASK_VI_SET 0x80 55 | #define MI_INTR_MASK_PI_SET 0x200 56 | #define MI_INTR_MASK_DP_SET 0x800 57 | 58 | /* values read from the mi mode register */ 59 | #define MI_MODE_INIT 0x0080 60 | #define MI_MODE_EBUS 0x0100 61 | #define MI_MODE_RDRAM 0x0200 62 | 63 | /* values written to the mi mode register */ 64 | #define MI_CLR_INIT 0x0080 65 | #define MI_SET_INIT 0x0100 66 | #define MI_CLR_EBUS 0x0200 67 | #define MI_SET_EBUS 0x0400 68 | #define MI_CLR_DP_INTR 0x0800 69 | #define MI_CLR_RDRAM 0x1000 70 | #define MI_SET_RDRAM 0x2000 71 | 72 | /* SP_STATUS_REG read bits */ 73 | #define SP_STATUS_HALT 0x0001 74 | #define SP_STATUS_BROKE 0x0002 75 | #define SP_STATUS_DMA_BUSY 0x0004 76 | #define SP_STATUS_DMA_FULL 0x0008 77 | #define SP_STATUS_IO_FULL 0x0010 78 | #define SP_STATUS_SSTEP 0x0020 79 | #define SP_STATUS_INTR_BREAK 0x0040 80 | #define SP_STATUS_YIELD 0x0080 81 | #define SP_STATUS_YIELDED 0x0100 82 | #define SP_STATUS_TASKDONE 0x0200 83 | #define SP_STATUS_SIG3 0x0400 84 | #define SP_STATUS_SIG4 0x0800 85 | #define SP_STATUS_SIG5 0x1000 86 | #define SP_STATUS_SIG6 0x2000 87 | #define SP_STATUS_SIG7 0x4000 88 | 89 | /* SP_STATUS_REG write bits */ 90 | #define SP_CLR_HALT 0x0000001 91 | #define SP_SET_HALT 0x0000002 92 | #define SP_CLR_BROKE 0x0000004 93 | #define SP_CLR_INTR 0x0000008 94 | #define SP_SET_INTR 0x0000010 95 | #define SP_CLR_SSTEP 0x0000020 96 | #define SP_SET_SSTEP 0x0000040 97 | #define SP_CLR_INTR_BREAK 0x0000080 98 | #define SP_SET_INTR_BREAK 0x0000100 99 | #define SP_CLR_YIELD 0x0000200 100 | #define SP_SET_YIELD 0x0000400 101 | #define SP_CLR_YIELDED 0x0000800 102 | #define SP_SET_YIELDED 0x0001000 103 | #define SP_CLR_TASKDONE 0x0002000 104 | #define SP_SET_TASKDONE 0x0004000 105 | #define SP_CLR_SIG3 0x0008000 106 | #define SP_SET_SIG3 0x0010000 107 | #define SP_CLR_SIG4 0x0020000 108 | #define SP_SET_SIG4 0x0040000 109 | #define SP_CLR_SIG5 0x0080000 110 | #define SP_SET_SIG5 0x0100000 111 | #define SP_CLR_SIG6 0x0200000 112 | #define SP_SET_SIG6 0x0400000 113 | #define SP_CLR_SIG7 0x0800000 114 | #define SP_SET_SIG7 0x1000000 115 | 116 | /* DPC_STATUS_REG read bits */ 117 | #define DPC_STATUS_XBUS_DMEM_DMA 0x0000001 118 | #define DPC_STATUS_FREEZE 0x0000002 119 | #define DPC_STATUS_FLUSH 0x0000004 120 | 121 | /* DPC_STATUS_REG write bits */ 122 | #define DPC_CLR_XBUS_DMEM_DMA 0x0000001 123 | #define DPC_SET_XBUS_DMEM_DMA 0x0000002 124 | #define DPC_CLR_FREEZE 0x0000004 125 | #define DPC_SET_FREEZE 0x0000008 126 | #define DPC_CLR_FLUSH 0x0000010 127 | #define DPC_SET_FLUSH 0x0000020 128 | #define DPC_CLR_TMEM_REG 0x0000040 129 | #define DPC_CLR_PIPEBUSY_REG 0x0000080 130 | #define DPC_CLR_BUFBUSY_REG 0x0000100 131 | #define DPC_CLR_CLOCK_REG 0x0000200 132 | 133 | #define IE 0x00000001 134 | #define EXL 0x00000002 135 | #define ERL 0x00000004 136 | #define EXL_OR_ERL 0x00000006 137 | #define BD 0x80000000 138 | #define NOT_BD 0x7FFFFFFF 139 | #define BEV 0x00400000 140 | 141 | /* 142 | ======================================================================================================================= 143 | Cause register exception codes 144 | ======================================================================================================================= 145 | */ 146 | #define EXC_CODE(x) ((x) << 2) 147 | 148 | /* Hardware exception codes */ 149 | #define EXC_INT EXC_CODE(0) /* interrupt */ 150 | #define EXC_MOD EXC_CODE(1) /* TLB mod */ 151 | #define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */ 152 | #define TLBL_Miss EXC_RMISS 153 | #define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */ 154 | #define TLBS_Miss EXC_WMISS 155 | #define EXC_RADE EXC_CODE(4) /* Read Address Error */ 156 | #define EXC_WADE EXC_CODE(5) /* Write Address Error */ 157 | #define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */ 158 | #define EXC_DBE EXC_CODE(7) /* Data Bus Error */ 159 | #define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */ 160 | #define EXC_BREAK EXC_CODE(9) /* BREAKpoint */ 161 | #define EXC_II EXC_CODE(10) /* Illegal Instruction */ 162 | #define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */ 163 | #define EXC_OV EXC_CODE(12) /* OVerflow */ 164 | #define EXC_TRAP EXC_CODE(13) /* Trap exception */ 165 | #define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */ 166 | #define EXC_FPE EXC_CODE(15) /* Floating Point Exception */ 167 | #define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */ 168 | #define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */ 169 | 170 | #define EXCCODE 0x7C 171 | #define NOT_EXCCODE 0xFFFFFF83 172 | 173 | #define SET_EXCEPTION(exception) { gHWS_COP0Reg[CAUSE] &= NOT_EXCCODE; gHWS_COP0Reg[CAUSE] |= exception; } 174 | 175 | void CheckInterrupts(void); 176 | void __cdecl printlist(char *Message, ...); 177 | void Dbg_Handle_SP(unsigned __int32 value); 178 | void WriteMI_ModeReg(unsigned __int32 value); 179 | void Handle_MI(unsigned __int32 value); 180 | void Handle_SP(unsigned __int32 value); 181 | void Handle_MI(unsigned __int32 value); 182 | void Handle_DPC(unsigned __int32 value); 183 | void RunSPTask(void); 184 | void Trigger_RSPBreak(void); 185 | void Trigger_SPInterrupt(void); 186 | void Trigger_VIInterrupt(void); 187 | void Trigger_AIInterrupt(void); 188 | void Trigger_DPInterrupt(void); 189 | void Trigger_PIInterrupt(void); 190 | void Trigger_SIInterrupt(void); 191 | void Trigger_CompareInterrupt(void); 192 | void Trigger_Address_Error_Exception(unsigned __int32 addr, char *opcode, int exception); 193 | void Trigger_Interrupt_Without_Mask(unsigned __int32 interrupt); 194 | void EnableFPUUnusableException(void); 195 | void DisableFPUUnusableException(void); 196 | void TriggerFPUUnusableException(void); 197 | void Clear_MIInterrupt(uint32); 198 | void HandleInterrupts(unsigned __int32 vt); 199 | void HandleExceptions(unsigned __int32 evt); 200 | #endif 201 | -------------------------------------------------------------------------------- /memory.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/memory.c -------------------------------------------------------------------------------- /memory.h: -------------------------------------------------------------------------------- 1 | /*$T memory.h GC 1.136 02/28/02 08:04:48 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _MEMORY_H__1964_ 24 | #define _MEMORY_H__1964_ 25 | 26 | #include "globals.h" 27 | #include "hardware.h" 28 | 29 | uint8 *dynarommap[0x10000]; 30 | 31 | #define SP_START_ADDR 0x04000000 32 | #define SP_END 0x04080007 33 | #define SP_SIZE (SP_END - SP_START_ADDR + 1) 34 | 35 | void Init_R_AND_W(uint8 **sDWORD_R, uint8 *MemoryRange, uint32 startAddress, uint32 endAddress); 36 | void DynInit_R_AND_W(uint8 *MemoryRange, uint32 startAddress, uint32 endAddress); 37 | void InitMemoryLookupTables(void); 38 | void InitVirtualMemory(void); 39 | void InitVirtualMemory1(MemoryState *gMemoryState); 40 | void FreeVirtualMemory(void); 41 | void InitVirtualRomMemory(uint32 filesize); 42 | void FreeVirtualRomMemory(void); 43 | void ResetRdramSize(int setsize); 44 | BOOL UnmappedMemoryExceptionHelper(uint32 addr); 45 | BOOL ProtectBlock(uint32 pc); 46 | BOOL UnprotectBlock(uint32 pc); 47 | void UnprotectAllBlocks(void); 48 | void ROM_CheckSumZelda(void); 49 | void ROM_CheckSumMario(void); 50 | 51 | extern uint32 current_rdram_size; 52 | 53 | /* Memory segment size definition */ 54 | #define MEMORY_SIZE_RDRAM 0x400000 55 | #define MEMORY_SIZE_EXRDRAM 0x400000 56 | #define MEMORY_SIZE_NO_EXPANSION 0x400000 57 | #define MEMORY_SIZE_WITH_EXPANSION 0x800000 58 | #define MEMORY_SIZE_NO_EXPANSION_MASK 0x3FFFFF 59 | #define MEMORY_SIZE_WITH_EXPANSION_MASK 0x7FFFFF 60 | #define MEMORY_SIZE_RAMREGS0 0x30 61 | #define MEMORY_SIZE_RAMREGS4 0x30 62 | #define MEMORY_SIZE_RAMREGS8 0x30 63 | #define MEMORY_SIZE_SPMEM 0x2000 64 | #define MEMORY_SIZE_SPREG_1 0x24 65 | #define MEMORY_SIZE_SPREG_2 0x8 66 | #define MEMORY_SIZE_DPC 0x20 67 | #define MEMORY_SIZE_DPS 0x10 68 | #define MEMORY_SIZE_MI 0x10 69 | #define MEMORY_SIZE_VI 0x50 70 | #define MEMORY_SIZE_AI 0x18 71 | #define MEMORY_SIZE_PI 0x4C 72 | #define MEMORY_SIZE_RI 0x20 73 | #define MEMORY_SIZE_SI 0x1C 74 | #define MEMORY_SIZE_C2A1 0x8000 75 | #define MEMORY_SIZE_C1A1 0x8000 76 | #define MEMORY_SIZE_C2A2 0x20000 77 | #define MEMORY_SIZE_GIO_REG 0x804 78 | #define MEMORY_SIZE_C1A3 0x8000 79 | #define MEMORY_SIZE_PIF 0x800 80 | #define MEMORY_SIZE_DUMMY 0x10000 81 | 82 | /* Memory masks */ 83 | #define ADDRESS_MASK_C2A1 0x00007FFF /* 32KB SRAM start at 0x05000000 */ 84 | #define ADDRESS_MASK_C1A1 0x00007FFF /* 32KB SRAM start at 0x06000000 */ 85 | #define ADDRESS_MASK_C2A2 0x0001FFFF /* 128KB FLASHRAM/SRAM start at 0x08000000 */ 86 | 87 | /* define ADDRESS_MASK_C2A2 0x00007FFF // 128KB FLASHRAM/SRAM start at 0x08000000 */ 88 | #define ADDRESS_MASK_C1A3 0x00007FFF /* 32KB SRAM start at 0x1FD00000 */ 89 | 90 | /* Memory segment start address / end address definition */ 91 | #define MEMORY_START_RDRAM 0x00000000 92 | #define MEMORY_START_EXRDRAM 0x00400000 93 | 94 | /* define MEMORY_START_RDREG 0x03F00000 */ 95 | #define MEMORY_START_RAMREGS0 0x03F00000 96 | #define MEMORY_START_RAMREGS4 0x03F04000 97 | #define MEMORY_START_RAMREGS8 0x03F80000 98 | #define MEMORY_START_SPMEM 0x04000000 99 | #define MEMORY_START_SPREG_1 0x04040000 100 | #define MEMORY_START_SPREG_2 0x04080000 101 | #define MEMORY_START_DPC 0x04100000 102 | #define MEMORY_START_DPS 0x04200000 103 | #define MEMORY_START_MI 0x04300000 104 | #define MEMORY_START_VI 0x04400000 105 | #define MEMORY_START_AI 0x04500000 106 | #define MEMORY_START_PI 0x04600000 107 | #define MEMORY_START_RI 0x04700000 108 | #define MEMORY_START_SI 0x04800000 109 | #define MEMORY_START_C2A1 0x05000000 110 | #define MEMORY_START_C1A1 0x06000000 111 | #define MEMORY_START_C2A2 0x08000000 112 | #define MEMORY_START_ROM_IMAGE 0x10000000 113 | #define MEMORY_START_GIO 0x18000000 114 | #define MEMORY_START_PIF 0x1FC00000 115 | #define MEMORY_START_C1A3 0x1FD00000 116 | #define MEMORY_START_DUMMY 0x1FFF0000 117 | 118 | /* 119 | * These shift macros are to reduce the memory functions array size to use less 120 | * memory and presumably to use the cache better for more speed. It is probably a 121 | * good idea to use indexing to reduce cache misses during address translation. 122 | * Cache miss can be 50-80 cycles. 123 | */ 124 | #define SHIFTER1_READ 2 /* Shifts off insignificant bits from memory_read_functions array size. The 125 | * significant bits are 0xFFFC0000 (14 significant bits) because Check_LW needs 126 | * to check SPREG_1, which is at 0xA4040000. So we only need 14bit instead of 127 | * 16bit. */ 128 | #define SHIFTER1_WRITE 0 /* Shifts off insignificant bits from memory write functions array size. Set to 129 | * zero because of protected memory in 0x1000 blocks. = All bits are 130 | * significant. */ 131 | 132 | #define SHIFTER2_READ (16 + SHIFTER1_READ) 133 | #define SHIFTER2_WRITE (12 + SHIFTER1_WRITE) 134 | 135 | extern uint32 * (*memory_read_functions[0x10000 >> SHIFTER1_READ]) (); 136 | extern uint32 * (*memory_write_functions[0x100000 >> SHIFTER1_WRITE]) (uint32 addr); 137 | extern uint32 write_mem_rt; 138 | 139 | uint32 *read_mem_rdram(uint32 addr); 140 | uint32 *read_mem_cart(uint32 addr); 141 | uint32 *read_mem_io(uint32 addr); 142 | uint32 *read_mem_flashram(uint32 addr); 143 | uint32 *read_mem_sram(uint32 addr); 144 | uint32 *read_mem_tlb(uint32 addr); 145 | uint32 *read_mem_unmapped(uint32 addr); 146 | uint32 *read_mem_others(uint32 addr); 147 | uint32 *write_mem_rdram(uint32 addr); 148 | uint32 *write_mem_cart(uint32 addr); 149 | uint32 *write_mem_io(uint32 addr); 150 | uint32 *write_mem_flashram(uint32 addr); 151 | uint32 *write_mem_sram(uint32 addr); 152 | uint32 *write_mem_tlb(uint32 addr); 153 | uint32 *write_mem_unmapped(uint32 addr); 154 | uint32 *write_mem_others(uint32 addr); 155 | uint32 *write_mem_protected(uint32 addr); 156 | void init_whole_mem_func_array(void); 157 | void enable_exrdram_func_array(void); 158 | void disable_exrdram_func_array(void); 159 | void protect_memory_set_func_array(uint32 pc); 160 | void unprotect_memory_set_func_array(uint32 pc); 161 | uint32 *mem_read_eax_only_helper(uint32 addr); 162 | 163 | BOOL rdram_is_at_0x20000000; 164 | 165 | #define MEM_READ_SWORD(addr) *(_int32 *) (mem_read_eax_only_helper(addr)) 166 | #define MEM_READ_UWORD(addr) *(uint32 *) (mem_read_eax_only_helper(addr)) 167 | #define MEM_READ_SBYTE(addr) *(_int8 *) (mem_read_eax_only_helper(addr ^ 3)) 168 | #define MEM_READ_UBYTE(addr) *(uint8 *) (mem_read_eax_only_helper(addr ^ 3)) 169 | #define MEM_READ_SHALFWORD(addr) *(_int16 *) (mem_read_eax_only_helper(addr ^ 2)) 170 | #define MEM_READ_UHALFWORD(addr) *(uint16 *) (mem_read_eax_only_helper(addr ^ 2)) 171 | #define PMEM_READ_SWORD(addr) (_int32 *) (mem_read_eax_only_helper(addr)) 172 | #define PMEM_READ_UWORD(addr) (uint32 *) (mem_read_eax_only_helper(addr)) 173 | #define PMEM_WRITE_SWORD(addr) ((_int32 *) (*memory_write_functions[(uint32) addr >> SHIFTER2_WRITE]) (addr)) 174 | #define PMEM_WRITE_UWORD(addr) ((uint32 *) (*memory_write_functions[(uint32) addr >> SHIFTER2_WRITE]) (addr)) 175 | #define PMEM_WRITE_UHALFWORD(addr) ((uint16 *) (*memory_write_functions[(uint32) addr >> SHIFTER2_WRITE]) ((addr ^ 2))) 176 | #define PMEM_WRITE_UBYTE(addr) ((uint8 *) (*memory_write_functions[(uint32) addr >> SHIFTER2_WRITE]) ((addr ^ 3))) 177 | #include "dynarec/opcodeDebugger.h" 178 | void Debugger_Copy_Memory(MemoryState *target, MemoryState *source); 179 | #endif 180 | -------------------------------------------------------------------------------- /memory2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/memory2.c -------------------------------------------------------------------------------- /n64rcp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/n64rcp.c -------------------------------------------------------------------------------- /n64rcp.h: -------------------------------------------------------------------------------- 1 | /*$T n64rcp.h GC 1.136 02/28/02 08:11:31 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _N64RCP_H__1964_ 24 | #define _N64RCP_H__1964_ 25 | 26 | #include "globals.h" 27 | #include "memory.h" 28 | 29 | #define NUMBEROFRDRAMREG 10 30 | #define RDRAM_CONFIG_REG gMS_ramRegs0[0] 31 | #define RDRAM_DEVICE_ID_REG gMS_ramRegs0[1] 32 | #define RDRAM_DELAY_REG gMS_ramRegs0[2] 33 | #define RDRAM_MODE_REG gMS_ramRegs0[3] 34 | #define RDRAM_REF_INTERVAL_REG gMS_ramRegs0[4] 35 | #define RDRAM_REF_ROW_REG gMS_ramRegs0[5] 36 | #define RDRAM_RAS_INTERVAL_REG gMS_ramRegs0[6] 37 | #define RDRAM_MIN_INTERVAL_REG gMS_ramRegs0[7] 38 | #define RDRAM_ADDR_SELECT_REG gMS_ramRegs0[8] 39 | #define RDRAM_DEVICE_MANUF_REG gMS_ramRegs0[9] 40 | 41 | #define SP_DMEM_START 0x04000000 /* read/write */ 42 | #define SP_DMEM_END 0x04000FFF 43 | #define SP_IMEM_START 0x04001000 /* read/write */ 44 | #define SP_IMEM_END 0x04001FFF 45 | 46 | #define SP_DMEM gMS_SP_MEM[0] 47 | #define SP_IMEM gMS_SP_MEM[0x400] 48 | #define SP_MEM_ADDR_REG gMS_SP_REG_1[0x0] 49 | #define SP_DRAM_ADDR_REG gMS_SP_REG_1[0x1] 50 | #define SP_RD_LEN_REG gMS_SP_REG_1[0x2] 51 | #define SP_WR_LEN_REG gMS_SP_REG_1[0x3] 52 | #define SP_STATUS_REG gMS_SP_REG_1[0x4] 53 | #define SP_DMA_FULL_REG gMS_SP_REG_1[0x5] 54 | #define SP_DMA_BUSY_REG gMS_SP_REG_1[0x6] 55 | #define SP_SEMAPHORE_REG gMS_SP_REG_1[0x7] 56 | #define SP_PC_REG gMS_SP_REG_2[0x0] 57 | #define SP_IBIST_REG gMS_SP_REG_2[0x1] 58 | #define HLE_DMEM_TASK gMS_SP_MEM[0x03F0] 59 | #define NUMBEROFSPREG 8 60 | 61 | #define DPC_START_REG gMS_DPC[0] 62 | #define DPC_END_REG gMS_DPC[1] 63 | #define DPC_CURRENT_REG gMS_DPC[2] 64 | #define DPC_STATUS_REG gMS_DPC[3] 65 | #define DPC_CLOCK_REG gMS_DPC[4] 66 | #define DPC_BUFBUSY_REG gMS_DPC[5] 67 | #define DPC_PIPEBUSY_REG gMS_DPC[6] 68 | #define DPC_TMEM_REG gMS_DPC[7] 69 | #define NUMBEROFDPREG 8 70 | 71 | #define DPS_TBIST_REG gMS_DPS[0] 72 | #define DPS_TEST_MODE_REG gMS_DPS[1] 73 | #define DPS_BUFTEST_ADDR_REG gMS_DPS[2] 74 | #define DPS_BUFTEST_DATA_REG gMS_DPS[3] 75 | #define NUMBEROFDPSREG 4 76 | 77 | #define MI_INIT_MODE_REG_R gMS_MI[0] 78 | #define MI_VERSION_REG_R gMS_MI[1] 79 | #define MI_INTR_REG_R gMS_MI[2] 80 | #define MI_INTR_MASK_REG_R gMS_MI[3] 81 | #define NUMBEROFMIREG 4 82 | 83 | #define VI_STATUS_REG gMS_VI[0] 84 | #define VI_ORIGIN_REG gMS_VI[1] 85 | #define VI_WIDTH_REG gMS_VI[2] 86 | #define VI_INTR_REG gMS_VI[3] 87 | #define VI_CURRENT_REG gMS_VI[4] 88 | #define VI_BURST_REG gMS_VI[5] 89 | #define VI_V_SYNC_REG gMS_VI[6] 90 | #define VI_H_SYNC_REG gMS_VI[7] 91 | #define VI_LEAP_REG gMS_VI[8] 92 | #define VI_H_START_REG gMS_VI[9] 93 | #define VI_V_START_REG gMS_VI[10] 94 | #define VI_V_BURST_REG gMS_VI[11] 95 | #define VI_X_SCALE_REG gMS_VI[12] 96 | #define VI_Y_SCALE_REG gMS_VI[13] 97 | #define NUMBEROFVIREG 14 98 | 99 | #define AI_DRAM_ADDR_REG gMS_AI[0] 100 | #define AI_LEN_REG gMS_AI[1] 101 | #define AI_CONTROL_REG gMS_AI[2] 102 | #define AI_STATUS_REG gMS_AI[3] 103 | #define AI_DACRATE_REG gMS_AI[4] 104 | #define AI_BITRATE_REG gMS_AI[5] 105 | #define NUMBEROFAIREG 6 106 | 107 | #define AI_STATUS_FIFO_FULL 0x80000000 /* Bit 31: full */ 108 | #define AI_STATUS_DMA_BUSY 0x40000000 /* Bit 30: busy */ 109 | 110 | #define PI_DRAM_ADDR_REG gMS_PI[0] 111 | #define PI_CART_ADDR_REG gMS_PI[1] 112 | #define PI_RD_LEN_REG gMS_PI[2] 113 | #define PI_WR_LEN_REG gMS_PI[3] 114 | #define PI_STATUS_REG gMS_PI[4] 115 | #define PI_BSD_DOM1_LAT_REG gMS_PI[5] 116 | #define PI_BSD_DOM1_PWD_REG gMS_PI[6] 117 | #define PI_BSD_DOM1_PGS_REG gMS_PI[7] 118 | #define PI_BSD_DOM1_RLS_REG gMS_PI[8] 119 | #define PI_BSD_DOM2_LAT_REG gMS_PI[9] 120 | #define PI_BSD_DOM2_PWD_REG gMS_PI[10] 121 | #define PI_BSD_DOM2_PGS_REG gMS_PI[11] 122 | #define PI_BSD_DOM2_RLS_REG gMS_PI[12] 123 | #define NUMBEROFPIREG 13 124 | 125 | #define PI_STATUS_RESET 0x01 126 | #define PI_STATUS_CLR_INTR 0x02 127 | #define PI_STATUS_ERROR 0x04 128 | #define PI_STATUS_IO_BUSY 0x02 129 | #define PI_STATUS_DMA_BUSY 0x01 130 | #define PI_STATUS_DMA_IO_BUSY 0x03 131 | 132 | #define RI_MODE_REG gMS_RI[0] 133 | #define RI_CONFIG_REG gMS_RI[1] 134 | #define RI_CURRENT_LOAD_REG gMS_RI[2] 135 | #define RI_SELECT_REG gMS_RI[3] 136 | #define RI_REFRESH_REG gMS_RI[4] 137 | #define RI_LATENCY_REG gMS_RI[5] 138 | #define RI_RERROR_REG gMS_RI[6] 139 | #define RI_WERROR_REG gMS_RI[7] 140 | #define NUMBEROFRIREG 8 141 | 142 | #define SI_DRAM_ADDR_REG gMS_SI[0] 143 | #define SI_PIF_ADDR_RD64B_REG gMS_SI[1] 144 | #define SI_PIF_ADDR_WR64B_REG gMS_SI[4] 145 | #define SI_STATUS_REG gMS_SI[6] 146 | #define NUMBEROFSIREG 7 147 | 148 | #define SI_STATUS_DMA_BUSY 0x0001 149 | #define SI_STATUS_RD_BUSY 0x0002 150 | #define SI_STATUS_DMA_ERROR 0x0008 151 | #define SI_STATUS_INTERRUPT 0x1000 152 | 153 | void RCP_Reset(void); 154 | #endif 155 | -------------------------------------------------------------------------------- /plugins.h: -------------------------------------------------------------------------------- 1 | /*$T plugins.h GC 1.136 02/28/02 09:02:31 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | #ifndef _PLUGINS_H__1964_ 10 | #define _PLUGINS_H__1964_ 11 | 12 | #define PLUGIN_TYPE_RSP 1 13 | #define PLUGIN_TYPE_GFX 2 14 | #define PLUGIN_TYPE_AUDIO 3 15 | #define PLUGIN_TYPE_CONTROLLER 4 16 | 17 | typedef struct 18 | { 19 | uint16 Version; 20 | uint16 Type; 21 | char Name[100]; 22 | 23 | int NormalMemory; 24 | int MemoryBswaped; 25 | } PLUGIN_INFO; 26 | 27 | typedef struct 28 | { 29 | HWND hWnd; 30 | HWND hStatusBar; 31 | int MemoryBswaped; 32 | _int8 *HEADER; 33 | _int8 *RDRAM; 34 | _int8 *DMEM; 35 | _int8 *IMEM; 36 | uint32 *MI_INTR_RG; 37 | uint32 *DPC_START_RG; 38 | uint32 *DPC_END_RG; 39 | uint32 *DPC_CURRENT_RG; 40 | uint32 *DPC_STATUS_RG; 41 | uint32 *DPC_CLOCK_RG; 42 | uint32 *DPC_BUFBUSY_RG; 43 | uint32 *DPC_PIPEBUSY_RG; 44 | uint32 *DPC_TMEM_RG; 45 | uint32 *VI_STATUS_RG; 46 | uint32 *VI_ORIGIN_RG; 47 | uint32 *VI_WIDTH_RG; 48 | uint32 *VI_INTR_RG; 49 | uint32 *VI_V_CURRENT_LINE_RG; 50 | uint32 *VI_TIMING_RG; 51 | uint32 *VI_V_SYNC_RG; 52 | uint32 *VI_H_SYNC_RG; 53 | uint32 *VI_LEAP_RG; 54 | uint32 *VI_H_START_RG; 55 | uint32 *VI_V_START_RG; 56 | uint32 *VI_V_BURST_RG; 57 | uint32 *VI_X_SCALE_RG; 58 | uint32 *VI_Y_SCALE_RG; 59 | void (*CheckInterrupts) (void); 60 | } 61 | GFX_INFO; 62 | 63 | /* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */ 64 | #define PLUGIN_TYPE_AUDIO 3 65 | 66 | #define EXPORT __declspec(dllexport) 67 | #define CALL _cdecl 68 | 69 | #define TV_SYSTEM_NTSC 1 70 | #define TV_SYSTEM_PAL 0 71 | #define TV_SYSTEM_MPAL 0 72 | 73 | typedef struct 74 | { 75 | HWND hwnd; 76 | HINSTANCE hinst; 77 | BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre bswapped on a dword (32 bits) 78 | * boundry eg. the first 8 bytes are stored like this: 4 3 2 1 8 7 6 5 */ 79 | BYTE *HEADER; /* This is the rom header (first 40h bytes of the rom */ 80 | 81 | /* This will be in the same memory format as the rest of the memory. */ 82 | BYTE *__RDRAM; 83 | BYTE *__DMEM; 84 | BYTE *__IMEM; 85 | DWORD *__MI_INTR_REG; 86 | DWORD *__AI_DRAM_ADDR_REG; 87 | DWORD *__AI_LEN_REG; 88 | DWORD *__AI_CONTROL_REG; 89 | DWORD *__AI_STATUS_REG; 90 | DWORD *__AI_DACRATE_REG; 91 | DWORD *__AI_BITRATE_REG; 92 | 93 | void (*CheckInterrupts) (void); 94 | } 95 | AUDIO_INFO; 96 | 97 | /* Controller plugin's */ 98 | #define PLUGIN_NONE 1 99 | #define PLUGIN_MEMPAK 2 100 | #define PLUGIN_RUMBLE_PAK 3 /* not implemeted for non raw data */ 101 | #define PLUGIN_TANSFER_PAK 4 /* not implemeted for non raw data */ 102 | 103 | typedef struct 104 | { 105 | BOOL Present; 106 | BOOL RawData; 107 | int Plugin; 108 | } CONTROL; 109 | 110 | typedef union 111 | { 112 | DWORD Value; 113 | struct 114 | { 115 | unsigned R_DPAD : 1; 116 | unsigned L_DPAD : 1; 117 | unsigned D_DPAD : 1; 118 | unsigned U_DPAD : 1; 119 | unsigned START_BUTTON : 1; 120 | unsigned Z_TRIG : 1; 121 | unsigned B_BUTTON : 1; 122 | unsigned A_BUTTON : 1; 123 | unsigned R_CBUTTON : 1; 124 | unsigned L_CBUTTON : 1; 125 | unsigned D_CBUTTON : 1; 126 | unsigned U_CBUTTON : 1; 127 | unsigned R_TRIG : 1; 128 | unsigned L_TRIG : 1; 129 | unsigned Reserved1 : 1; 130 | unsigned Reserved2 : 1; 131 | signed Y_AXIS : 8; 132 | signed X_AXIS : 8; 133 | }; 134 | } BUTTONS; 135 | 136 | extern GFX_INFO Gfx_Info; 137 | extern AUDIO_INFO Audio_Info; 138 | extern CONTROL Controls[4]; 139 | #endif 140 | -------------------------------------------------------------------------------- /profiler.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/profiler.c -------------------------------------------------------------------------------- /r4300i.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/r4300i.h -------------------------------------------------------------------------------- /romlist.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/romlist.c -------------------------------------------------------------------------------- /romlist.h: -------------------------------------------------------------------------------- 1 | /*$T romlist.h GC 1.136 02/28/02 07:51:10 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _ROMLIST_H__1964_ 24 | #define _ROMLIST_H__1964_ 25 | 26 | #include 27 | #include 28 | #include "globals.h" 29 | #include "1964ini.h" 30 | 31 | struct ROMLIST_ENTRY_STRUCT 32 | { 33 | INI_ENTRY *pinientry; 34 | char romfilename[_MAX_FNAME]; 35 | long size; 36 | }; 37 | 38 | enum 39 | { 40 | ROMLIST_GAMENAME, 41 | ROMLIST_COUNTRY, 42 | ROMLIST_SIZE, 43 | ROMLIST_COMMENT, 44 | ROMLIST_GAMENAME_INVERT, 45 | ROMLIST_COUNTRY_INVERT, 46 | ROMLIST_SIZE_INVERT, 47 | ROMLIST_COMMENT_INVERT 48 | }; 49 | 50 | enum 51 | { 52 | ROMLIST_DISPLAY_INTERNAL_NAME, 53 | ROMLIST_DISPLAY_ALTER_NAME, 54 | ROMLIST_DISPLAY_FILENAME, 55 | }; 56 | 57 | typedef struct ROMLIST_ENTRY_STRUCT ROMLIST_ENTRY; 58 | 59 | /* Global variabls */ 60 | #define MAX_ROMLIST 2000 61 | 62 | extern ROMLIST_ENTRY *romlist[MAX_ROMLIST]; 63 | extern int romlist_count; 64 | extern int romlist_sort_method; 65 | extern int romlistNameToDisplay; 66 | 67 | /* Functions */ 68 | BOOL RomListReadDirectory(const char *path); 69 | void ClearRomList(void); 70 | void InitRomList(void); 71 | int RomListAddEntry(INI_ENTRY *newentry, char *romfilename, long int filesize); 72 | void RomListOpenRom(int index, BOOL RunThisRom); 73 | void RomListSelectRom(int index); 74 | void RomListRomOptions(int index); 75 | void RomListSaveCurrentPos(void); 76 | void RomListUseSavedPos(void); 77 | int RomListGetSelectedIndex(void); 78 | 79 | HWND NewRomList_CreateListViewControl(HWND hwndParent); 80 | void NewRomList_ListViewHideHeader(HWND hwnd); 81 | void NewRomList_ListViewShowHeader(HWND hwnd); 82 | void NewRomList_ListViewFreshRomList(void); 83 | void NewRomList_ListViewChangeWindowRect(void); 84 | void NewRomList_Sort(void); 85 | void RomListRememberColumnWidth(void); 86 | ROMLIST_ENTRY *RomListGet_Selected_Entry(void); 87 | void RomListSelectLoadedRomEntry(void); 88 | 89 | LRESULT APIENTRY RomListDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 90 | LRESULT APIENTRY ColumnSelectDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 91 | 92 | void ReadRomHeaderInMemory(INI_ENTRY *ini_entry); 93 | ROMLIST_ENTRY *RomListSelectedEntry(void); 94 | 95 | void ConvertInvalidInternalName(char *oldname, char *newname); 96 | BOOL InternalNameIsValid(char *name); 97 | 98 | long OnNotifyRomList(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 99 | long OnNotifyRomListHeader(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 100 | extern int romListHeaderClickedColumn; 101 | extern void CheckButton(int nID, BOOL bCheck); 102 | extern void EnableButton(int nID, BOOL bEnable); 103 | extern void EnableRadioButtons(BOOL bEnable); 104 | extern void SetupToolBar(); 105 | extern BYTE ChangeButtonState(int nID); 106 | extern void CheckButton(int nID, BOOL bCheck); 107 | 108 | 109 | typedef enum { 110 | ROMLIST_COL_GAMENAME=0, 111 | ROMLIST_COL_COUNTRY, 112 | ROMLIST_COL_SIZE, 113 | ROMLIST_COL_STATUS, 114 | ROMLIST_COL_GAMESAVE, 115 | ROMLIST_COL_CICCHIP, 116 | ROMLIST_COL_CRC1, 117 | ROMLIST_COL_CRC2 118 | } ColumnID; 119 | 120 | typedef struct{ 121 | ColumnID colID; 122 | char *text; 123 | int colPos; 124 | BOOL enabled; 125 | int colWidth; 126 | HTREEITEM treeViewID; 127 | } ColumnType; 128 | 129 | extern ColumnType romListColumns[]; 130 | extern const int numberOfRomListColumns; 131 | 132 | #endif /* ROMLIST_H */ 133 | -------------------------------------------------------------------------------- /timer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/timer.c -------------------------------------------------------------------------------- /timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/timer.h -------------------------------------------------------------------------------- /tooltips.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "win32/wingui.h" 4 | 5 | HWND WINAPI CreateTT(HWND hwndOwner) 6 | { 7 | INITCOMMONCONTROLSEX icex; 8 | HWND hwndTT; 9 | TOOLINFO ti; 10 | // Load the ToolTip class from the DLL. 11 | icex.dwSize = sizeof(icex); 12 | icex.dwICC = ICC_BAR_CLASSES; 13 | 14 | if(!InitCommonControlsEx(&icex)) 15 | return NULL; 16 | 17 | // Create the ToolTip control. 18 | hwndTT = CreateWindow(TOOLTIPS_CLASS, TEXT("Hello"), 19 | WS_POPUP, 20 | CW_USEDEFAULT, CW_USEDEFAULT, 21 | CW_USEDEFAULT, CW_USEDEFAULT, 22 | NULL, (HMENU)NULL, gui.hInst, 23 | NULL); 24 | 25 | // Prepare TOOLINFO structure for use as tracking ToolTip. 26 | ti.cbSize = sizeof(TOOLINFO); 27 | ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE; 28 | ti.hwnd = hwndOwner; 29 | ti.uId = (UINT)gui.hwnd1964main; 30 | ti.hinst = gui.hInst; 31 | ti.lpszText = LPSTR_TEXTCALLBACK; 32 | ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0; 33 | 34 | // Add the tool to the control, displaying an error if needed. 35 | if(!SendMessage(hwndTT,TTM_ADDTOOL,0,(LPARAM)&ti)){ 36 | MessageBox(hwndOwner,"Couldn't create the ToolTip control.", 37 | "Error",MB_OK); 38 | return NULL; 39 | } 40 | 41 | // Activate (display) the tracking ToolTip. Then, set a global 42 | // flag value to indicate that the ToolTip is active, so other 43 | // functions can check to see if it's visible. 44 | SendMessage(hwndTT,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti); 45 | // g_bIsVisible = TRUE; 46 | 47 | return(hwndTT); 48 | } 49 | -------------------------------------------------------------------------------- /win32/1964.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/1964.bmp -------------------------------------------------------------------------------- /win32/DLL_Rsp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 3 | * program is free software; you can redistribute it and/or modify it under the 4 | * terms of the GNU General Public License as published by the Free Software 5 | * Foundation; either version 2 of the License, or (at your option) any later 6 | * version. This program is distributed in the hope that it will be useful, but 7 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 9 | * details. You should have received a copy of the GNU General Public License 10 | * along with this program; if not, write to the Free Software Foundation, Inc., 11 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 12 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 13 | */ 14 | 15 | #include "../interrupt.h" 16 | #include "../n64rcp.h" 17 | #include "../memory.h" 18 | #include "DLL_Rsp.h" 19 | #include "Dll_Audio.h" 20 | #include "Dll_Video.h" 21 | #include "wingui.h" 22 | 23 | /********** RSP DLL: Functions *********************/ 24 | void (__cdecl *_RSPCloseDLL) ( void ) = NULL; 25 | void (__cdecl *_RSPDllAbout) ( HWND hWnd ) = NULL; 26 | void (__cdecl *_RSPDllConfig) ( HWND hWnd ) = NULL; 27 | void (__cdecl *_RSPRomClosed) ( void ) = NULL; 28 | DWORD (__cdecl *_DoRspCycles) ( DWORD ) = NULL; 29 | void (__cdecl *_InitiateRSP_1_0) ( RSP_INFO_1_0 rspinfo, DWORD * cycles) = NULL; 30 | void (__cdecl *_InitiateRSP_1_1) ( RSP_INFO_1_1 rspinfo, DWORD * cycles) = NULL; 31 | void (__cdecl *_RSP_GetDllInfo) (PLUGIN_INFO *) = NULL; 32 | 33 | 34 | uint16 RSPVersion = 0;; 35 | DWORD RspTaskValue = 0;; 36 | HINSTANCE hRSPHandle = NULL; 37 | BOOL rsp_plugin_is_loaded = FALSE; 38 | 39 | 40 | // 41 | // ---------------------------------------------------------------------------- 42 | // Functions called by RSP Plugin 43 | // ---------------------------------------------------------------------------- 44 | // 45 | void __cdecl ProcessDList(void) 46 | { 47 | VIDEO_ProcessDList(); 48 | } 49 | 50 | void __cdecl ShowCFB(void) 51 | { 52 | VIDEO_ShowCFB(); 53 | } 54 | 55 | void __cdecl ProcessRDPList(void) 56 | { 57 | VIDEO_ProcessRDPList(); 58 | } 59 | 60 | void __cdecl ProcessAList(void) 61 | { 62 | AUDIO_ProcessAList(); 63 | } 64 | 65 | void __cdecl RspCheckInterrupts(void) 66 | { 67 | CheckInterrupts(); 68 | } 69 | 70 | // 71 | // ---------------------------------------------------------------------------- 72 | // Wrapper functions from the RSP Plugin 73 | // ---------------------------------------------------------------------------- 74 | // 75 | void RSPCloseDLL( void ) 76 | { 77 | if( _RSPCloseDLL ) 78 | _RSPCloseDLL(); 79 | } 80 | 81 | void RSPDllAbout( HWND hWnd ) 82 | { 83 | if( _RSPDllAbout ) 84 | _RSPDllAbout(hWnd); 85 | } 86 | 87 | void RSPDllConfig( HWND hWnd ) 88 | { 89 | if( _RSPDllConfig ) 90 | _RSPDllConfig(hWnd); 91 | } 92 | 93 | void RSPRomClosed( void ) 94 | { 95 | if( _RSPRomClosed ) 96 | _RSPRomClosed(); 97 | } 98 | DWORD DoRspCycles( DWORD cycles ) 99 | { 100 | if( _DoRspCycles ) 101 | { 102 | DWORD retval; 103 | DWORD sp_pc_save = SP_PC_REG; 104 | SP_PC_REG &= 0xFFC; 105 | retval = _DoRspCycles(cycles); 106 | SP_PC_REG = sp_pc_save; 107 | return retval; 108 | } 109 | else 110 | return 0; 111 | } 112 | 113 | void InitiateRSP_1_0( RSP_INFO_1_0 rspinfo, DWORD * cycles) 114 | { 115 | if( _InitiateRSP_1_0 ) 116 | _InitiateRSP_1_0(rspinfo, cycles ); 117 | } 118 | void InitiateRSP_1_1( RSP_INFO_1_1 rspinfo, DWORD * cycles) 119 | { 120 | if( _InitiateRSP_1_1 ) 121 | _InitiateRSP_1_1(rspinfo, cycles ); 122 | } 123 | 124 | // 125 | // ---------------------------------------------------------------------------- 126 | // Supporting functions For the RSP Plugin 127 | // ---------------------------------------------------------------------------- 128 | // 129 | 130 | void InitializeRSP (void) 131 | { 132 | RSP_INFO_1_0 RspInfo10; 133 | RSP_INFO_1_1 RspInfo11; 134 | 135 | RspInfo10.CheckInterrupts = RspCheckInterrupts; 136 | RspInfo11.CheckInterrupts = RspCheckInterrupts; 137 | RspInfo10.ProcessDlist = ProcessDList; 138 | RspInfo11.ProcessDlist = ProcessDList; 139 | RspInfo10.ProcessAlist = ProcessAList; 140 | RspInfo11.ProcessAlist = ProcessAList; 141 | RspInfo10.ProcessRdpList = ProcessRDPList; 142 | RspInfo11.ProcessRdpList = ProcessRDPList; 143 | RspInfo11.ShowCFB = ShowCFB; 144 | 145 | RspInfo10.hInst = gui.hInst; 146 | RspInfo11.hInst = gui.hInst; 147 | RspInfo10.RDRAM = gMS_RDRAM; 148 | RspInfo11.RDRAM = gMS_RDRAM; 149 | RspInfo10.DMEM = (uint8*)&SP_DMEM; 150 | RspInfo11.DMEM = (uint8*)&SP_DMEM; 151 | RspInfo10.IMEM = (uint8*)&SP_IMEM; 152 | RspInfo11.IMEM = (uint8*)&SP_IMEM; 153 | RspInfo10.MemoryBswaped = FALSE; 154 | RspInfo11.MemoryBswaped = FALSE; 155 | 156 | RspInfo10.MI__INTR_REG = &MI_INTR_REG_R; 157 | RspInfo11.MI__INTR_REG = &MI_INTR_REG_R; 158 | 159 | RspInfo10.SP__MEM_ADDR_REG = &SP_MEM_ADDR_REG; 160 | RspInfo11.SP__MEM_ADDR_REG = &SP_MEM_ADDR_REG; 161 | RspInfo10.SP__DRAM_ADDR_REG = &SP_DRAM_ADDR_REG; 162 | RspInfo11.SP__DRAM_ADDR_REG = &SP_DRAM_ADDR_REG; 163 | RspInfo10.SP__RD_LEN_REG = &SP_RD_LEN_REG; 164 | RspInfo11.SP__RD_LEN_REG = &SP_RD_LEN_REG; 165 | RspInfo10.SP__WR_LEN_REG = &SP_WR_LEN_REG; 166 | RspInfo11.SP__WR_LEN_REG = &SP_WR_LEN_REG; 167 | RspInfo10.SP__STATUS_REG = &SP_STATUS_REG; 168 | RspInfo11.SP__STATUS_REG = &SP_STATUS_REG; 169 | RspInfo10.SP__DMA_FULL_REG = &SP_DMA_FULL_REG; 170 | RspInfo11.SP__DMA_FULL_REG = &SP_DMA_FULL_REG; 171 | RspInfo10.SP__DMA_BUSY_REG = &SP_DMA_BUSY_REG; 172 | RspInfo11.SP__DMA_BUSY_REG = &SP_DMA_BUSY_REG; 173 | RspInfo10.SP__PC_REG = &SP_PC_REG; 174 | RspInfo11.SP__PC_REG = &SP_PC_REG; 175 | RspInfo10.SP__SEMAPHORE_REG = &SP_SEMAPHORE_REG; 176 | RspInfo11.SP__SEMAPHORE_REG = &SP_SEMAPHORE_REG; 177 | 178 | RspInfo10.DPC__START_REG = &DPC_START_REG; 179 | RspInfo11.DPC__START_REG = &DPC_START_REG; 180 | RspInfo10.DPC__END_REG = &DPC_END_REG; 181 | RspInfo11.DPC__END_REG = &DPC_END_REG; 182 | RspInfo10.DPC__CURRENT_REG = &DPC_CURRENT_REG; 183 | RspInfo11.DPC__CURRENT_REG = &DPC_CURRENT_REG; 184 | RspInfo10.DPC__STATUS_REG = &DPC_STATUS_REG; 185 | RspInfo11.DPC__STATUS_REG = &DPC_STATUS_REG; 186 | RspInfo10.DPC__CLOCK_REG = &DPC_CLOCK_REG; 187 | RspInfo11.DPC__CLOCK_REG = &DPC_CLOCK_REG; 188 | RspInfo10.DPC__BUFBUSY_REG = &DPC_BUFBUSY_REG; 189 | RspInfo11.DPC__BUFBUSY_REG = &DPC_BUFBUSY_REG; 190 | RspInfo10.DPC__PIPEBUSY_REG = &DPC_PIPEBUSY_REG; 191 | RspInfo11.DPC__PIPEBUSY_REG = &DPC_PIPEBUSY_REG; 192 | RspInfo10.DPC__TMEM_REG = &DPC_TMEM_REG; 193 | RspInfo11.DPC__TMEM_REG = &DPC_TMEM_REG; 194 | 195 | if (RSPVersion == 0x0100) 196 | { 197 | InitiateRSP_1_0(RspInfo10, &RspTaskValue); 198 | } 199 | else 200 | { 201 | InitiateRSP_1_1(RspInfo11, &RspTaskValue); 202 | } 203 | #ifndef _DEBUG 204 | //InitiateInternalRSP(RspInfo11, &RspTaskValue); 205 | #endif 206 | } 207 | 208 | BOOL LoadRSPPlugin(char * libname) 209 | { 210 | PLUGIN_INFO RSPPluginInfo; 211 | 212 | hRSPHandle = LoadLibrary(libname); 213 | if (hRSPHandle == NULL) 214 | { 215 | return FALSE; 216 | } 217 | 218 | _RSP_GetDllInfo = (void (__cdecl *)(PLUGIN_INFO *))GetProcAddress( hRSPHandle, "GetDllInfo" ); 219 | if( _RSP_GetDllInfo == NULL) 220 | { 221 | return FALSE; 222 | } 223 | 224 | _RSP_GetDllInfo(&RSPPluginInfo); 225 | RSPVersion = RSPPluginInfo.Version; 226 | 227 | if(RSPPluginInfo.Type == PLUGIN_TYPE_RSP) /* Check if this is a video plugin */ 228 | { 229 | if (RSPVersion == 1) 230 | { 231 | RSPVersion = 0x0100; 232 | } 233 | 234 | if (RSPVersion == 0x100) { 235 | _InitiateRSP_1_0 = (void (__cdecl *)(RSP_INFO_1_0,DWORD *))GetProcAddress( hRSPHandle, "InitiateRSP" ); 236 | } 237 | else 238 | { 239 | _InitiateRSP_1_1 = (void (__cdecl *)(RSP_INFO_1_1,DWORD *))GetProcAddress( hRSPHandle, "InitiateRSP" ); 240 | } 241 | 242 | _DoRspCycles = (DWORD (__cdecl *)(DWORD))GetProcAddress( hRSPHandle, "DoRspCycles" ); 243 | _RSPRomClosed = (void (__cdecl *)(void))GetProcAddress( hRSPHandle, "RomClosed" ); 244 | _RSPCloseDLL = (void (__cdecl *)(void))GetProcAddress( hRSPHandle, "CloseDLL" ); 245 | _RSPDllConfig = (void (__cdecl *)(HWND))GetProcAddress( hRSPHandle, "DllConfig" ); 246 | _RSPDllAbout = (void (__cdecl *)(HWND))GetProcAddress( hRSPHandle, "DllAbout" ); 247 | 248 | if( _DoRspCycles == NULL || 249 | _RSPRomClosed == NULL || 250 | _RSPCloseDLL == NULL || 251 | _RSPDllConfig == NULL || 252 | ( _InitiateRSP_1_0 == NULL && _InitiateRSP_1_1 == NULL ) ) 253 | { 254 | return FALSE; 255 | } 256 | else 257 | { 258 | return TRUE; 259 | } 260 | } 261 | else 262 | { 263 | return FALSE; 264 | } 265 | } 266 | 267 | void CloseRSPPlugin (void) 268 | { 269 | if (hRSPHandle != NULL) 270 | { 271 | RSPCloseDLL(); 272 | FreeLibrary(hRSPHandle); 273 | hRSPHandle = NULL; 274 | } 275 | } 276 | 277 | -------------------------------------------------------------------------------- /win32/DLL_Rsp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 3 | * program is free software; you can redistribute it and/or modify it under the 4 | * terms of the GNU General Public License as published by the Free Software 5 | * Foundation; either version 2 of the License, or (at your option) any later 6 | * version. This program is distributed in the hope that it will be useful, but 7 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 9 | * details. You should have received a copy of the GNU General Public License 10 | * along with this program; if not, write to the Free Software Foundation, Inc., 11 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 12 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 13 | */ 14 | 15 | #ifndef _1964_DLL_RSP_H 16 | #define _1964_DLL_RSP_H 17 | 18 | #include 19 | 20 | typedef struct { 21 | HINSTANCE hInst; 22 | BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre 23 | bswap on a dword (32 bits) boundry */ 24 | BYTE * RDRAM; 25 | BYTE * DMEM; 26 | BYTE * IMEM; 27 | 28 | DWORD * MI__INTR_REG; 29 | 30 | DWORD * SP__MEM_ADDR_REG; 31 | DWORD * SP__DRAM_ADDR_REG; 32 | DWORD * SP__RD_LEN_REG; 33 | DWORD * SP__WR_LEN_REG; 34 | DWORD * SP__STATUS_REG; 35 | DWORD * SP__DMA_FULL_REG; 36 | DWORD * SP__DMA_BUSY_REG; 37 | DWORD * SP__PC_REG; 38 | DWORD * SP__SEMAPHORE_REG; 39 | 40 | DWORD * DPC__START_REG; 41 | DWORD * DPC__END_REG; 42 | DWORD * DPC__CURRENT_REG; 43 | DWORD * DPC__STATUS_REG; 44 | DWORD * DPC__CLOCK_REG; 45 | DWORD * DPC__BUFBUSY_REG; 46 | DWORD * DPC__PIPEBUSY_REG; 47 | DWORD * DPC__TMEM_REG; 48 | 49 | void (__cdecl *CheckInterrupts)( void ); 50 | void (__cdecl *ProcessDlist)( void ); 51 | void (__cdecl *ProcessAlist)( void ); 52 | void (__cdecl *ProcessRdpList)( void ); 53 | } RSP_INFO_1_0; 54 | 55 | typedef struct { 56 | HINSTANCE hInst; 57 | BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre 58 | bswap on a dword (32 bits) boundry */ 59 | BYTE * RDRAM; 60 | BYTE * DMEM; 61 | BYTE * IMEM; 62 | 63 | DWORD * MI__INTR_REG; 64 | 65 | DWORD * SP__MEM_ADDR_REG; 66 | DWORD * SP__DRAM_ADDR_REG; 67 | DWORD * SP__RD_LEN_REG; 68 | DWORD * SP__WR_LEN_REG; 69 | DWORD * SP__STATUS_REG; 70 | DWORD * SP__DMA_FULL_REG; 71 | DWORD * SP__DMA_BUSY_REG; 72 | DWORD * SP__PC_REG; 73 | DWORD * SP__SEMAPHORE_REG; 74 | 75 | DWORD * DPC__START_REG; 76 | DWORD * DPC__END_REG; 77 | DWORD * DPC__CURRENT_REG; 78 | DWORD * DPC__STATUS_REG; 79 | DWORD * DPC__CLOCK_REG; 80 | DWORD * DPC__BUFBUSY_REG; 81 | DWORD * DPC__PIPEBUSY_REG; 82 | DWORD * DPC__TMEM_REG; 83 | 84 | void ( __cdecl *CheckInterrupts)( void ); 85 | void (__cdecl *ProcessDlist)( void ); 86 | void (__cdecl *ProcessAlist)( void ); 87 | void (__cdecl *ProcessRdpList)( void ); 88 | void (__cdecl *ShowCFB)( void ); 89 | } RSP_INFO_1_1; 90 | 91 | /********** RSP DLL: Functions *********************/ 92 | 93 | void RSPCloseDLL( void ); 94 | void RSPDllAbout( HWND hWnd ); 95 | void RSPDllConfig( HWND hWnd ); 96 | void RSPRomClosed( void ); 97 | DWORD DoRspCycles( DWORD ); 98 | void InitiateRSP_1_0( RSP_INFO_1_0 Rsp_Info, DWORD * Cycles); 99 | void InitiateRSP_1_1( RSP_INFO_1_1 Rsp_Info, DWORD * Cycles); 100 | 101 | void CloseRSPPlugin (void); 102 | BOOL LoadRSPPlugin(char * libname); 103 | void InitializeRSP (void); 104 | 105 | extern BOOL rsp_plugin_is_loaded; 106 | 107 | #endif 108 | 109 | -------------------------------------------------------------------------------- /win32/Dll_Audio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/Dll_Audio.c -------------------------------------------------------------------------------- /win32/Dll_Audio.h: -------------------------------------------------------------------------------- 1 | /*$T Dll_Audio.h GC 1.136 02/28/02 08:57:44 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _DLL_AUDIO_H__1964_ 24 | #define _DLL_AUDIO_H__1964_ 25 | 26 | #include "../plugins.h" 27 | 28 | extern void (__cdecl *_AUDIO_DllClose) (void); 29 | extern void (__cdecl *_AUDIO_RomClosed) (void); 30 | extern void (__cdecl *_AUDIO_GetDllInfo) (PLUGIN_INFO *); 31 | extern void (__cdecl *_AUDIO_DllConfig) (HWND); 32 | extern void (__cdecl *_AUDIO_Test) (HWND); 33 | extern void (__cdecl *_AUDIO_About) (HWND); 34 | extern BOOL (__cdecl *_AUDIO_Initialize) (AUDIO_INFO); 35 | extern void (__cdecl *_AUDIO_End) (void); 36 | extern void (__cdecl *_AUDIO_PlaySnd) (unsigned __int8 *, unsigned __int32 *); 37 | extern _int32 (__cdecl *_AUDIO_TimeLeft) (unsigned char *); 38 | extern void (__cdecl *_AUDIO_ProcessAList) (void); 39 | extern void (__cdecl *_AUDIO_AiDacrateChanged) (int); 40 | extern void (__cdecl *_AUDIO_AiLenChanged) (void); 41 | extern DWORD (__cdecl *_AUDIO_AiReadLength) (void); 42 | extern void (__cdecl *_AUDIO_AiUpdate) (BOOL); 43 | BOOL LoadAudioPlugin(char *libname); 44 | void CloseAudioPlugin(void); 45 | 46 | extern void AUDIO_GetDllInfo(PLUGIN_INFO *Plugin_Info); 47 | extern BOOL AUDIO_Initialize(AUDIO_INFO Audio_Info); 48 | extern void AUDIO_ProcessAList(void); 49 | extern void AUDIO_DllConfig(HWND); 50 | extern void AUDIO_Test(HWND); 51 | extern void AUDIO_About(HWND); 52 | extern void AUDIO_AiDacrateChanged(int); 53 | extern void AUDIO_AiLenChanged(void); 54 | extern DWORD AUDIO_AiReadLength(void); 55 | extern void AUDIO_AiUpdate(BOOL); 56 | extern void AUDIO_RomClosed(void); 57 | 58 | /* Used when selecting plugin */ 59 | extern void AUDIO_Under_Selecting_Test(HWND); 60 | extern void AUDIO_Under_Selecting_About(HWND); 61 | extern void (__cdecl *_AUDIO_Under_Selecting_Test) (HWND); 62 | extern void (__cdecl *_AUDIO_Under_Selecting_About) (HWND); 63 | 64 | extern HINSTANCE hinstLibAudio; 65 | extern BOOL CoreDoingAIUpdate; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /win32/Dll_Input.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/Dll_Input.c -------------------------------------------------------------------------------- /win32/Dll_Input.h: -------------------------------------------------------------------------------- 1 | /*$T Dll_Input.h GC 1.136 02/28/02 08:58:31 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _INPUT_H__1964_ 24 | #define _INPUT_H__1964_ 25 | 26 | #include "../plugins.h" 27 | 28 | #define GFX_VERSION 0x0102 29 | #define CONTROLLER_VERSION 0x0100 30 | 31 | extern void CONTROLLER_CloseDLL(void); 32 | extern void CONTROLLER_ControllerCommand(int _Control, BYTE *_Command); 33 | extern void CONTROLLER_DllAbout(HWND _hWnd); 34 | extern void CONTROLLER_DllConfig(HWND _hWnd); 35 | extern void CONTROLLER_DllTest(HWND _hWnd); 36 | extern void CONTROLLER_GetDllInfo(PLUGIN_INFO *_plugin); 37 | extern void CONTROLLER_GetKeys(int _Control, BUTTONS *_Keys); 38 | extern void CONTROLLER_InitiateControllers(HWND _hMainWindow, CONTROL _Controls[4]); 39 | extern void CONTROLLER_ReadController(int _Control, BYTE *_Command); 40 | extern void CONTROLLER_RomClosed(void); 41 | extern void CONTROLLER_RomOpen(void); 42 | extern void CONTROLLER_WM_KeyDown(WPARAM _wParam, LPARAM _lParam); 43 | extern void CONTROLLER_WM_KeyUp(WPARAM _wParam, LPARAM _lParam); 44 | extern void CONTROLLER_HookRDRAM(DWORD *Mem, int OCFactor); 45 | extern void CONTROLLER_HookROM(DWORD *Rom); 46 | extern void (__cdecl *_CONTROLLER_DllAbout) (HWND _hWnd); 47 | extern void (__cdecl *_CONTROLLER_DllConfig) (HWND _hWnd); 48 | extern void (__cdecl *_CONTROLLER_DllTest) (HWND _hWnd); 49 | 50 | /* Used when selecting plugins */ 51 | extern void CONTROLLER_Under_Selecting_DllAbout(HWND _hWnd); 52 | extern void CONTROLLER_Under_Selecting_DllTest(HWND _hWnd); 53 | extern void (__cdecl *_CONTROLLER_Under_Selecting_DllAbout) (HWND _hWnd); 54 | extern void (__cdecl *_CONTROLLER_Under_Selecting_DllTest) (HWND _hWnd); 55 | extern BOOL LoadControllerPlugin(char *libname); 56 | extern void CloseControllerPlugin(void); 57 | 58 | extern HINSTANCE hinstControllerPlugin; 59 | extern int mouseinjectorpresent; 60 | #endif 61 | -------------------------------------------------------------------------------- /win32/Dll_Video.h: -------------------------------------------------------------------------------- 1 | /*$T Dll_Video.h GC 1.136 02/28/02 09:00:18 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _VIDEO_H__1964_ 24 | #define _VIDEO_H__1964_ 25 | 26 | #include "../plugins.h" 27 | 28 | extern BOOL (__cdecl *_VIDEO_InitiateGFX) (GFX_INFO); 29 | extern void (__cdecl *_VIDEO_ProcessDList) (void); 30 | extern void (__cdecl *_VIDEO_RomOpen) (void); 31 | extern void (__cdecl *_VIDEO_RomClosed) (void); 32 | extern void (__cdecl *_VIDEO_DllClose) (void); 33 | extern void (__cdecl *_VIDEO_DllConfig) (HWND); 34 | extern void (__cdecl *_VIDEO_GetDllInfo) (PLUGIN_INFO *); 35 | extern void (__cdecl *_VIDEO_UpdateScreen) (void); 36 | extern void (__cdecl *_VIDEO_Test) (HWND); 37 | extern void (__cdecl *_VIDEO_About) (HWND); 38 | extern void (__cdecl *_VIDEO_MoveScreen) (int, int); 39 | extern void (__cdecl *_VIDEO_ChangeWindow) (int); 40 | extern void (__cdecl *_VIDEO_ExtraChangeResolution) (HWND, long, HWND); 41 | extern void (__cdecl *_VIDEO_DrawScreen) (void); 42 | extern void (__cdecl *_VIDEO_ViStatusChanged) (void); 43 | extern void (__cdecl *_VIDEO_ViWidthChanged) (void); 44 | 45 | /* changes for spec 1.3 */ 46 | extern void (__cdecl *_VIDEO_ChangeWindow_1_3) (void); 47 | extern void (__cdecl *_VIDEO_CaptureScreen) (char *Directory); 48 | extern void (__cdecl *_VIDEO_ProcessRDPList) (void); 49 | extern void (__cdecl *_VIDEO_ShowCFB) (void); 50 | 51 | extern void VIDEO_GetDllInfo(PLUGIN_INFO *); 52 | extern void VIDEO_DllClose(void); 53 | extern BOOL VIDEO_InitiateGFX(GFX_INFO); 54 | extern void VIDEO_ProcessDList(void); 55 | extern void VIDEO_RomOpen(void); 56 | extern void VIDEO_RomClosed(void); 57 | extern BOOL LoadVideoPlugin(char *libname); 58 | extern void CloseVideoPlugin(void); 59 | extern void VIDEO_DllConfig(HWND); 60 | extern void VIDEO_About(HWND); 61 | extern void VIDEO_Test(HWND); 62 | extern void VIDEO_MoveScreen(int, int); 63 | extern void VIDEO_ExtraChangeResolution(HWND, long, HWND); 64 | extern void VIDEO_ChangeWindow(int); 65 | extern void VIDEO_DrawScreen(void); 66 | extern void VIDEO_ViStatusChanged(void); 67 | extern void VIDEO_UpdateScreen(void); 68 | extern void VIDEO_ViWidthChanged(void); 69 | 70 | /* changes for spec 1.3 */ 71 | extern void VIDEO_ChangeWindow_1_3(void); 72 | extern void VIDEO_CaptureScreen(char *Directory); 73 | extern void VIDEO_ProcessRDPList(void); 74 | extern void VIDEO_ShowCFB(void); 75 | 76 | /* Used when video plugin is being selected */ 77 | extern void VIDEO_Under_Selecting_About(HWND); 78 | extern void VIDEO_Under_Selecting_Test(HWND); 79 | extern void (__cdecl *_VIDEO_Under_Selecting_Test) (HWND); 80 | extern void (__cdecl *_VIDEO_Under_Selecting_About) (HWND); 81 | 82 | extern HINSTANCE hinstLibVideo; 83 | extern uint16 GfxPluginVersion; 84 | 85 | 86 | typedef struct g_GFX_PluginRECT 87 | { 88 | RECT rect; 89 | BOOL UseThis; 90 | } g_GFX_PluginRECT; 91 | 92 | extern g_GFX_PluginRECT GFX_PluginRECT; 93 | #endif 94 | -------------------------------------------------------------------------------- /win32/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/Thumbs.db -------------------------------------------------------------------------------- /win32/Wingui.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/Wingui.c -------------------------------------------------------------------------------- /win32/audio.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/audio.bmp -------------------------------------------------------------------------------- /win32/icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/icon2.ico -------------------------------------------------------------------------------- /win32/input.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/input.bmp -------------------------------------------------------------------------------- /win32/registry.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/registry.c -------------------------------------------------------------------------------- /win32/registry.h: -------------------------------------------------------------------------------- 1 | /*$T registry.h GC 1.136 02/28/02 07:50:39 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _REGISTRY_H__1964_ 24 | #define _REGISTRY_H__1964_ 25 | 26 | typedef struct 27 | { 28 | int WindowXPos; 29 | int WindowYPos; 30 | int Maximized; 31 | int ClientWidth; 32 | int ThreadPriority; 33 | char ROMPath[MAX_PATH]; 34 | char AudioPlugin[80]; 35 | char InputPlugin[80]; 36 | char VideoPlugin[80]; 37 | char RSPPlugin[80]; 38 | } RegSettingsTyp; 39 | 40 | RegSettingsTyp gRegSettings; 41 | 42 | extern int ReadConfiguration(void); 43 | extern void WriteConfiguration(void); 44 | #endif 45 | -------------------------------------------------------------------------------- /win32/resource.hm: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated Help ID include file. 2 | // Used by wingui.rc 3 | // 4 | #define HIDC_DEFAULTOPTIONS_PAUSEWHENINACTIVE \ 5 | 0xffff05b2 // "OPTIONS" 6 | -------------------------------------------------------------------------------- /win32/toolbar1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/toolbar1.bmp -------------------------------------------------------------------------------- /win32/video.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/video.bmp -------------------------------------------------------------------------------- /win32/windebug.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/windebug.c -------------------------------------------------------------------------------- /win32/windebug.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/windebug.h -------------------------------------------------------------------------------- /win32/wingui.h: -------------------------------------------------------------------------------- 1 | /*$T wingui.h GC 1.136 02/28/02 07:53:40 */ 2 | 3 | 4 | /*$6 5 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 | */ 8 | 9 | 10 | /* 11 | * 1964 Copyright (C) 1999-2002 Joel Middendorf, This 12 | * program is free software; you can redistribute it and/or modify it under the 13 | * terms of the GNU General Public License as published by the Free Software 14 | * Foundation; either version 2 of the License, or (at your option) any later 15 | * version. This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 | * details. You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software Foundation, Inc., 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the 21 | * authors: email: schibo@emulation64.com, rice1964@yahoo.com 22 | */ 23 | #ifndef _WINGUI_H__1964_ 24 | #define _WINGUI_H__1964_ 25 | #include "resource.h" 26 | 27 | /* Functions in the wingui.c */ 28 | int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst, LPSTR lpszCmdLine, int nCmdShow); 29 | HWND InitWin98UI(HANDLE hInstance, int nCmdShow); 30 | LRESULT APIENTRY MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 31 | LRESULT APIENTRY About(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 32 | void __cdecl DisplayError(char *Message, ...); 33 | void __cdecl DisplayCriticalMessage(char *Message, ...); 34 | 35 | BOOL WinLoadRom(void); 36 | BOOL WinLoadRomStep2(char *szFileName); 37 | void Pause(void); 38 | void Resume(void); 39 | void Kill(void); 40 | void Play(BOOL WithFullScreen); 41 | void Stop(void); 42 | void OpenROM(void); 43 | void CloseROM(void); 44 | void ChangeDirectory(void); 45 | void SaveState(void); 46 | void LoadState(void); 47 | void SaveStateByNumber(WPARAM wparam); 48 | void LoadStateByNumber(WPARAM wparam); 49 | void SaveStateByDialog(int format); 50 | void LoadStateByDialog(int format); 51 | void EnableStateMenu(void); 52 | void DisableStateMenu(void); 53 | void SetWindowBorderless(void); 54 | void UnsetWindowBorderless(void); 55 | void PrepareBeforePlay(int IsFullScreen); 56 | void KillCPUThread(void); 57 | void SetOverclockFactor(int factor); 58 | void SetCounterFactor(int); 59 | void GEFiringRateHack(void); 60 | void GEDisableHeadRoll(void); 61 | void PDTimingHack(void); 62 | void PDSpeedHack(void); 63 | void GEPDPause(BOOL pause); 64 | void SetCodeCheckMethod(int); 65 | void InitPluginData(void); 66 | void Set_1964_Directory(void); 67 | void CountryCodeToCountryName_and_TVSystem(int countrycode, char *countryname, int *tvsystem); 68 | void CaptureScreenToFile(void); 69 | void Set_Ready_Message(void); 70 | void DisableDebugMenu(void); 71 | void SetupDebuger(void); 72 | void SaveCmdLineParameter(char *cmdline); 73 | BOOL StartGameByCommandLine(); 74 | void SetHighResolutionTimer(void); 75 | 76 | void StateSetNumber(int number); 77 | void Exit1964(void); 78 | void GetPluginDir(char *Directory); 79 | extern int LoadGNUDistConditions(char *ConditionsBuf); 80 | LRESULT APIENTRY ConditionsDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 81 | LRESULT APIENTRY DefaultOptionsDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 82 | LRESULT APIENTRY CheatAndHackDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 83 | LRESULT APIENTRY CriticalMessageDialog(HWND hDlg, unsigned message, WORD wParam, LONG lParam); 84 | 85 | #define MAXFILENAME 256 /* maximum length of file pathname */ 86 | 87 | /* the legal stuff */ 88 | unsigned char MainDisclaimer[320]; 89 | unsigned char WarrantyPart1[700]; 90 | unsigned char WarrantyPart2[700]; 91 | unsigned char DistConditions[800]; /* GNU Redistribution Conditions */ 92 | 93 | struct EMU1964GUI 94 | { 95 | char *szBaseWindowTitle; 96 | HINSTANCE hInst; 97 | HANDLE hAccTable; /* handle to accelerator table */ 98 | HWND hwnd1964main; /* handle to main window */ 99 | HWND hwndRomList; /* Handle to the rom list child window */ 100 | HWND hStatusBar; /* Window Handle of the status bar */ 101 | HWND hToolBar; /* Window Handle of the toolbar */ 102 | HWND hReBar; /* Window Handle of the rebar */ 103 | HWND hClientWindow; /* Window handle of the client child window */ 104 | HWND hCriticalMsgWnd; /* handle to critical message window */ 105 | HMENU hMenu1964main; 106 | HMENU hMenuRomListPopup; 107 | 108 | struct 109 | { 110 | /* Status Bar text fields */ 111 | char field_1[256]; 112 | char field_2[80]; 113 | char field_3[80]; 114 | char field_4[80]; 115 | char field_5[80]; 116 | } staturbar_field; 117 | char szWindowTitle[80]; 118 | }; 119 | 120 | extern struct EMU1964GUI gui; 121 | 122 | struct GUIOPTIONS 123 | { 124 | BOOL pause_at_inactive; 125 | BOOL pause_at_menu; 126 | BOOL ok_to_pause_at_menu; 127 | BOOL use_default_save_directory; 128 | BOOL use_default_state_save_directory; 129 | BOOL use_default_plugin_directory; 130 | BOOL use_last_rom_directory; 131 | BOOL show_expert_user_menu; 132 | BOOL show_recent_rom_directory_list; 133 | BOOL show_recent_game_list; 134 | BOOL display_detail_status; 135 | BOOL display_profiler_status; 136 | BOOL show_state_selector_menu; 137 | BOOL show_critical_msg_window; 138 | BOOL display_romlist; 139 | BOOL display_statusbar; 140 | BOOL highfreqtimer; 141 | BOOL borderless_fullscreen; 142 | BOOL auto_hide_cursor_when_active; 143 | BOOL use_simplified_plugin_names; 144 | }; 145 | 146 | extern struct GUIOPTIONS guioptions; 147 | 148 | struct GUISTATUS 149 | { 150 | int clientwidth; /* Client window width */ 151 | int clientheight; /* Client window height */ 152 | RECT window_position; /* 1964 main window location */ 153 | BOOL WindowIsMaximized; 154 | BOOL window_is_moving; 155 | BOOL window_is_maximized; 156 | BOOL window_is_minimized; 157 | BOOL block_menu; /* Block all menu command while 1964 is busy */ 158 | int IsFullScreen; 159 | BOOL IsBorderless; 160 | }; 161 | extern struct GUISTATUS guistatus; 162 | 163 | extern void DockStatusBar(void); 164 | extern void InitStatusBarParts(void); 165 | extern void SetStatusBarText(int, char *); 166 | 167 | #define MAX_RECENT_ROM_DIR 8 168 | #define MAX_RECENT_GAME_LIST 8 169 | char recent_rom_directory_lists[MAX_RECENT_ROM_DIR][260]; 170 | char recent_game_lists[MAX_RECENT_GAME_LIST][260]; 171 | 172 | struct DIRECTORIES 173 | { 174 | char main_directory[256]; 175 | char plugin_directory_to_use[256]; 176 | char save_directory_to_use[256]; 177 | char rom_directory_to_use[256]; 178 | char last_rom_directory[256]; 179 | }; 180 | 181 | extern struct DIRECTORIES directories; 182 | 183 | extern char game_country_name[10]; 184 | extern int game_country_tvsystem; 185 | 186 | enum { LOAD_ALL_PLUGIN, LOAD_VIDEO_PLUGIN, LOAD_AUDIO_PLUGIN, LOAD_INPUT_PLUGIN, LOAD_RSP_PLUGIN }; 187 | 188 | void FreePlugins(void); 189 | void LoadPlugins(int type); 190 | 191 | enum { SAVE_STATE_1964_FORMAT, SAVE_STATE_PJ64_FORMAT }; 192 | 193 | typedef enum { 194 | CMDLINE_AUDIO_PLUGIN, 195 | CMDLINE_VIDEO_PLUGIN, 196 | CMDLINE_CONTROLLER_PLUGIN, 197 | CMDLINE_ROM_DIR, 198 | CMDLINE_GAME_FILENAME, 199 | CMDLINE_FULL_SCREEN_FLAG, 200 | CMDLINE_OC_FACTOR, 201 | CMDLINE_MAX_NUMBER 202 | }CmdLineParameterType; 203 | 204 | void GetCmdLineParameter(CmdLineParameterType arg, char *buf); 205 | 206 | #endif 207 | -------------------------------------------------------------------------------- /win32/wingui.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/wingui.rc -------------------------------------------------------------------------------- /win32/wingui2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/win32/wingui2.c -------------------------------------------------------------------------------- /zlib/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 0.18 beta, Feb 26th, 2002 5 | 6 | Copyright (C) 1998-2002 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 35 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 36 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 37 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 38 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 39 | typedef long (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 40 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 41 | 42 | typedef struct zlib_filefunc_def_s 43 | { 44 | open_file_func zopen_file; 45 | read_file_func zread_file; 46 | write_file_func zwrite_file; 47 | tell_file_func ztell_file; 48 | seek_file_func zseek_file; 49 | close_file_func zclose_file; 50 | testerror_file_func zerror_file; 51 | voidpf opaque; 52 | } zlib_filefunc_def; 53 | 54 | 55 | 56 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 57 | 58 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 59 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 60 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 61 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 62 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 63 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 64 | #endif 65 | -------------------------------------------------------------------------------- /zlib/readme.txt: -------------------------------------------------------------------------------- 1 | dll16\zlib16.dll : The 16 bits DLL of ZLib 1.14 2 | dll16\zlib16.lib : The 16 bits import library for the DLL of ZLib 1.14 3 | dll32\zlib.dll : The 32 bits DLL of ZLib 1.14 4 | dll32\zlib.lib : The 32 bits import library for the DLL of ZLib 1.14 5 | static32\zlibstat.lib : The 32 bits statis library of zLib 1.14 for Visual C++ 6 | dll32\zlib_bor.lib : The 32 bits import library for the DLL of ZLib 1.14 for Borland C++ 7 | 8 | I also include a version of zconf.h which must replace the version from zlib114.zip 9 | The zlib.h included is the same version than in zlib114.zip 10 | 11 | I've also added unzip.h and zip.h (please visit http://www.winimage.com/zLibDll/unzip.html ) 12 | -------------------------------------------------------------------------------- /zlib/unzip.h: -------------------------------------------------------------------------------- 1 | /* unzip.h -- IO for uncompress .zip files using zlib 2 | Version 0.18 beta, Feb 26th, 2002 3 | 4 | Copyright (C) 1998-2002 Gilles Vollant 5 | 6 | This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g 7 | WinZip, InfoZip tools and compatible. 8 | Encryption and multi volume ZipFile (span) are not supported. 9 | Old compressions used by old PKZip 1.x are not supported 10 | 11 | THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE 12 | CAN CHANGE IN FUTURE VERSION !! 13 | I WAIT FEEDBACK at mail info@winimage.com 14 | Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution 15 | 16 | Condition of use and distribution are the same than zlib : 17 | 18 | This software is provided 'as-is', without any express or implied 19 | warranty. In no event will the authors be held liable for any damages 20 | arising from the use of this software. 21 | 22 | Permission is granted to anyone to use this software for any purpose, 23 | including commercial applications, and to alter it and redistribute it 24 | freely, subject to the following restrictions: 25 | 26 | 1. The origin of this software must not be misrepresented; you must not 27 | claim that you wrote the original software. If you use this software 28 | in a product, an acknowledgment in the product documentation would be 29 | appreciated but is not required. 30 | 2. Altered source versions must be plainly marked as such, and must not be 31 | misrepresented as being the original software. 32 | 3. This notice may not be removed or altered from any source distribution. 33 | 34 | 35 | */ 36 | 37 | /* for more info about .ZIP format, see 38 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 39 | http://www.info-zip.org/pub/infozip/doc/ 40 | PkWare has also a specification at : 41 | ftp://ftp.pkware.com/probdesc.zip 42 | */ 43 | 44 | #ifndef _unz_H 45 | #define _unz_H 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | #ifndef _ZLIB_H 52 | #include "zlib.h" 53 | #endif 54 | 55 | #ifndef _ZLIBIOAPI_H 56 | #include "ioapi.h" 57 | #endif 58 | 59 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 60 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 61 | from (void*) without cast */ 62 | typedef struct TagunzFile__ { int unused; } unzFile__; 63 | typedef unzFile__ *unzFile; 64 | #else 65 | typedef voidp unzFile; 66 | #endif 67 | 68 | 69 | #define UNZ_OK (0) 70 | #define UNZ_END_OF_LIST_OF_FILE (-100) 71 | #define UNZ_ERRNO (Z_ERRNO) 72 | #define UNZ_EOF (0) 73 | #define UNZ_PARAMERROR (-102) 74 | #define UNZ_BADZIPFILE (-103) 75 | #define UNZ_INTERNALERROR (-104) 76 | #define UNZ_CRCERROR (-105) 77 | 78 | /* tm_unz contain date/time info */ 79 | typedef struct tm_unz_s 80 | { 81 | uInt tm_sec; /* seconds after the minute - [0,59] */ 82 | uInt tm_min; /* minutes after the hour - [0,59] */ 83 | uInt tm_hour; /* hours since midnight - [0,23] */ 84 | uInt tm_mday; /* day of the month - [1,31] */ 85 | uInt tm_mon; /* months since January - [0,11] */ 86 | uInt tm_year; /* years - [1980..2044] */ 87 | } tm_unz; 88 | 89 | /* unz_global_info structure contain global data about the ZIPfile 90 | These data comes from the end of central dir */ 91 | typedef struct unz_global_info_s 92 | { 93 | uLong number_entry; /* total number of entries in 94 | the central dir on this disk */ 95 | uLong size_comment; /* size of the global comment of the zipfile */ 96 | } unz_global_info; 97 | 98 | 99 | /* unz_file_info contain information about a file in the zipfile */ 100 | typedef struct unz_file_info_s 101 | { 102 | uLong version; /* version made by 2 bytes */ 103 | uLong version_needed; /* version needed to extract 2 bytes */ 104 | uLong flag; /* general purpose bit flag 2 bytes */ 105 | uLong compression_method; /* compression method 2 bytes */ 106 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 107 | uLong crc; /* crc-32 4 bytes */ 108 | uLong compressed_size; /* compressed size 4 bytes */ 109 | uLong uncompressed_size; /* uncompressed size 4 bytes */ 110 | uLong size_filename; /* filename length 2 bytes */ 111 | uLong size_file_extra; /* extra field length 2 bytes */ 112 | uLong size_file_comment; /* file comment length 2 bytes */ 113 | 114 | uLong disk_num_start; /* disk number start 2 bytes */ 115 | uLong internal_fa; /* internal file attributes 2 bytes */ 116 | uLong external_fa; /* external file attributes 4 bytes */ 117 | 118 | tm_unz tmu_date; 119 | } unz_file_info; 120 | 121 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, 122 | const char* fileName2, 123 | int iCaseSensitivity)); 124 | /* 125 | Compare two filename (fileName1,fileName2). 126 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 127 | If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 128 | or strcasecmp) 129 | If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 130 | (like 1 on Unix, 2 on Windows) 131 | */ 132 | 133 | 134 | extern unzFile ZEXPORT unzOpen OF((const char *path)); 135 | /* 136 | Open a Zip file. path contain the full pathname (by example, 137 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 138 | "zlib/zlib113.zip". 139 | If the zipfile cannot be opened (file don't exist or in not valid), the 140 | return value is NULL. 141 | Else, the return value is a unzFile Handle, usable with other function 142 | of this unzip package. 143 | */ 144 | 145 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, 146 | zlib_filefunc_def* pzlib_filefunc_def)); 147 | /* 148 | Open a Zip file, like unzOpen, but provide a set of file low level API 149 | for read/write the zip file (see ioapi.h) 150 | */ 151 | 152 | extern int ZEXPORT unzClose OF((unzFile file)); 153 | /* 154 | Close a ZipFile opened with unzipOpen. 155 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 156 | these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 157 | return UNZ_OK if there is no problem. */ 158 | 159 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, 160 | unz_global_info *pglobal_info)); 161 | /* 162 | Write info about the ZipFile in the *pglobal_info structure. 163 | No preparation of the structure is needed 164 | return UNZ_OK if there is no problem. */ 165 | 166 | 167 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file, 168 | char *szComment, 169 | uLong uSizeBuf)); 170 | /* 171 | Get the global comment string of the ZipFile, in the szComment buffer. 172 | uSizeBuf is the size of the szComment buffer. 173 | return the number of byte copied or an error code <0 174 | */ 175 | 176 | 177 | /***************************************************************************/ 178 | /* Unzip package allow you browse the directory of the zipfile */ 179 | 180 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); 181 | /* 182 | Set the current file of the zipfile to the first file. 183 | return UNZ_OK if there is no problem 184 | */ 185 | 186 | extern int ZEXPORT unzGoToNextFile OF((unzFile file)); 187 | /* 188 | Set the current file of the zipfile to the next file. 189 | return UNZ_OK if there is no problem 190 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 191 | */ 192 | 193 | extern int ZEXPORT unzLocateFile OF((unzFile file, 194 | const char *szFileName, 195 | int iCaseSensitivity)); 196 | /* 197 | Try locate the file szFileName in the zipfile. 198 | For the iCaseSensitivity signification, see unzStringFileNameCompare 199 | 200 | return value : 201 | UNZ_OK if the file is found. It becomes the current file. 202 | UNZ_END_OF_LIST_OF_FILE if the file is not found 203 | */ 204 | 205 | 206 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, 207 | unz_file_info *pfile_info, 208 | char *szFileName, 209 | uLong fileNameBufferSize, 210 | void *extraField, 211 | uLong extraFieldBufferSize, 212 | char *szComment, 213 | uLong commentBufferSize)); 214 | /* 215 | Get Info about the current file 216 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about 217 | the current file 218 | if szFileName!=NULL, the filemane string will be copied in szFileName 219 | (fileNameBufferSize is the size of the buffer) 220 | if extraField!=NULL, the extra field information will be copied in extraField 221 | (extraFieldBufferSize is the size of the buffer). 222 | This is the Central-header version of the extra field 223 | if szComment!=NULL, the comment string of the file will be copied in szComment 224 | (commentBufferSize is the size of the buffer) 225 | */ 226 | 227 | /***************************************************************************/ 228 | /* for reading the content of the current zipfile, you can open it, read data 229 | from it, and close it (you can close it before reading all the file) 230 | */ 231 | 232 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); 233 | /* 234 | Open for reading data the current file in the zipfile. 235 | If there is no error, the return value is UNZ_OK. 236 | */ 237 | 238 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, 239 | int* method, 240 | int* level, 241 | int raw)); 242 | /* 243 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 244 | *method will receive method of compression, *level will receive level of 245 | compression 246 | note : you can set level parameter as NULL (if you did not want known level, 247 | but you CANNOT set method parameter as NULL 248 | */ 249 | 250 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); 251 | /* 252 | Close the file in zip opened with unzOpenCurrentFile 253 | Return UNZ_CRCERROR if all the file was read but the CRC is not good 254 | */ 255 | 256 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 257 | voidp buf, 258 | unsigned len)); 259 | /* 260 | Read bytes from the current file (opened by unzOpenCurrentFile) 261 | buf contain buffer where data must be copied 262 | len the size of buf. 263 | 264 | return the number of byte copied if somes bytes are copied 265 | return 0 if the end of file was reached 266 | return <0 with error code if there is an error 267 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) 268 | */ 269 | 270 | extern z_off_t ZEXPORT unztell OF((unzFile file)); 271 | /* 272 | Give the current position in uncompressed data 273 | */ 274 | 275 | extern int ZEXPORT unzeof OF((unzFile file)); 276 | /* 277 | return 1 if the end of file was reached, 0 elsewhere 278 | */ 279 | 280 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 281 | voidp buf, 282 | unsigned len)); 283 | /* 284 | Read extra field from the current file (opened by unzOpenCurrentFile) 285 | This is the local-header version of the extra field (sometimes, there is 286 | more info in the local-header version than in the central-header) 287 | 288 | if buf==NULL, it return the size of the local extra field 289 | 290 | if buf!=NULL, len is the size of the buffer, the extra header is copied in 291 | buf. 292 | the return value is the number of bytes copied in buf, or (if <0) 293 | the error code 294 | */ 295 | 296 | #ifdef __cplusplus 297 | } 298 | #endif 299 | 300 | #endif /* _unz_H */ 301 | -------------------------------------------------------------------------------- /zlib/vssver.scc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/zlib/vssver.scc -------------------------------------------------------------------------------- /zlib/zconf.h: -------------------------------------------------------------------------------- 1 | /* zconf.h -- configuration of the zlib compression library 2 | * Copyright (C) 1995-1998 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #ifndef _ZCONF_H 9 | #define _ZCONF_H 10 | 11 | /* 12 | * If you *really* need a unique prefix for all types and library functions, 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 14 | */ 15 | #ifdef Z_PREFIX 16 | # define deflateInit_ z_deflateInit_ 17 | # define deflate z_deflate 18 | # define deflateEnd z_deflateEnd 19 | # define inflateInit_ z_inflateInit_ 20 | # define inflate z_inflate 21 | # define inflateEnd z_inflateEnd 22 | # define deflateInit2_ z_deflateInit2_ 23 | # define deflateSetDictionary z_deflateSetDictionary 24 | # define deflateCopy z_deflateCopy 25 | # define deflateReset z_deflateReset 26 | # define deflateParams z_deflateParams 27 | # define inflateInit2_ z_inflateInit2_ 28 | # define inflateSetDictionary z_inflateSetDictionary 29 | # define inflateSync z_inflateSync 30 | # define inflateSyncPoint z_inflateSyncPoint 31 | # define inflateReset z_inflateReset 32 | # define compress z_compress 33 | # define compress2 z_compress2 34 | # define uncompress z_uncompress 35 | # define adler32 z_adler32 36 | # define crc32 z_crc32 37 | # define get_crc_table z_get_crc_table 38 | 39 | # define Byte z_Byte 40 | # define uInt z_uInt 41 | # define uLong z_uLong 42 | # define Bytef z_Bytef 43 | # define charf z_charf 44 | # define intf z_intf 45 | # define uIntf z_uIntf 46 | # define uLongf z_uLongf 47 | # define voidpf z_voidpf 48 | # define voidp z_voidp 49 | #endif 50 | 51 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) 52 | # define WIN32 53 | #endif 54 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) 55 | # ifndef __32BIT__ 56 | # define __32BIT__ 57 | # endif 58 | #endif 59 | #if defined(__MSDOS__) && !defined(MSDOS) 60 | # define MSDOS 61 | #endif 62 | 63 | /* 64 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more 65 | * than 64k bytes at a time (needed on systems with 16-bit int). 66 | */ 67 | #if defined(MSDOS) && !defined(__32BIT__) 68 | # define MAXSEG_64K 69 | #endif 70 | #ifdef MSDOS 71 | # define UNALIGNED_OK 72 | #endif 73 | 74 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) 75 | # define STDC 76 | #endif 77 | #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) 78 | # ifndef STDC 79 | # define STDC 80 | # endif 81 | #endif 82 | 83 | #ifndef STDC 84 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ 85 | # define const 86 | # endif 87 | #endif 88 | 89 | /* Some Mac compilers merge all .h files incorrectly: */ 90 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) 91 | # define NO_DUMMY_DECL 92 | #endif 93 | 94 | /* Old Borland C incorrectly complains about missing returns: */ 95 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x460) 96 | # define NEED_DUMMY_RETURN 97 | #endif 98 | #if defined(__TURBOC__) && !defined(__BORLANDC__) 99 | # define NEED_DUMMY_RETURN 100 | #endif 101 | 102 | 103 | /* Maximum value for memLevel in deflateInit2 */ 104 | #ifndef MAX_MEM_LEVEL 105 | # ifdef MAXSEG_64K 106 | # define MAX_MEM_LEVEL 8 107 | # else 108 | # define MAX_MEM_LEVEL 9 109 | # endif 110 | #endif 111 | 112 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. 113 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 114 | * created by gzip. (Files created by minigzip can still be extracted by 115 | * gzip.) 116 | */ 117 | #ifndef MAX_WBITS 118 | # define MAX_WBITS 15 /* 32K LZ77 window */ 119 | #endif 120 | 121 | /* The memory requirements for deflate are (in bytes): 122 | (1 << (windowBits+2)) + (1 << (memLevel+9)) 123 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 124 | plus a few kilobytes for small objects. For example, if you want to reduce 125 | the default memory requirements from 256K to 128K, compile with 126 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 127 | Of course this will generally degrade compression (there's no free lunch). 128 | 129 | The memory requirements for inflate are (in bytes) 1 << windowBits 130 | that is, 32K for windowBits=15 (default value) plus a few kilobytes 131 | for small objects. 132 | */ 133 | 134 | /* Type declarations */ 135 | 136 | #ifndef OF /* function prototypes */ 137 | # ifdef STDC 138 | # define OF(args) args 139 | # else 140 | # define OF(args) () 141 | # endif 142 | #endif 143 | 144 | /* The following definitions for FAR are needed only for MSDOS mixed 145 | * model programming (small or medium model with some far allocations). 146 | * This was tested only with MSC; for other MSDOS compilers you may have 147 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 148 | * just define FAR to be empty. 149 | */ 150 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) 151 | /* MSC small or medium model */ 152 | # define SMALL_MEDIUM 153 | # ifdef _MSC_VER 154 | # define FAR _far 155 | # else 156 | # define FAR far 157 | # endif 158 | #endif 159 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) 160 | # ifndef __32BIT__ 161 | # define SMALL_MEDIUM 162 | # define FAR _far 163 | # endif 164 | #endif 165 | 166 | #if defined(WIN32) && (!defined(ZLIB_WIN32_NODLL)) && (!defined(ZLIB_DLL)) 167 | # define ZLIB_DLL 168 | #endif 169 | 170 | /* Compile with -DZLIB_DLL for Windows DLL support */ 171 | #if defined(ZLIB_DLL) 172 | # if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32) 173 | # ifndef WINAPI 174 | # ifdef FAR 175 | # undef FAR 176 | # endif 177 | # include 178 | # endif 179 | # ifdef WIN32 180 | # define ZEXPORT WINAPI 181 | # define ZEXPORTVA WINAPIV 182 | # else 183 | # define ZEXPORT WINAPI _export 184 | # define ZEXPORTVA FAR _cdecl _export 185 | # endif 186 | # endif 187 | # if defined (__BORLANDC__) 188 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) 189 | # include 190 | # define ZEXPORT __declspec(dllexport) WINAPI 191 | # define ZEXPORTVA __declspec(dllexport) WINAPIV 192 | # else 193 | # if defined (_Windows) && defined (__DLL__) 194 | # define ZEXPORT _export 195 | # define ZEXPORTVA _export 196 | # endif 197 | # endif 198 | # endif 199 | #endif 200 | 201 | #if defined (__BEOS__) 202 | # if defined (ZLIB_DLL) 203 | # define ZEXTERN extern __declspec(dllexport) 204 | # else 205 | # define ZEXTERN extern __declspec(dllimport) 206 | # endif 207 | #endif 208 | 209 | #ifndef ZEXPORT 210 | # define ZEXPORT 211 | #endif 212 | #ifndef ZEXPORTVA 213 | # define ZEXPORTVA 214 | #endif 215 | #ifndef ZEXTERN 216 | # define ZEXTERN extern 217 | #endif 218 | 219 | #ifndef FAR 220 | # define FAR 221 | #endif 222 | 223 | #if !defined(MACOS) && !defined(TARGET_OS_MAC) 224 | typedef unsigned char Byte; /* 8 bits */ 225 | #endif 226 | typedef unsigned int uInt; /* 16 bits or more */ 227 | typedef unsigned long uLong; /* 32 bits or more */ 228 | 229 | #ifdef SMALL_MEDIUM 230 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 231 | # define Bytef Byte FAR 232 | #else 233 | typedef Byte FAR Bytef; 234 | #endif 235 | typedef char FAR charf; 236 | typedef int FAR intf; 237 | typedef uInt FAR uIntf; 238 | typedef uLong FAR uLongf; 239 | 240 | #ifdef STDC 241 | typedef void FAR *voidpf; 242 | typedef void *voidp; 243 | #else 244 | typedef Byte FAR *voidpf; 245 | typedef Byte *voidp; 246 | #endif 247 | 248 | #ifdef HAVE_UNISTD_H 249 | # include /* for off_t */ 250 | # include /* for SEEK_* and off_t */ 251 | # ifdef VMS 252 | # include /* for off_t */ 253 | # endif 254 | # define z_off_t off_t 255 | #endif 256 | #ifndef SEEK_SET 257 | # define SEEK_SET 0 /* Seek from beginning of file. */ 258 | # define SEEK_CUR 1 /* Seek from current position. */ 259 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 260 | #endif 261 | #ifndef z_off_t 262 | # define z_off_t long 263 | #endif 264 | 265 | /* MVS linker does not support external names larger than 8 bytes */ 266 | #if defined(__MVS__) 267 | # pragma map(deflateInit_,"DEIN") 268 | # pragma map(deflateInit2_,"DEIN2") 269 | # pragma map(deflateEnd,"DEEND") 270 | # pragma map(inflateInit_,"ININ") 271 | # pragma map(inflateInit2_,"ININ2") 272 | # pragma map(inflateEnd,"INEND") 273 | # pragma map(inflateSync,"INSY") 274 | # pragma map(inflateSetDictionary,"INSEDI") 275 | # pragma map(inflate_blocks,"INBL") 276 | # pragma map(inflate_blocks_new,"INBLNE") 277 | # pragma map(inflate_blocks_free,"INBLFR") 278 | # pragma map(inflate_blocks_reset,"INBLRE") 279 | # pragma map(inflate_codes_free,"INCOFR") 280 | # pragma map(inflate_codes,"INCO") 281 | # pragma map(inflate_fast,"INFA") 282 | # pragma map(inflate_flush,"INFLU") 283 | # pragma map(inflate_mask,"INMA") 284 | # pragma map(inflate_set_dictionary,"INSEDI2") 285 | # pragma map(inflate_copyright,"INCOPY") 286 | # pragma map(inflate_trees_bits,"INTRBI") 287 | # pragma map(inflate_trees_dynamic,"INTRDY") 288 | # pragma map(inflate_trees_fixed,"INTRFI") 289 | # pragma map(inflate_trees_free,"INTRFR") 290 | #endif 291 | 292 | #endif /* _ZCONF_H */ 293 | -------------------------------------------------------------------------------- /zlib/zip.h: -------------------------------------------------------------------------------- 1 | /* zip.h -- IO for compress .zip files using zlib 2 | Version 0.18 beta, Feb 26th, 2002 3 | 4 | Copyright (C) 1998-2002 Gilles Vollant 5 | 6 | This unzip package allow creates .ZIP file, compatible with PKZip 2.04g 7 | WinZip, InfoZip tools and compatible. 8 | Encryption and multi volume ZipFile (span) are not supported. 9 | Old compressions used by old PKZip 1.x are not supported 10 | 11 | For uncompress .zip file, look at unzip.h 12 | 13 | THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE 14 | CAN CHANGE IN FUTURE VERSION !! 15 | I WAIT FEEDBACK at mail info@winimage.com 16 | Visit also http://www.winimage.com/zLibDll/unzip.html for evolution 17 | 18 | Condition of use and distribution are the same than zlib : 19 | 20 | This software is provided 'as-is', without any express or implied 21 | warranty. In no event will the authors be held liable for any damages 22 | arising from the use of this software. 23 | 24 | Permission is granted to anyone to use this software for any purpose, 25 | including commercial applications, and to alter it and redistribute it 26 | freely, subject to the following restrictions: 27 | 28 | 1. The origin of this software must not be misrepresented; you must not 29 | claim that you wrote the original software. If you use this software 30 | in a product, an acknowledgment in the product documentation would be 31 | appreciated but is not required. 32 | 2. Altered source versions must be plainly marked as such, and must not be 33 | misrepresented as being the original software. 34 | 3. This notice may not be removed or altered from any source distribution. 35 | 36 | 37 | */ 38 | 39 | /* for more info about .ZIP format, see 40 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 41 | http://www.info-zip.org/pub/infozip/doc/ 42 | PkWare has also a specification at : 43 | ftp://ftp.pkware.com/probdesc.zip 44 | */ 45 | 46 | #ifndef _zip_H 47 | #define _zip_H 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | #ifndef _ZLIB_H 54 | #include "zlib.h" 55 | #endif 56 | 57 | #ifndef _ZLIBIOAPI_H 58 | #include "ioapi.h" 59 | #endif 60 | 61 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 62 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 63 | from (void*) without cast */ 64 | typedef struct TagzipFile__ { int unused; } zipFile__; 65 | typedef zipFile__ *zipFile; 66 | #else 67 | typedef voidp zipFile; 68 | #endif 69 | 70 | #define ZIP_OK (0) 71 | #define ZIP_ERRNO (Z_ERRNO) 72 | #define ZIP_PARAMERROR (-102) 73 | #define ZIP_INTERNALERROR (-104) 74 | 75 | /* tm_zip contain date/time info */ 76 | typedef struct tm_zip_s 77 | { 78 | uInt tm_sec; /* seconds after the minute - [0,59] */ 79 | uInt tm_min; /* minutes after the hour - [0,59] */ 80 | uInt tm_hour; /* hours since midnight - [0,23] */ 81 | uInt tm_mday; /* day of the month - [1,31] */ 82 | uInt tm_mon; /* months since January - [0,11] */ 83 | uInt tm_year; /* years - [1980..2044] */ 84 | } tm_zip; 85 | 86 | typedef struct 87 | { 88 | tm_zip tmz_date; /* date in understandable format */ 89 | uLong dosDate; /* if dos_date == 0, tmu_date is used */ 90 | /* uLong flag; */ /* general purpose bit flag 2 bytes */ 91 | 92 | uLong internal_fa; /* internal file attributes 2 bytes */ 93 | uLong external_fa; /* external file attributes 4 bytes */ 94 | } zip_fileinfo; 95 | 96 | typedef const char* zipcharpc; 97 | 98 | 99 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 100 | /* 101 | Create a zipfile. 102 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 103 | an Unix computer "zlib/zlib113.zip". 104 | if the file pathname exist and append=1, the zip will be created at the end 105 | of the file. (useful if the file contain a self extractor code) 106 | If the zipfile cannot be opened, the return value is NULL. 107 | Else, the return value is a zipFile Handle, usable with other function 108 | of this zip package. 109 | */ 110 | 111 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 112 | int append, 113 | zipcharpc* globalcomment, 114 | zlib_filefunc_def* pzlib_filefunc_def)); 115 | 116 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 117 | const char* filename, 118 | const zip_fileinfo* zipfi, 119 | const void* extrafield_local, 120 | uInt size_extrafield_local, 121 | const void* extrafield_global, 122 | uInt size_extrafield_global, 123 | const char* comment, 124 | int method, 125 | int level)); 126 | /* 127 | Open a file in the ZIP for writing. 128 | filename : the filename in zip (if NULL, '-' without quote will be used 129 | *zipfi contain supplemental information 130 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 131 | contains the extrafield data the the local header 132 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 133 | contains the extrafield data the the local header 134 | if comment != NULL, comment contain the comment string 135 | method contain the compression method (0 for store, Z_DEFLATED for deflate) 136 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 137 | */ 138 | 139 | 140 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 141 | const char* filename, 142 | const zip_fileinfo* zipfi, 143 | const void* extrafield_local, 144 | uInt size_extrafield_local, 145 | const void* extrafield_global, 146 | uInt size_extrafield_global, 147 | const char* comment, 148 | int method, 149 | int level, 150 | int raw)); 151 | 152 | /* 153 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file 154 | */ 155 | 156 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 157 | const voidp buf, 158 | unsigned len)); 159 | /* 160 | Write data in the zipfile 161 | */ 162 | 163 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 164 | /* 165 | Close the current file in the zipfile 166 | */ 167 | 168 | 169 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 170 | uLong uncompressed_size, 171 | uLong crc32)); 172 | /* 173 | Close the current file in the zipfile, for fiel opened with 174 | parameter raw=1 in zipOpenNewFileInZip2 175 | uncompressed_size and crc32 are value for the uncompressed size 176 | */ 177 | 178 | extern int ZEXPORT zipClose OF((zipFile file, 179 | const char* global_comment)); 180 | /* 181 | Close the zipfile 182 | */ 183 | 184 | #ifdef __cplusplus 185 | } 186 | #endif 187 | 188 | #endif /* _zip_H */ 189 | -------------------------------------------------------------------------------- /zlib/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graslu/1964GEPD/9552acab919945c5f277da5efd146321e44a17bd/zlib/zlib.lib --------------------------------------------------------------------------------