summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Pierezan Camargo (camargo) <tcamargo@gmail.com>2007-10-21 19:37:58 +0000
committerTiago Pierezan Camargo (camargo) <tcamargo@gmail.com>2007-10-21 19:37:58 +0000
commitc25db55a82a9ed66cb3b0af2bca540f872501e31 (patch)
treefd2e5ee72e5d61ad33b25a0aeeeeba546d2b7944 /games-emulation/sdlmame/files/0.120a/wolf120.patch
parentnet-p2p/freenet/ChangeLog: Changed email (diff)
downloadsunrise-c25db55a82a9ed66cb3b0af2bca540f872501e31.tar.gz
sunrise-c25db55a82a9ed66cb3b0af2bca540f872501e31.tar.bz2
sunrise-c25db55a82a9ed66cb3b0af2bca540f872501e31.zip
wolfmame patches for sdlmame-0.120a
svn path=/sunrise/; revision=4832
Diffstat (limited to 'games-emulation/sdlmame/files/0.120a/wolf120.patch')
-rw-r--r--games-emulation/sdlmame/files/0.120a/wolf120.patch238
1 files changed, 238 insertions, 0 deletions
diff --git a/games-emulation/sdlmame/files/0.120a/wolf120.patch b/games-emulation/sdlmame/files/0.120a/wolf120.patch
new file mode 100644
index 000000000..555b624b1
--- /dev/null
+++ b/games-emulation/sdlmame/files/0.120a/wolf120.patch
@@ -0,0 +1,238 @@
+diff -Nru base0120/src/emu/inptport.c w0120/src/emu/inptport.c
+--- base0120/src/emu/inptport.c 2007-09-29 15:57:09.000000000 +1200
++++ w0120/src/emu/inptport.c 2007-10-16 00:36:35.000000000 +1300
+@@ -90,6 +90,7 @@
+ except that the accumulated deltas are not bounded, but rather wrap.
+
+ ***************************************************************************/
++#define _USE_32BIT_TIME_T // VC2005 uses a 64-bit time_t structure by default
+
+ #include "osdepend.h"
+ #include "driver.h"
+@@ -270,7 +271,7 @@
+ static input_port_entry *input_ports_default;
+
+ /* recorded speed read from an INP file */
+-static double rec_speed;
++double rec_speed;
+
+ /* set to 1 if INP file being played is a standard MAME INP file */
+ static int no_extended_inp;
+@@ -322,8 +323,6 @@
+ input_port_28_dword_r, input_port_29_dword_r, input_port_30_dword_r, input_port_31_dword_r
+ };
+
+-
+-
+ /***************************************************************************
+ COMMON SHARED STRINGS
+ ***************************************************************************/
+@@ -444,6 +443,8 @@
+ { INPUT_STRING_None, "None" }
+ };
+
++/* set to 1 if INP file being played is a standard MAME INP file */
++int isnotext;
+
+
+ /***************************************************************************
+@@ -1225,8 +1226,9 @@
+ static void setup_record(running_machine *machine)
+ {
+ const char *filename = options_get_string(mame_options(), OPTION_RECORD);
+- inp_header inpheader;
++ //inp_header inpheader;
+ file_error filerr;
++ struct ext_header xheader;
+
+ /* if no file, nothing to do */
+ if (filename[0] == 0)
+@@ -1236,10 +1238,16 @@
+ filerr = mame_fopen(SEARCHPATH_INPUTLOG, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &machine->record_file);
+ assert_always(filerr == FILERR_NONE, "Failed to open file for recording");
+
++ /* disable cheats */
++ options_set_bool(mame_options(),OPTION_CHEAT,0,OPTION_PRIORITY_MAXIMUM);
++
+ /* create a header */
+- memset(&inpheader, 0, sizeof(inpheader));
+- strcpy(inpheader.name, machine->gamedrv->name);
+- mame_fwrite(machine->record_file, &inpheader, sizeof(inpheader));
++ memset(&xheader, '\0', sizeof(struct ext_header));
++ strcpy(xheader.header, "XINP\0\0\0");
++ strcpy(xheader.shortname, machine->gamedrv->name);
++ strcpy(xheader.version, build_version);
++ xheader.starttime = (long)time(NULL);
++ mame_fwrite(Machine->record_file, &xheader, sizeof(struct ext_header));
+ }
+
+
+@@ -1255,8 +1263,13 @@
+ /* close any playback or recording files */
+ if (machine->playback_file != NULL)
+ mame_fclose(machine->playback_file);
+- if (machine->record_file != NULL)
+- mame_fclose(machine->record_file);
++ if (machine->record_file != NULL)
++ {
++ long val = (long)time(NULL);
++ mame_fseek(machine->record_file,52,SEEK_SET);
++ mame_fwrite(machine->record_file,&val,sizeof(long));
++ mame_fclose(machine->record_file);
++ }
+ }
+
+
+@@ -2789,7 +2802,7 @@
+ }
+ }
+ }
+-
++ else // because re-recording is cheating
+ /* handle recording */
+ if (Machine->record_file != NULL)
+ {
+@@ -2962,7 +2975,7 @@
+ /* note that analog ports are handled instantaneously at port read time */
+ }
+ }
+-
++
+ #ifdef MESS
+ /* less MESS to MESSy things */
+ inputx_update();
+@@ -2997,6 +3010,15 @@
+ update_playback_record(portnum, readinputport(portnum));
+ }
+
++ /* record speed */
++ if(Machine->record_file != NULL)
++ {
++ double speed = video_get_speed_percent();
++ long marker = 0x00ABCDEF; // end of frame marker
++ mame_fwrite(Machine->record_file,&speed,sizeof(double));
++ mame_fwrite(Machine->record_file,&marker,sizeof(long));
++ }
++
+ /* store speed read from INP file, if extended INP */
+ if (Machine->playback_file != NULL && !no_extended_inp)
+ {
+diff -Nru base0120/src/emu/ui.c w0120/src/emu/ui.c
+--- base0120/src/emu/ui.c 2007-09-07 04:42:07.000000000 +1200
++++ w0120/src/emu/ui.c 2007-10-16 00:30:13.000000000 +1300
+@@ -321,7 +321,7 @@
+ int state;
+
+ /* disable everything if we are using -str */
+- if (!first_time || (str > 0 && str < 60*5) || Machine->gamedrv == &driver_empty)
++ if (!first_time || (str > 0 && str < 60*5) || Machine->gamedrv == &driver_empty || Machine->record_file)
+ show_gameinfo = show_warnings = show_disclaimer = FALSE;
+
+ /* initialize the on-screen display system */
+@@ -1283,7 +1283,7 @@
+ mame_schedule_soft_reset(Machine);
+
+ /* handle a request to display graphics/palette */
+- if (input_ui_pressed(IPT_UI_SHOW_GFX))
++ if (input_ui_pressed(IPT_UI_SHOW_GFX) && !Machine->record_file)
+ {
+ if (!is_paused)
+ mame_pause(Machine, TRUE);
+@@ -1291,14 +1291,14 @@
+ }
+
+ /* handle a save state request */
+- if (input_ui_pressed(IPT_UI_SAVE_STATE))
++ if (input_ui_pressed(IPT_UI_SAVE_STATE) && !Machine->record_file)
+ {
+ mame_pause(Machine, TRUE);
+ return ui_set_handler(handler_load_save, LOADSAVE_SAVE);
+ }
+
+ /* handle a load state request */
+- if (input_ui_pressed(IPT_UI_LOAD_STATE))
++ if (input_ui_pressed(IPT_UI_LOAD_STATE) && !Machine->record_file)
+ {
+ mame_pause(Machine, TRUE);
+ return ui_set_handler(handler_load_save, LOADSAVE_LOAD);
+@@ -1309,7 +1309,7 @@
+ video_save_active_screen_snapshots(Machine);
+
+ /* toggle pause */
+- if (input_ui_pressed(IPT_UI_PAUSE))
++ if (input_ui_pressed(IPT_UI_PAUSE) && !Machine->record_file)
+ {
+ /* with a shift key, it is single step */
+ if (is_paused && (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT)))
+@@ -1375,11 +1375,11 @@
+ }
+
+ /* toggle throttle? */
+- if (input_ui_pressed(IPT_UI_THROTTLE))
++ if (input_ui_pressed(IPT_UI_THROTTLE) && !Machine->record_file)
+ video_set_throttle(!video_get_throttle());
+
+ /* check for fast forward */
+- if (input_port_type_pressed(IPT_UI_FAST_FORWARD, 0))
++ if (input_port_type_pressed(IPT_UI_FAST_FORWARD, 0) && !Machine->record_file)
+ {
+ video_set_fastforward(TRUE);
+ ui_show_fps_temp(0.5);
+diff -Nru base0120/src/emu/uimenu.c w0120/src/emu/uimenu.c
+--- base0120/src/emu/uimenu.c 2007-09-23 09:27:43.000000000 +1200
++++ w0120/src/emu/uimenu.c 2007-10-16 00:32:08.000000000 +1300
+@@ -631,7 +631,7 @@
+ *selected = num_items - 1;
+
+ /* pause enables/disables pause */
+- if (input_ui_pressed(IPT_UI_PAUSE))
++ if (input_ui_pressed(IPT_UI_PAUSE) && !Machine->record_file)
+ mame_pause(Machine, !mame_is_paused(Machine));
+
+ return 0;
+diff -Nru base0120/src/emu/video.c w0120/src/emu/video.c
+--- base0120/src/emu/video.c 2007-09-29 03:06:28.000000000 +1200
++++ w0120/src/emu/video.c 2007-10-16 00:30:13.000000000 +1300
+@@ -157,7 +157,9 @@
+ { 0,1,1,1,1,1,1,1,1,1,1,1 }
+ };
+
+-
++// speed recorded in INP file
++extern double rec_speed;
++extern int isnotext;
+
+ /***************************************************************************
+ FUNCTION PROTOTYPES
+@@ -1216,6 +1218,10 @@
+ if (global.partial_updates_this_frame > 1)
+ dest += sprintf(dest, "\n%d partial updates", global.partial_updates_this_frame);
+
++ /* display recorded speed on playback */
++ if(Machine->playback_file != NULL && !isnotext)
++ dest += sprintf(dest,"\n Recorded speed %f%%", rec_speed);
++
+ /* return a pointer to the static buffer */
+ return buffer;
+ }
+@@ -2193,6 +2199,10 @@
+ }
+ }
+
++double video_get_speed_percent(void)
++{
++ return global.speed_percent;
++}
+
+
+ /***************************************************************************
+diff -Nru base0120/src/emu/video.h w0120/src/emu/video.h
+--- base0120/src/emu/video.h 2007-08-31 04:45:52.000000000 +1200
++++ w0120/src/emu/video.h 2007-10-16 00:30:13.000000000 +1300
+@@ -166,4 +166,6 @@
+
+ void video_crosshair_toggle(void);
+
++double video_get_speed_percent(void);
++
+ #endif /* __VIDEO_H__ */