| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team * |
| 3 | * * |
| 4 | * This program is free software; you can redistribute it and/or modify * |
| 5 | * it under the terms of the GNU General Public License as published by * |
| 6 | * the Free Software Foundation; either version 2 of the License, or * |
| 7 | * (at your option) any later version. * |
| 8 | * * |
| 9 | * This program is distributed in the hope that it will be useful, * |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 12 | * GNU General Public License for more details. * |
| 13 | * * |
| 14 | * You should have received a copy of the GNU General Public License * |
| 15 | * along with this program; if not, write to the * |
| 16 | * Free Software Foundation, Inc., * |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #include "psxcommon.h" |
| 21 | #include "r3000a.h" |
| 22 | #include "psxbios.h" |
| 23 | |
| 24 | #include "cheat.h" |
| 25 | #include "ppf.h" |
| 26 | |
| 27 | PcsxConfig Config; |
| 28 | boolean NetOpened = FALSE; |
| 29 | boolean BiosBooted = FALSE; |
| 30 | |
| 31 | int Log = 0; |
| 32 | FILE *emuLog = NULL; |
| 33 | |
| 34 | int EmuInit() { |
| 35 | return psxInit(); |
| 36 | } |
| 37 | |
| 38 | void EmuReset() { |
| 39 | FreeCheatSearchResults(); |
| 40 | FreeCheatSearchMem(); |
| 41 | |
| 42 | psxReset(); |
| 43 | } |
| 44 | |
| 45 | void EmuShutdown() { |
| 46 | ClearAllCheats(); |
| 47 | FreeCheatSearchResults(); |
| 48 | FreeCheatSearchMem(); |
| 49 | |
| 50 | FreePPFCache(); |
| 51 | |
| 52 | psxShutdown(); |
| 53 | } |
| 54 | |
| 55 | void EmuUpdate() { |
| 56 | // Do not allow hotkeys inside a softcall from HLE BIOS |
| 57 | if (!Config.HLE || !hleSoftCall) |
| 58 | SysUpdate(); |
| 59 | |
| 60 | ApplyCheats(); |
| 61 | |
| 62 | // reamed hack |
| 63 | { |
| 64 | extern void pl_frame_limit(void); |
| 65 | pl_frame_limit(); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void __Log(char *fmt, ...) { |
| 70 | va_list list; |
| 71 | #ifdef LOG_STDOUT |
| 72 | char tmp[1024]; |
| 73 | #endif |
| 74 | |
| 75 | va_start(list, fmt); |
| 76 | #ifndef LOG_STDOUT |
| 77 | vfprintf(emuLog, fmt, list); |
| 78 | #else |
| 79 | vsprintf(tmp, fmt, list); |
| 80 | SysPrintf(tmp); |
| 81 | #endif |
| 82 | va_end(list); |
| 83 | } |