mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
See tools/dynacrchack/DynaCrcHack.c for full instructions. For development of CRC hacks (and just for the fun of creating such a system), Allows GSdx to load and use CRC hack logic from an external DLL, and reload it, at runtime, whenever this DLL changes (but act normally if this DLL isn't found). This external DLL is compiled from a single C source file (a sample is provided, containing the current MGS3 CRC hack logic). There's also a system to automatically compile this C file into the DLL whenever the C file is modified, thus creating a system of instant [save C file] -> [GSdx switches to the new logic]. It's actually a pretty cool system, and might have other usages where it's useful, for the sake of tests/development/tweaking, to modify code logic during runtime. The overhead of such system compared to pre-compiled code is very low (e.g., in the case of CRC hacks which are called thousands of times/sec, I couldn't notice any difference in performance). Compilation of the C file is currently done using TCC (Tiny C Compiler - http://bellard.org/tcc/ - extremely fast, light and powerful). TCC itself needs to be downloaded separately (~250K download, no install required). The system currently supports Windows only. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4914 96395faa-99c1-11dd-bbfe-3dabce05a288
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/*----------------------------------------------------------*\
|
|
*
|
|
* Copyright (C) 2011 Avi Halachmi
|
|
* avihpit (at) yahoo (dot) com
|
|
*
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This Program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
waitForChange - watches a file for modifications and exit when modified
|
|
|
|
\*----------------------------------------------------------*/
|
|
|
|
#include <stdio.h>
|
|
#include <sys/stat.h>
|
|
#include <windows.h>
|
|
|
|
int usage(){
|
|
printf("Usage: WaitForChange <filename> [<ms between probes>=100]\n");
|
|
return 1;
|
|
}
|
|
|
|
int main(int argc, char** argv){
|
|
struct stat buf;
|
|
struct stat test;
|
|
|
|
if( argc<=1 )
|
|
return usage();
|
|
|
|
if(stat(argv[1], &buf)){
|
|
printf("Error (not found?): '%s'\n", argv[1]);
|
|
return usage();
|
|
};
|
|
|
|
do{
|
|
Sleep(argc>=2?(atoi(argv[2])?atoi(argv[2]):100):100);
|
|
if(stat(argv[1], &test)){
|
|
printf("Stat error\n");
|
|
return 1;
|
|
};
|
|
} while (test.st_mtime == buf.st_mtime);
|
|
|
|
return 0;
|
|
} |