pcsx2/tools/dynacrchack/utils/ding.c
avihal b4a0af9769 GSdx: New: Dynamic CRC Hacks system (disabled by default).
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
2011-09-07 18:38:27 +00:00

64 lines
No EOL
1.7 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
ding - Play a windows notification sound
\*----------------------------------------------------------*/
#include <windows.h>
#include <stdio.h>
LONG sounds[]={
MB_OK,
MB_ICONINFORMATION,
MB_ICONWARNING,
MB_ICONERROR,
MB_ICONQUESTION,
0xFFFFFFFF //"Simple" (with fallback to PC speaker beep)
};
int usage( int res )
{
printf( "Usage: ding [-h] [<n>=1]\n"
"Where <n> is a number as follows:\n"
"1-Default, 2-Information, 3-Warning, 4-Error, 5-Question, 6-Simple\n");
return res;
}
int main( int argc, char* argv[] ){
LONG s = sounds[0];
if( argc > 2 )
return usage( 1 );
if( argc == 2 ){
if( !strcmp( argv[1], "-h" ) )
return usage( 0 );
if( atoi( argv[1] ) < 1 || atoi( argv[1] ) > sizeof(sounds)/sizeof(LONG) )
return usage( 1 );
s=sounds[atoi( argv[1] ) - 1];
}
MessageBeep( s );
Sleep( 250 );
return 0;
}