From 057e3dc2282c89200436b93b7b5ecf2101b745c0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 24 May 2008 17:28:09 +0300 Subject: [PATCH] imported winuaesrc1500b20.zip --- audio.c | 106 +++++++++++-------- blitter.c | 16 ++- cfgfile.c | 2 + cia.c | 52 +++++++-- custom.c | 16 +-- drawing.c | 22 ++-- filesys.c | 23 +--- fsusage.c | 3 +- include/audio.h | 4 +- include/custom.h | 2 +- include/execlib.h | 2 + include/gui.h | 1 + include/options.h | 5 +- include/savestate.h | 6 +- include/uaeresource.h | 3 + inputdevice.c | 47 +++++---- main.c | 4 +- memory.c | 37 +++---- od-win32/cloanto/RetroPlatformIPC.h | 11 +- od-win32/dinput.c | 5 + od-win32/direct3d.c | 107 ++++++++++--------- od-win32/opengl.c | 38 +++---- od-win32/picasso96_win.c | 2 +- od-win32/resources/resource.h | 2 + od-win32/resources/winuae.rc | 2 + od-win32/rp.c | 34 +++++- od-win32/sounddep/sound.c | 11 +- od-win32/sounddep/sound.h | 10 +- od-win32/win32.c | 22 ++-- od-win32/win32.h | 4 +- od-win32/win32gui.c | 13 +-- od-win32/winuae_msvc/winuae_msvc.vcproj | 4 + od-win32/winuaechangelog.txt | 17 +++ savestate.c | 12 ++- scsiemul.c | 2 +- uaeresource.c | 134 ++++++++++++++++++++++++ uaeserial.c | 4 +- 37 files changed, 541 insertions(+), 244 deletions(-) create mode 100755 include/uaeresource.h create mode 100755 uaeresource.c diff --git a/audio.c b/audio.c index 8408ebd7..9a2350af 100755 --- a/audio.c +++ b/audio.c @@ -732,6 +732,13 @@ static void sample16i_crux_handler (void) #ifdef HAVE_STEREO_SUPPORT +static void make6ch (uae_s32 d0, uae_s32 d1, uae_s32 d2, uae_s32 d3) +{ + uae_s32 sum = d0 + d1 + d2 + d3; + PUT_SOUND_WORD (sum >> 1); + PUT_SOUND_WORD (sum >> 1); +} + void sample16ss_handler (void) { uae_u32 data0 = audio_channel[0].current_sample; @@ -750,10 +757,8 @@ void sample16ss_handler (void) put_sound_word_left (data0 << 2); put_sound_word_right (data1 << 2); - if (currprefs.sound_stereo == SND_6CH) { - PUT_SOUND_WORD (0); - PUT_SOUND_WORD (0); - } + if (currprefs.sound_stereo == SND_6CH) + make6ch (data0, data1, data2, data3); put_sound_word_left2 (data3 << 2); put_sound_word_right2 (data2 << 2); @@ -770,10 +775,8 @@ void sample16ss_anti_handler (void) samplexx_anti_handler (datas); put_sound_word_left (datas[0] << 2); put_sound_word_right (datas[1] << 2); - if (currprefs.sound_stereo == SND_6CH) { - PUT_SOUND_WORD (0); - PUT_SOUND_WORD (0); - } + if (currprefs.sound_stereo == SND_6CH) + make6ch (datas[0], datas[1], datas[2], datas[3]); put_sound_word_left2 (datas[3] << 2); put_sound_word_right2 (datas[2] << 2); check_sound_buffers (); @@ -800,10 +803,8 @@ void sample16ss_sinc_handler (void) samplexx_sinc_handler (datas); put_sound_word_left (datas[0] << 2); put_sound_word_right (datas[1] << 2); - if (currprefs.sound_stereo == SND_6CH) { - PUT_SOUND_WORD (0); - PUT_SOUND_WORD (0); - } + if (currprefs.sound_stereo == SND_6CH) + make6ch (datas[0], datas[1], datas[2], datas[3]); put_sound_word_left2 (datas[3] << 2); put_sound_word_right2 (datas[2] << 2); check_sound_buffers (); @@ -1302,20 +1303,24 @@ void audio_reset (void) STATIC_INLINE int sound_prefs_changed (void) { - return (changed_prefs.produce_sound != currprefs.produce_sound + if (changed_prefs.produce_sound != currprefs.produce_sound || changed_prefs.win32_soundcard != currprefs.win32_soundcard || changed_prefs.sound_stereo != currprefs.sound_stereo - || changed_prefs.sound_stereo_separation != currprefs.sound_stereo_separation - || changed_prefs.sound_mixed_stereo_delay != currprefs.sound_mixed_stereo_delay || changed_prefs.sound_maxbsiz != currprefs.sound_maxbsiz || changed_prefs.sound_freq != currprefs.sound_freq - || changed_prefs.sound_auto != currprefs.sound_auto + || changed_prefs.sound_auto != currprefs.sound_auto) + return 1; + + if (changed_prefs.sound_stereo_separation != currprefs.sound_stereo_separation + || changed_prefs.sound_mixed_stereo_delay != currprefs.sound_mixed_stereo_delay || changed_prefs.sound_interpol != currprefs.sound_interpol || changed_prefs.sound_volume != currprefs.sound_volume || changed_prefs.sound_stereo_swap_paula != currprefs.sound_stereo_swap_paula || changed_prefs.sound_stereo_swap_ahi != currprefs.sound_stereo_swap_ahi || changed_prefs.sound_filter != currprefs.sound_filter - || changed_prefs.sound_filter_type != currprefs.sound_filter_type); + || changed_prefs.sound_filter_type != currprefs.sound_filter_type) + return -1; + return 0; } /* This computes the 1st order low-pass filter term b0. @@ -1340,56 +1345,72 @@ static float rc_calculate_a0(int sample_rate, int cutoff_freq) void check_prefs_changed_audio (void) { + int ch; #ifdef DRIVESOUND driveclick_check_prefs (); #endif - if (!sound_available || !sound_prefs_changed ()) + if (!sound_available) + return; + ch = sound_prefs_changed (); + if (!ch) return; + if (ch > 0) { #ifdef AVIOUTPUT - AVIOutput_Restart (); + AVIOutput_Restart (); #endif - clear_sound_buffers(); - set_audio(); + clear_sound_buffers (); + } + set_audio (); audio_activate(); } -void set_audio(void) +void set_audio (void) { int old_mixed_on = mixed_on; int old_mixed_size = mixed_stereo_size; int sep, delay; + int ch; + + + ch = sound_prefs_changed (); + if (ch >= 0) + close_sound (); - close_sound (); currprefs.produce_sound = changed_prefs.produce_sound; currprefs.win32_soundcard = changed_prefs.win32_soundcard; currprefs.sound_stereo = changed_prefs.sound_stereo; - currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation; - currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; currprefs.sound_auto = changed_prefs.sound_auto; - currprefs.sound_interpol = changed_prefs.sound_interpol; currprefs.sound_freq = changed_prefs.sound_freq; currprefs.sound_maxbsiz = changed_prefs.sound_maxbsiz; + + currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation; + currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; + currprefs.sound_interpol = changed_prefs.sound_interpol; currprefs.sound_filter = changed_prefs.sound_filter; currprefs.sound_filter_type = changed_prefs.sound_filter_type; currprefs.sound_volume = changed_prefs.sound_volume; currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula; currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi; - if (currprefs.produce_sound >= 2) { - if (!init_audio ()) { - if (! sound_available) { - write_log ("Sound is not supported.\n"); - } else { - write_log ("Sorry, can't initialize sound.\n"); - currprefs.produce_sound = 0; - /* So we don't do this every frame */ - changed_prefs.produce_sound = 0; + if (ch >= 0) { + if (currprefs.produce_sound >= 2) { + if (!init_audio ()) { + if (! sound_available) { + write_log ("Sound is not supported.\n"); + } else { + write_log ("Sorry, can't initialize sound.\n"); + currprefs.produce_sound = 0; + /* So we don't do this every frame */ + changed_prefs.produce_sound = 0; + } } } + next_sample_evtime = scaled_sample_evtime; + last_cycles = get_cycles () - 1; + compute_vsynctime (); + } else { + sound_volume (0); } - next_sample_evtime = scaled_sample_evtime; - last_cycles = get_cycles () - 1; - compute_vsynctime (); sep = (currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation) * 3 / 2; delay = currprefs.sound_mixed_stereo_delay = changed_prefs.sound_mixed_stereo_delay; @@ -1414,10 +1435,10 @@ void set_audio(void) else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A1200) sound_use_filter = FILTER_MODEL_A1200; } - a500e_filter1_a0 = rc_calculate_a0(currprefs.sound_freq, 6200); - a500e_filter2_a0 = rc_calculate_a0(currprefs.sound_freq, 20000); - filter_a0 = rc_calculate_a0(currprefs.sound_freq, 7000); - led_filter_audio(); + a500e_filter1_a0 = rc_calculate_a0 (currprefs.sound_freq, 6200); + a500e_filter2_a0 = rc_calculate_a0 (currprefs.sound_freq, 20000); + filter_a0 = rc_calculate_a0 (currprefs.sound_freq, 7000); + led_filter_audio (); /* Select the right interpolation method. */ if (sample_handler == sample16_handler @@ -1776,7 +1797,6 @@ void led_filter_audio (void) led_filter_on = 0; if (led_filter_forced > 0 || (gui_data.powerled && led_filter_forced >= 0)) led_filter_on = 1; - gui_led (0, gui_data.powerled); } uae_u8 *restore_audio (int i, uae_u8 *src) diff --git a/blitter.c b/blitter.c index b57d5677..979a330c 100755 --- a/blitter.c +++ b/blitter.c @@ -826,6 +826,20 @@ void decide_blitter (int hpos) #endif if (!blitter_cycle_exact) return; + + if (blit_linecyclecounter > 0) { + while (blit_linecyclecounter > 0 && blit_last_hpos < hpos) { + blit_linecyclecounter--; + blit_last_hpos++; + } + if (blit_last_hpos > maxhpos) + blit_last_hpos = 0; + } + if (blit_linecyclecounter > 0) { + blit_last_hpos = hpos; + return; + } + if (blitline) { blt_info.got_cycle = 1; decide_blitter_line (hpos); @@ -1075,7 +1089,7 @@ void do_blitter (int hpos) blitter_vcounter1 = blitter_vcounter2 = 0; if (blit_nod) blitter_vcounter2 = blt_info.vblitsize; - blit_linecyclecounter = 0; + blit_linecyclecounter = 2; if (blit_ch == 0) blit_maxcyclecounter = blt_info.hblitsize * blt_info.vblitsize; return; diff --git a/cfgfile.c b/cfgfile.c index ea91e0c7..97a01a1d 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -2829,6 +2829,8 @@ void default_prefs (struct uae_prefs *p, int type) p->ghostscript_parameters[0] = 0; p->uae_hide = 0; + memset (&p->jports[0], 0, sizeof (struct jport)); + memset (&p->jports[1], 0, sizeof (struct jport)); p->jports[0].id = JSEM_MICE; p->jports[1].id = JSEM_KBDLAYOUT; p->keyboard_lang = KBD_LANG_US; diff --git a/cia.c b/cia.c index c3e8cbd4..ed0bc99f 100755 --- a/cia.c +++ b/cia.c @@ -56,7 +56,7 @@ static unsigned long ciaata_passed, ciaatb_passed, ciabta_passed, ciabtb_passed; static unsigned long ciaatod, ciabtod, ciaatol, ciabtol, ciaaalarm, ciabalarm; static int ciaatlatch, ciabtlatch; -static int oldled, oldovl; +static int oldled, oldovl, led_changed; unsigned int ciabpra; @@ -473,8 +473,43 @@ static void tod_hack_reset (void) } #endif -void CIA_vsync_handler () +static int led_times; +static unsigned long led_on, led_cycle; + + +static void calc_led (int old_led) { + unsigned long c = get_cycles (); + unsigned long t = c - led_cycle; + if (old_led) + led_on += t; + led_times++; + led_cycle = c; +} + +static void led_vsync (void) +{ + gui_data.powerled_brightness = gui_data.powerled ? 255 : 0; + calc_led (gui_data.powerled); + if (led_on > 0 && led_times > 2) { + int v = led_on / CYCLE_UNIT * 256 / (maxhpos * maxvpos); + if (v < 0) + v = 0; + if (v > 255) + v = 255; + gui_data.powerled_brightness = v; + } + led_on = 0; + led_times = 0; + if (led_changed) + gui_led (0, gui_data.powerled_brightness); + led_changed = 0; + led_cycle = get_cycles (); +} + +void CIA_vsync_handler (void) +{ + led_vsync (); #ifdef TOD_HACK if (currprefs.tod_hack && ciaatodon) { struct timeval tv; @@ -511,12 +546,15 @@ void CIA_vsync_handler () static void bfe001_change (void) { uae_u8 v = ciaapra; - + int led; + v |= ~ciaadra; /* output is high when pin's direction is input */ - if ((v & 2) != oldled) { - int led = (v & 2) ? 0 : 1; - oldled = v & 2; + led = (v & 2) ? 0 : 1; + if (led != oldled) { + calc_led (oldled); + oldled = led; gui_data.powerled = led; + led_changed = 1; led_filter_audio (); } if (currprefs.cs_ciaoverlay && (v & 1) != oldovl) { @@ -1352,7 +1390,7 @@ static void write_battclock (void) zfile_fclose (f); } -void rtc_hardreset(void) +void rtc_hardreset (void) { if (currprefs.cs_rtc == 1) { /* MSM6242B */ clock_bank.name = "Battery backed up clock (MSM6242B)"; diff --git a/custom.c b/custom.c index 1a2f1061..f7055ef4 100755 --- a/custom.c +++ b/custom.c @@ -174,7 +174,7 @@ int minfirstline = VBLANK_ENDLINE_PAL; int vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_skip, doublescan; frame_time_t syncbase; static int fmode; -unsigned int beamcon0, new_beamcon0; +uae_u16 beamcon0, new_beamcon0; uae_u16 vtotal = MAXVPOS_PAL, htotal = MAXHPOS_PAL; static uae_u16 hsstop, hbstrt, hbstop, vsstop, vbstrt, vbstop, hsstrt, vsstrt, hcenter; static int interlace_started; @@ -2052,7 +2052,7 @@ static int tospritexddf (int ddf) static void calcsprite (void) { - sprite_maxx = max_diwlastword; + sprite_maxx = 0x7fff; sprite_minx = 0; if (thisline_decision.diwlastword >= 0) sprite_maxx = tospritexdiw (thisline_decision.diwlastword); @@ -4488,7 +4488,7 @@ static void copper_check (int n) } } -static void CIA_vsync_prehandler(void) +static void CIA_vsync_prehandler (void) { CIA_vsync_handler (); #if 0 @@ -4542,10 +4542,10 @@ static void hsync_handler (void) if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) { decide_blitter (hpos); memset (cycle_line, 0, sizeof cycle_line); - alloc_cycle(1, CYCLE_REFRESH); - alloc_cycle(3, CYCLE_REFRESH); - alloc_cycle(5, CYCLE_REFRESH); - alloc_cycle(7, CYCLE_REFRESH); + alloc_cycle (1, CYCLE_REFRESH); /* strobe */ + alloc_cycle (3, CYCLE_REFRESH); + alloc_cycle (5, CYCLE_REFRESH); + alloc_cycle (7, CYCLE_REFRESH); } #endif @@ -4556,7 +4556,7 @@ static void hsync_handler (void) static int cia_hsync; cia_hsync -= 256; if (cia_hsync <= 0) { - CIA_vsync_prehandler(); + CIA_vsync_prehandler (); cia_hsync += ((MAXVPOS_PAL * MAXHPOS_PAL * 50 * 256) / (maxhpos * (currprefs.cs_ciaatod == 2 ? 60 : 50))); } } diff --git a/drawing.c b/drawing.c index 85d8f493..f5f5c441 100755 --- a/drawing.c +++ b/drawing.c @@ -1993,9 +1993,15 @@ static void center_image (void) visible_left_border = prev_x_adjust; } } else { - visible_left_border = max_diwlastword - gfxvidinfo.width; - if (doublescan) - visible_left_border = (max_diwlastword - 48) / 2 - gfxvidinfo.width; + if (beamcon0 & 0x80) { + int w = gfxvidinfo.width; + if (max_diwstop - min_diwstart < w) + visible_left_border = (max_diwstop - min_diwstart - w) / 2 + min_diwstart; + else + visible_left_border = max_diwstop - w - (max_diwstop - min_diwstart - w) / 2; + } else { + visible_left_border = max_diwlastword - gfxvidinfo.width; + } } if (currprefs.gfx_xcenter_pos >= 0) { int val = currprefs.gfx_xcenter_pos >> RES_MAX; @@ -2261,8 +2267,10 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u side = gui_data.drive_side; } else if (led == 0) { pos = 3; + //on = gui_data.powerled_brightness > 0; + on_rgb = ((gui_data.powerled_brightness * 10 / 16) + 0x33) << 16; on = gui_data.powerled; - on_rgb = 0xcc0000; + //on_rgb = 0xcc0000; off_rgb = 0x330000; } else if (led == 5) { pos = 5; @@ -2753,8 +2761,10 @@ void reset_drawing (void) lightpen_y1 = lightpen_y2 = -1; sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES; - if (sprite_buffer_res > currprefs.gfx_resolution) - sprite_buffer_res = currprefs.gfx_resolution; + if (sprite_buffer_res > currprefs.gfx_resolution + (doublescan ? 1 : 0)) + sprite_buffer_res = currprefs.gfx_resolution + (doublescan ? 1 : 0); + if (sprite_buffer_res > RES_SUPERHIRES) + sprite_buffer_res = RES_SUPERHIRES; } void drawing_init (void) diff --git a/filesys.c b/filesys.c index 203d7302..e4d21e00 100755 --- a/filesys.c +++ b/filesys.c @@ -47,6 +47,7 @@ #include "a2091.h" #include "cdtv.h" #include "sana2.h" +#include "uaeresource.h" #define TRACING_ENABLED 0 #if TRACING_ENABLED @@ -4776,26 +4777,6 @@ void filesys_prepare_reset (void) } } -/* -static uaecptr uaeresource_startup (uaecptr resaddr) -{ - uaecptr ROM_uaeresource_resname, ROM_uaeresource_resid; - - ROM_uaeresource_resname = ds ("uae.resource"); - ROM_uaeresource_resid = ds ("uae.resource 0.1"); - put_word (resaddr + 0x0, 0x4AFC); - put_long (resaddr + 0x2, resaddr); - put_long (resaddr + 0x6, resaddr + 0x1A); // Continue scan here - put_word (resaddr + 0xA, 0x0001); // RTF_COLDSTART; Version 1 - put_word (resaddr + 0xC, 0x0801); // NT_RESOURCE; pri 01 - put_long (resaddr + 0xE, ROM_uaeresource_resname); - put_long (resaddr + 0x12, ROM_uaeresource_resid); - put_long (resaddr + 0x16, 0); - resaddr += 0x1A; - return resaddr; -} -*/ - static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) { uaecptr resaddr = m68k_areg (&context->regs, 2) + 0x10; @@ -4830,7 +4811,7 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) * Resident structures and call InitResident() for them at the end of the * diag entry. */ - //resaddr = uaeresource_startup(resaddr); + resaddr = uaeres_startup (resaddr); #ifdef SCSIEMU resaddr = scsidev_startup (resaddr); #endif diff --git a/fsusage.c b/fsusage.c index 2443f919..2259911a 100755 --- a/fsusage.c +++ b/fsusage.c @@ -73,8 +73,7 @@ int get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) buf2[3] = 0; } - if (!GetDiskFreeSpaceEx (buf2, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) - { + if (!GetDiskFreeSpaceEx (buf2, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) { write_log ("GetDiskFreeSpaceEx() failed err=%d\n", GetLastError()); return -1; } diff --git a/include/audio.h b/include/audio.h index d0c9fea2..0d772326 100755 --- a/include/audio.h +++ b/include/audio.h @@ -31,8 +31,8 @@ extern void audio_update_adkmasks (void); extern void audio_update_irq (uae_u16); extern void update_sound (int freq); extern void led_filter_audio (void); -extern void set_audio(void); -extern int audio_activate(void); +extern void set_audio (void); +extern int audio_activate (void); extern void audio_sampleripper(int); extern int sampleripper_enabled; diff --git a/include/custom.h b/include/custom.h index bd6d96d1..d20813d0 100755 --- a/include/custom.h +++ b/include/custom.h @@ -130,7 +130,7 @@ extern frame_time_t syncbase; extern unsigned long frametime, timeframes; extern int plfstrt, plfstop, plffirstline, plflastline; -extern uae_u16 htotal, vtotal; +extern uae_u16 htotal, vtotal, beamcon0; /* 100 words give you 1600 horizontal pixels. Should be more than enough for * superhires. Don't forget to update the definition in genp2c.c as well. diff --git a/include/execlib.h b/include/execlib.h index 362bc6ce..c1fe0513 100755 --- a/include/execlib.h +++ b/include/execlib.h @@ -32,6 +32,8 @@ #define NT_LIBRARY 9 #define NT_SIGNALSEM 15 +#define SIZEOF_LIBRARY 34 + #ifndef MEMF_PUBLIC /* protection for AmigaDOS */ #define MEMF_PUBLIC 1 #define MEMF_CHIP 2 diff --git a/include/gui.h b/include/gui.h index 407fb263..1f777c4d 100755 --- a/include/gui.h +++ b/include/gui.h @@ -30,6 +30,7 @@ struct gui_info uae_u8 drive_writing[4]; /* drive is writing */ uae_u8 drive_disabled[4]; /* drive is disabled */ uae_u8 powerled; /* state of power led */ + uae_u8 powerled_brightness; /* 0 to 255 */ uae_u8 drive_side; /* floppy side */ uae_u8 hd; /* harddrive */ uae_u8 cd; /* CD */ diff --git a/include/options.h b/include/options.h index 8a78877f..3e5cce00 100755 --- a/include/options.h +++ b/include/options.h @@ -40,10 +40,11 @@ struct uae_input_device { uae_u8 enabled; }; +#define MAX_JPORTNAME 128 struct jport { int id; - char *name; - char *configname; + char name[MAX_JPORTNAME]; + char configname[MAX_JPORTNAME]; }; #define MAX_SPARE_DRIVES 20 diff --git a/include/savestate.h b/include/savestate.h index a804b735..b7b42944 100755 --- a/include/savestate.h +++ b/include/savestate.h @@ -130,9 +130,9 @@ extern uae_u8 *save_action_replay (int *, uae_u8 *); extern uae_u8 *restore_hrtmon (uae_u8 *); extern uae_u8 *save_hrtmon (int *, uae_u8 *); -extern void savestate_initsave (char *filename, int docompress); -extern int save_state (char *filename, char *description); -extern void restore_state (char *filename); +extern void savestate_initsave (const char *filename, int docompress, int nodialogs); +extern int save_state (const char *filename, const char *description); +extern void restore_state (const char *filename); extern void savestate_restore_finish (void); extern void custom_save_state (void); diff --git a/include/uaeresource.h b/include/uaeresource.h new file mode 100755 index 00000000..46828d45 --- /dev/null +++ b/include/uaeresource.h @@ -0,0 +1,3 @@ + +uaecptr uaeres_startup (uaecptr resaddr); +void uaeres_install (void); \ No newline at end of file diff --git a/inputdevice.c b/inputdevice.c index fed440c8..5245014f 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -399,6 +399,19 @@ struct input_queue_struct { }; static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE]; + +static void freejport (struct uae_prefs *dst, int num) +{ + memset (&dst->jports[num], 0, sizeof (struct jport)); +} +static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int num) +{ + freejport (dst, num); + strcpy (dst->jports[num].configname, src->jports[num].configname); + strcpy (dst->jports[num].name, src->jports[num].name); + dst->jports[num].id = src->jports[num].id; +} + static void out_config (struct zfile *f, int id, int num, char *s1, char *s2) { cfgfile_write (f, "input.%d.%s%d=%s\n", id, s1, num, s2); @@ -1630,7 +1643,7 @@ void inputdevice_handle_inputcode (void) sound_volume (1); break; case AKS_VOLMUTE: - sound_volume (0); + sound_mute (0); break; case AKS_MVOLDOWN: master_sound_volume (-1); @@ -2314,12 +2327,8 @@ static void compatibility_mode (struct uae_prefs *prefs) int joy, i; int used[4] = { 0, 0, 0, 0}; - for (i = 0; i < 2; i++) { - xfree (prefs->jports[i].name); - xfree (prefs->jports[i].configname); - prefs->jports[i].name = NULL; - prefs->jports[i].configname = NULL; - } + prefs->jports[0].name[0] = prefs->jports[1].name[0] = 0; + prefs->jports[0].configname[0] = prefs->jports[1].configname[0] = 0; compatibility_device[0] = -1; compatibility_device[1] = -1; for (i = 0; i < MAX_INPUT_DEVICES; i++) { @@ -2330,14 +2339,14 @@ static void compatibility_mode (struct uae_prefs *prefs) if ((joy = jsem_ismouse (0, prefs)) >= 0) { input_get_default_mouse (mice, joy, 0); mice[joy].enabled = 1; - prefs->jports[0].name = my_strdup (idev[IDTYPE_MOUSE].get_friendlyname (joy)); - prefs->jports[0].configname = my_strdup (idev[IDTYPE_MOUSE].get_uniquename (joy)); + strncpy (prefs->jports[0].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1); + strncpy (prefs->jports[0].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1); } if ((joy = jsem_ismouse (1, prefs)) >= 0) { input_get_default_mouse (mice, joy, 1); mice[joy].enabled = 1; - prefs->jports[1].name = my_strdup (idev[IDTYPE_MOUSE].get_friendlyname (joy)); - prefs->jports[1].configname = my_strdup (idev[IDTYPE_MOUSE].get_uniquename (joy)); + strncpy (prefs->jports[1].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1); + strncpy (prefs->jports[1].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1); } joy = jsem_isjoy (1, prefs); @@ -2345,8 +2354,8 @@ static void compatibility_mode (struct uae_prefs *prefs) used[joy] = 1; input_get_default_joystick (joysticks, joy, 1); joysticks[joy].enabled = 1; - prefs->jports[1].name = my_strdup (idev[IDTYPE_JOYSTICK].get_friendlyname (joy)); - prefs->jports[1].configname = my_strdup (idev[IDTYPE_JOYSTICK].get_uniquename (joy)); + strncpy (prefs->jports[1].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); + strncpy (prefs->jports[1].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); } joy = jsem_isjoy (0, prefs); @@ -2354,8 +2363,8 @@ static void compatibility_mode (struct uae_prefs *prefs) used[joy] = 1; input_get_default_joystick (joysticks, joy, 0); joysticks[joy].enabled = 1; - prefs->jports[0].name = my_strdup (idev[IDTYPE_JOYSTICK].get_friendlyname (joy)); - prefs->jports[0].configname = my_strdup (idev[IDTYPE_JOYSTICK].get_uniquename (joy)); + strncpy (prefs->jports[0].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1); + strncpy (prefs->jports[0].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1); } for (joy = 0; used[joy]; joy++); @@ -2441,8 +2450,8 @@ void inputdevice_updateconfig (struct uae_prefs *prefs) int m = jsem_ismouse (1, &currprefs); int k = jsem_iskbdjoy (1, &currprefs); - currprefs.jports[0].id = changed_prefs.jports[0].id; - currprefs.jports[1].id = changed_prefs.jports[1].id; + copyjport (&changed_prefs, &currprefs, 0); + copyjport (&changed_prefs, &currprefs, 1); #ifdef RETROPLATFORM rp_input_change (0); rp_input_change (1); @@ -2997,8 +3006,8 @@ void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst) dst->input_joymouse_speed = src->input_joymouse_speed; dst->input_mouse_speed = src->input_mouse_speed; dst->input_autofire_framecnt = src->input_autofire_framecnt; - dst->jports[0].id = src->jports[0].id; - dst->jports[1].id = src->jports[1].id; + copyjport (src, dst, 0); + copyjport (src, dst, 1); for (i = 0; i < MAX_INPUT_SETTINGS + 1; i++) { for (j = 0; j < MAX_INPUT_DEVICES; j++) { diff --git a/main.c b/main.c index 6722ceb6..ed349793 100755 --- a/main.c +++ b/main.c @@ -48,12 +48,13 @@ #include "sana2.h" #include "blkdev.h" #include "gfxfilter.h" +#include "uaeresource.h" #ifdef USE_SDL #include "SDL.h" #endif -long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV; +long int version = 256 * 65536L * UAEMAJOR + 65536L * UAEMINOR + UAESUBREV; struct uae_prefs currprefs, changed_prefs; @@ -742,6 +743,7 @@ static void real_main2 (int argc, char **argv) #endif #ifdef FILESYS rtarea_init (); + uaeres_install (); hardfile_install (); #endif savestate_init (); diff --git a/memory.c b/memory.c index ab67a7aa..3e041f93 100755 --- a/memory.c +++ b/memory.c @@ -1351,7 +1351,7 @@ void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b) static uae_u32 chipmem_dummy (void) { /* not really right but something random that has more ones than zeros.. */ - return rand () | rand (); + return 0xffff & ~((1 << (rand () & 31)) | (1 << (rand () & 31))); } void REGPARAM2 chipmem_dummy_bput (uaecptr addr, uae_u32 b) { @@ -1390,7 +1390,7 @@ static uae_u32 REGPARAM2 chipmem_dummy_lget (uaecptr addr) #ifdef JIT special_mem |= S_READ; #endif - return chipmem_dummy (); + return (chipmem_dummy () << 16) | chipmem_dummy (); } static uae_u32 REGPARAM2 chipmem_agnus_lget (uaecptr addr) @@ -2327,10 +2327,10 @@ addrbank custmem2_bank = { }; #define fkickmem_size 524288 +static int a3000_f0; void a3000_fakekick (int map) { static uae_u8 *blop; - static int f0; if (map) { uae_u8 *fkickmemory = a3000lmemory + allocated_a3000lmem - fkickmem_size; @@ -2341,29 +2341,27 @@ void a3000_fakekick (int map) if (fkickmemory[5] == 0xfc) { memcpy (kickmemory, fkickmemory, fkickmem_size / 2); memcpy (kickmemory + fkickmem_size / 2, fkickmemory, fkickmem_size / 2); - if (!extendedkickmemory) { - if (need_uae_boot_rom () != 0xf00000) { - extendedkickmem_size = 65536; - extendedkickmem_mask = extendedkickmem_size - 1; - extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0"); - extendedkickmem_bank.baseaddr = extendedkickmemory; - memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536); - map_banks (&extendedkickmem_bank, 0xf0, 1, 1); - f0 = 1; - } else { - write_log ("A3000 Bonus hack: can't map bonus when uae boot rom is enabled\n"); - } + if (need_uae_boot_rom () != 0xf00000) { + extendedkickmem_size = 65536; + extendedkickmem_mask = extendedkickmem_size - 1; + extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0"); + extendedkickmem_bank.baseaddr = extendedkickmemory; + memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536); + map_banks (&extendedkickmem_bank, 0xf0, 1, 1); + a3000_f0 = 1; + } else { + write_log ("A3000 Bonus hack: can't map bonus when uae boot rom is enabled\n"); } } else { memcpy (kickmemory, fkickmemory, fkickmem_size); } } } else { - if (f0) { + if (a3000_f0) { map_banks (&dummy_bank, 0xf0, 1, 1); mapped_free(extendedkickmemory); extendedkickmemory = NULL; - f0 = 0; + a3000_f0 = 0; } if (blop) memcpy (kickmemory, blop, fkickmem_size); @@ -2937,7 +2935,8 @@ static void delete_shmmaps (uae_u32 start, uae_u32 size) return; if (x->size > size) { - write_log ("NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n",start,x->size,size); + if (isdirectjit ()) + write_log ("NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n",start,x->size,size); size = x->size; } #if 0 @@ -3423,6 +3422,8 @@ void memory_reset (void) #ifdef AUTOCONFIG map_banks (&expamem_bank, 0xE8, 1, 0); #endif + if (a3000_f0) + a3000_fakekick (1); /* Map the chipmem into all of the lower 8MB */ map_overlay (1); diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index d2290d15..6985b225 100755 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -7,7 +7,7 @@ : License version 2 as published by the Free Software Foundation. Authors : os, mcb Created : 2007-08-27 13:55:49 - Updated : 2008-04-03 15:18:00 + Updated : 2008-05-20 10:37:00 Comment : RP Player interprocess communication include file *****************************************************************************/ @@ -16,9 +16,9 @@ #include -#define RPLATFORM_API_VER "1.0" +#define RPLATFORM_API_VER "1.1" #define RPLATFORM_API_VER_MAJOR 1 -#define RPLATFORM_API_VER_MINOR 0 +#define RPLATFORM_API_VER_MINOR 1 #define RPIPC_HostWndClass "RetroPlatformHost%s" #define RPIPC_GuestWndClass "RetroPlatformGuest%d" @@ -67,6 +67,8 @@ #define RPIPCHM_ESCAPEKEY (WM_APP + 210) #define RPIPCHM_EVENT (WM_APP + 211) #define RPIPCHM_MOUSECAPTURE (WM_APP + 212) +#define RPIPCHM_SAVESTATE (WM_APP + 213) +#define RPIPCHM_LOADSTATE (WM_APP + 214) // **************************************************************************** @@ -84,16 +86,17 @@ #define RP_FEATURE_PAUSE 0x00000080 // pause functionality is available (see RPIPCHM_PAUSE message) #define RP_FEATURE_TURBO 0x00000100 // turbo mode functionality is available (see RPIPCHM_TURBO message) #define RP_FEATURE_VOLUME 0x00000200 // volume adjustment is possible (see RPIPCHM_VOLUME message) +#define RP_FEATURE_STATE 0x00000400 // loading and saving of emulation state is supported (see RPIPCHM_SAVESTATE message) // Screen Modes #define RP_SCREENMODE_1X 0x00000000 // 1x window or full-screen mode ("CGA mode") #define RP_SCREENMODE_2X 0x00000001 // 2x window or full-screen mode ("VGA mode") #define RP_SCREENMODE_3X 0x00000002 // 3x window or full-screen mode ("triple CGA mode") #define RP_SCREENMODE_4X 0x00000003 // 4x window or full-screen mode ("double VGA mode") +#define RP_SCREENMODE_XX 0x000000FF // autoset maximum nX (integer n, preserve ratio) #define RP_SCREENMODE_FULLSCREEN_1 0x00000100 // full screen on primary (default) display #define RP_SCREENMODE_FULLSCREEN_2 0x00000200 // full screen on secondary display (fallback to 1 if unavailable) #define RP_SCREENMODE_FULLWINDOW 0x00010000 // use "full window" when in fullscreen (no gfx card full screen) -#define RP_SCREENMODE_XX 0x000000FF #define RP_SCREENMODE_MODE(m) ((m) & 0x000000FF) // given a mode 'm' returns the #X mode #define RP_SCREENMODE_DISPLAY(m) (((m) >> 8) & 0x000000FF) // given a mode 'm' returns the display number (1-255) or 0 if full screen is not active diff --git a/od-win32/dinput.c b/od-win32/dinput.c index ddebcbf0..132f0bba 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -422,6 +422,7 @@ static int initialize_rawinput (void) write_log ("'%s'\n", buf); did->configname = my_strdup (buf); rdi = (PRID_DEVICE_INFO)buf; + memset (rdi, 0, sizeof (RID_DEVICE_INFO)); rdi->cbSize = sizeof (RID_DEVICE_INFO); if (pGetRawInputDeviceInfo (h, RIDI_DEVICEINFO, NULL, &vtmp) == -1) continue; @@ -433,6 +434,10 @@ static int initialize_rawinput (void) PRID_DEVICE_INFO_MOUSE rdim = &rdi->mouse; write_log ("id=%d buttons=%d hw=%d rate=%d\n", rdim->dwId, rdim->dwNumberOfButtons, rdim->fHasHorizontalWheel, rdim->dwSampleRate); + if (rdim->dwNumberOfButtons >= MAX_MAPPINGS) { + write_log ("bogus number of buttons, ignored\n"); + continue; + } did->buttons = rdim->dwNumberOfButtons; for (j = 0; j < did->buttons; j++) { did->buttonsort[j] = j; diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index e4aaf9e9..58ea8ddf 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -52,7 +52,7 @@ static char *D3D_ErrorString (HRESULT dival) return dierr; } -static D3DXMATRIX* xD3DXMatrixPerspectiveFovLH(D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf) +static D3DXMATRIX* xD3DXMatrixPerspectiveFovLH (D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf) { double xscale, yscale, sine, dz; memset(pOut, 0, sizeof(D3DXMATRIX)); @@ -93,7 +93,7 @@ void D3D_free (void) d3d_enabled = 0; } -static int restoredeviceobjects(void) +static int restoredeviceobjects (void) { // Store render target surface desc LPDIRECT3DSURFACE9 bb; @@ -129,11 +129,11 @@ static int restoredeviceobjects(void) switch (currprefs.gfx_filter_filtermode & 1) { - case 0: + case 0: v = D3DTEXF_POINT; break; - case 1: - default: + case 1: + default: v = D3DTEXF_LINEAR; break; } @@ -146,35 +146,43 @@ static LPDIRECT3DTEXTURE9 createtext (int *ww, int *hh, D3DFORMAT format) { LPDIRECT3DTEXTURE9 t; HRESULT hr; - int w = *ww; - int h = *hh; - - if (w < 256) - w = 256; - else if (w < 512) - w = 512; - else if (w < 1024) - w = 1024; - else if (w < 2048) - w = 2048; - else - w = 4096; - - if (h < 256) - h = 256; - else if (h < 512) - h = 512; - else if (h < 1024) - h = 1024; - else if (h < 2048) - h = 2048; - else - h = 4096; - - hr = IDirect3DDevice9_CreateTexture (d3ddev, w, h, 1, 0, format, D3DPOOL_MANAGED, &t, NULL); - if (FAILED (hr)) { - write_log ("DIDirect3DDevice9_CreateTexture failed: %s\n", D3D_ErrorString (hr)); - return 0; + int w, h, npot; + + for (npot = 1; npot >= 0; npot--) { + w = *ww; + h = *hh; + if (!npot) { + if (w < 256) + w = 256; + else if (w < 512) + w = 512; + else if (w < 1024) + w = 1024; + else if (w < 2048) + w = 2048; + else + w = 4096; + + if (h < 256) + h = 256; + else if (h < 512) + h = 512; + else if (h < 1024) + h = 1024; + else if (h < 2048) + h = 2048; + else + h = 4096; + } + + hr = IDirect3DDevice9_CreateTexture (d3ddev, w, h, 1, 0, format, D3DPOOL_MANAGED, &t, NULL); + if (FAILED (hr)) { + write_log ("DIDirect3DDevice9_CreateTexture failed: %s\n", D3D_ErrorString (hr)); + if (npot) + continue; + return 0; + } + break; } *ww = w; @@ -285,7 +293,7 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) return errmsg; } - d3dDLL = LoadLibrary("D3D9.DLL"); + d3dDLL = LoadLibrary ("D3D9.DLL"); if (d3dDLL == NULL) { strcpy (errmsg, "Direct3D: DirectX 9 or newer required"); return errmsg; @@ -356,14 +364,14 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) t_depth = depth; switch (depth) { - case 32: + case 32: if (currprefs.gfx_filter_scanlines) tformat = D3DFMT_A8R8G8B8; else tformat = D3DFMT_X8R8G8B8; break; - case 15: - case 16: + case 15: + case 16: if (currprefs.gfx_filter_scanlines) tformat = D3DFMT_A1R5G5B5; else @@ -446,21 +454,24 @@ static void BlitRect (LPDIRECT3DDEVICE9 dev, LPDIRECT3DTEXTURE9 src, #if 1 static void calc (float *xp, float *yp, float *sxp, float *syp) { + float xm ,ym; RECT sr, dr; - float mx = (float)twidth / tin_w; - float my = (float)theight / tin_h; - int aw = twidth * window_w / tin_w; - int ah = theight * window_h / tin_h; - mx = 1 / mx; - my = 1 / my; + //write_log("%d/%d/%d %d/%d/%d\n", twidth, window_w, tin_w, theight, window_h, tin_h); getfilterrect2 (&sr, &dr, window_w, window_h, tin_w, tin_h, 1, tin_w, tin_h); - OffsetRect (&dr, aw / 2, ah / 2); + + //write_log ("%dx%d %dx%d\n", dr.left, dr.top, dr.right, dr.bottom); + + xm = (float)twidth / tin_w; + ym = (float)theight / tin_h; + + //write_log ("%fx%f\n", xm, ym); + *xp = dr.left; *yp = dr.top; - *sxp = *xp + (dr.right - dr.left) * mx; - *syp = *yp + (dr.bottom - dr.top) * my; + *sxp = dr.right * xm; + *syp = dr.bottom * ym; } #else static void calc (float *xp, float *yp, float *sxp, float *syp) @@ -512,7 +523,7 @@ void D3D_unlocktexture (void) int D3D_needreset (void) { - HRESULT hr = IDirect3DDevice9_TestCooperativeLevel(d3ddev); + HRESULT hr = IDirect3DDevice9_TestCooperativeLevel (d3ddev); if (hr == D3DERR_DEVICENOTRESET) return 1; return 0; diff --git a/od-win32/opengl.c b/od-win32/opengl.c index 0c42db4d..0d9e550a 100755 --- a/od-win32/opengl.c +++ b/od-win32/opengl.c @@ -289,7 +289,7 @@ const char *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) ti2d_type = -1; if (depth == 15 || depth == 16) { if (!packed_pixels) { - sprintf(errmsg, "OPENGL: can't use 15/16 bit screen depths because\n" + sprintf (errmsg, "OPENGL: can't use 15/16 bit screen depths because\n" "EXT_packed_pixels extension was not found."); OGL_free (); return errmsg; @@ -463,35 +463,23 @@ void OGL_resize (int width, int height) static void OGL_dorender (int newtex) { uae_u8 *data = gfxvidinfo.bufmem; - float x1, y1, x2, y2; - double fx, fy, xm, ym; - -#if 0 - double mx, my, fx, fy, fx2, fy2, xm, ym; - float tx, ty; - - xm = currprefs.gfx_lores ? 2 : 1; - ym = currprefs.gfx_linedbl ? 2 : 1; + float x1, y1, x2, y2, xm, ym; + RECT sr, dr; - fx = (required_texture_size * w_width / t_width) / 2.0; - fy = (required_texture_size * w_height / t_height) / 2.0; +#if 1 + getfilterrect2 (&sr, &dr, w_width, w_height, t_width, t_height, 1, t_width, t_height); + xm = (float)required_texture_size / t_width; + ym = (float)required_texture_size / t_height; - tx = fx / ((currprefs.gfx_filter_horiz_zoom_mult + currprefs.gfx_filter_horiz_zoom / 4.0) / 1000.0); - ty = fy / ((currprefs.gfx_filter_vert_zoom_mult + currprefs.gfx_filter_vert_zoom / 4.0) / 1000.0); + //write_log ("%fx%f\n", xm, ym); - mx = (currprefs.gfx_filter_horiz_offset / 1000.0) * fx; - my = (currprefs.gfx_filter_vert_offset / 1000.0) * fy; - - x1 = -tx; - y1 = -ty; - x2 = tx; - y2 = ty; - x1 += fx + mx; - y1 += fy + my; - x2 += tx + mx; - y2 += ty + my; + x1 = dr.left; + y1 = dr.top; + x2 = dr.right * xm; + y2 = dr.bottom * ym; #else + double fx, fy, xm, ym; xm = 2 >> currprefs.gfx_resolution; ym = currprefs.gfx_linedbl ? 1 : 2; diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index e4e44780..bdaecd1f 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -816,7 +816,7 @@ static void setconvert (void) * 2. Picasso-->Picasso transition, via SetPanning(). * 3. whenever the graphics code notifies us that the screen contents have been lost. */ -extern unsigned int new_beamcon0; +extern uae_u16 new_beamcon0; void picasso_refresh (void) { struct RenderInfo ri; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 17c1ff35..d80ec9fb 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -249,6 +249,8 @@ #define IDS_SOUND_STEREO2 256 #define IDS_INPUT_CUSTOMEVENT 257 #define IDS_DEFAULT_NEWWINUAE 258 +#define IDS_SOUND_CLONED51 259 +#define IDS_SOUND_51 260 #define IDS_NUMSG_NEEDEXT2 300 #define IDS_NUMSG_NOROMKEY 301 #define IDS_NUMSG_KSROMCRCERROR 302 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 4dea8cde..316b2887 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1196,6 +1196,8 @@ BEGIN IDS_SOUND_STEREO2 "Cloned Stereo (4 Channels)" IDS_INPUT_CUSTOMEVENT "" IDS_DEFAULT_NEWWINUAE "WinUAE default (new)" + IDS_SOUND_CLONED51 "Cloned Stereo (5.1)" + IDS_SOUND_51 "5.1 Channels" END STRINGTABLE diff --git a/od-win32/rp.c b/od-win32/rp.c index 6ef94c35..55792ece 100755 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -25,6 +25,7 @@ #include "win32.h" #include "win32gfx.h" #include "filesys.h" +#include "savestate.h" #include "gfxfilter.h" static int initialized; @@ -113,6 +114,7 @@ static const char *getmsg (int msg) case RPIPCGM_DEVICECONTENT: return "RPIPCGM_DEVICECONTENT"; case RPIPCGM_DEVICESEEK: return "RPIPCGM_DEVICESEEK"; case RPIPCGM_ESCAPED: return "RPIPCGM_ESCAPED"; + case RPIPCHM_CLOSE: return "RPIPCHM_CLOSE"; case RPIPCHM_SCREENMODE: return "RPIPCHM_SCREENMODE"; case RPIPCHM_SCREENCAPTURE: return "RPIPCHM_SCREENCAPTURE"; @@ -125,6 +127,8 @@ static const char *getmsg (int msg) case RPIPCHM_MOUSECAPTURE: return "RPIPCHM_MOUSECAPTURE"; case RPIPCHM_DEVICECONTENT: return "RPIPCHM_DEVICECONTENT"; case RPIPCHM_PING: return "RPIPCHM_PING"; + case RPIPCHM_SAVESTATE: return "RPIPCHM_SAVESTATE"; + case RPIPCHM_LOADSTATE: return "RPIPCHM_LOADSTATE"; default: return "UNKNOWN"; } @@ -576,6 +580,33 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM xfree (s); return ok ? TRUE : FALSE; } + case RPIPCHM_SAVESTATE: + { + char *s = ua ((WCHAR*)pData); + DWORD ret = FALSE; + if (vpos == 0) { + save_state (s, "AF"); + ret = 1; + } else { + savestate_initsave (s, 1, TRUE); + ret = -1; + } + xfree (s); + return ret; + } + case RPIPCHM_LOADSTATE: + { + char *s = ua ((WCHAR*)pData); + DWORD ret = FALSE; + DWORD attr = GetFileAttributes (s); + if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) { + savestate_state = STATE_DORESTORE; + strcpy (savestate_fname, s); + ret = -1; + } + xfree (s); + return ret; + } } return FALSE; } @@ -633,6 +664,7 @@ static void sendfeatures (void) feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN; feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE; + feat |= RP_FEATURE_STATE; if (!WIN32GFX_IsPicassoScreen ()) feat |= RP_FEATURE_SCREEN2X | RP_FEATURE_SCREEN4X; RPSendMessagex (RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL); @@ -823,7 +855,7 @@ void rp_update_leds (int led, int onoff) switch (led) { case 0: - RPSendMessage (RPIPCGM_POWERLED, onoff ? 100 : 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessage (RPIPCGM_POWERLED, onoff >= 250 ? 100 : onoff * 10 / 26, 0, NULL, 0, &guestinfo, NULL); break; case 1: case 2: diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index 3b5b9809..9b091bf1 100755 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -1011,10 +1011,17 @@ static int get_master_volume (int *volume, int *mute) return setget_master_volume_xp (0, volume, mute); } -void sound_volume (int dir) +void sound_mute (int newmute) { - if (dir == 0) + if (newmute < 0) mute = mute ? 0 : 1; + else + mute = newmute; + set_volume (currprefs.sound_volume, mute); +} + +void sound_volume (int dir) +{ currprefs.sound_volume -= dir * 10; if (currprefs.sound_volume < 0) currprefs.sound_volume = 0; diff --git a/od-win32/sounddep/sound.h b/od-win32/sounddep/sound.h index 4ea9777e..c3b5b7b5 100755 --- a/od-win32/sounddep/sound.h +++ b/od-win32/sounddep/sound.h @@ -22,6 +22,7 @@ extern void sound_setadjust (double); extern char **enumerate_sound_devices (int *total); extern int drivesound_init (void); extern void drivesound_free (void); +extern void sound_mute (int); extern void sound_volume (int); extern void set_volume (int, int); extern void master_sound_volume (int); @@ -33,8 +34,13 @@ STATIC_INLINE void check_sound_buffers (void) ((uae_u16*)sndbufpt)[1] = ((uae_u16*)sndbufpt)[-1]; sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 2 * 2); } else if (currprefs.sound_stereo == SND_6CH_CLONEDSTEREO) { - ((uae_u16*)sndbufpt)[2] = ((uae_u16*)sndbufpt)[-2]; - ((uae_u16*)sndbufpt)[3] = ((uae_u16*)sndbufpt)[-1]; + uae_s16 *p = ((uae_s16*)sndbufpt); + uae_s32 sum; + p[2] = p[-2]; + p[3] = p[-1]; + sum = (uae_s32)(p[-2]) + (uae_s32)(p[-1]) + (uae_s32)(p[2]) + (uae_s32)(p[3]); + p[0] = sum >> 3; + p[1] = sum >> 3; sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 4 * 2); } if ((char *)sndbufpt - (char *)sndbuffer >= sndbufsize) { diff --git a/od-win32/win32.c b/od-win32/win32.c index 53efd593..d46d7ce4 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -816,7 +816,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, my = (signed short) HIWORD (lParam); mx -= mouseposx; my -= mouseposy; - if (recapture && isfullscreen() <= 0) { + if (recapture && isfullscreen () <= 0) { setmouseactive (1); setamigamouse (mx, my); return 0; @@ -841,7 +841,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, setmousestate (dinput_winmouse (), 0, mx, 0); setmousestate (dinput_winmouse (), 1, my, 0); } - } else if (!mouseactive && isfullscreen() <= 0) { + } else if (!mouseactive && isfullscreen () <= 0) { setmousestate (0, 0, mx, 1); setmousestate (0, 1, my, 1); } @@ -854,7 +854,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_MOVING: { LRESULT lr = DefWindowProc (hWnd, message, wParam, lParam); - WIN32GFX_WindowMove(); + WIN32GFX_WindowMove (); return lr; } case WM_MOVE: @@ -2308,12 +2308,12 @@ static void WIN32_HandleRegistryStuff(void) rkey = HKEY_LOCAL_MACHINE; else rkey = HKEY_CURRENT_USER; - strcpy(rpath1, "Software\\Classes\\"); - strcpy(rpath2, rpath1); - strcpy(rpath3, rpath1); - strcat(rpath1, ".uae"); - strcat(rpath2, "WinUAE\\shell\\Edit\\command"); - strcat(rpath3, "WinUAE\\shell\\Open\\command"); + strcpy (rpath1, "Software\\Classes\\"); + strcpy (rpath2, rpath1); + strcpy (rpath3, rpath1); + strcat (rpath1, ".uae"); + strcat (rpath2, "WinUAE\\shell\\Edit\\command"); + strcat (rpath3, "WinUAE\\shell\\Open\\command"); /* Create/Open the hWinUAEKey which points to our config-info */ if (RegCreateKeyEx (rkey, rpath1, 0, "", REG_OPTION_NON_VOLATILE, @@ -2376,7 +2376,7 @@ static void WIN32_HandleRegistryStuff(void) size = sizeof (version); if (regquerystr (NULL, "Version", version, &size)) { if (checkversion (version)) - regsetstr(NULL, "Version", VersionStr); + regsetstr (NULL, "Version", VersionStr); } else { regsetstr (NULL, "Version", VersionStr); } @@ -2638,7 +2638,7 @@ void create_afnewdir (int remove) strcpy (tmp2, tmp); strcat (tmp2, "Amiga Files"); strcpy (tmp, tmp2); - strcat(tmp, "\\WinUAE"); + strcat (tmp, "\\WinUAE"); if (remove) { if (GetFileAttributes (tmp) != INVALID_FILE_ATTRIBUTES) { RemoveDirectory (tmp); diff --git a/od-win32/win32.h b/od-win32/win32.h index 7b179c72..748c6ff4 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 19 +#define WINUAEBETA 20 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 5, 17) +#define WINUAEDATE MAKEBD(2008, 5, 24) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 3b162b8d..dfca0c5e 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -1572,7 +1572,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs case IDC_DOSAVESTATE: case IDC_DOLOADSTATE: statefile_previousfilter = openFileName.nFilterIndex; - savestate_initsave (full_path, openFileName.nFilterIndex); + savestate_initsave (full_path, openFileName.nFilterIndex, FALSE); break; case IDC_CREATE: { @@ -6373,8 +6373,10 @@ static void values_to_sounddlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt); WIN32GUI_LoadUIString (IDS_SOUND_4CHANNEL, txt, sizeof (txt)); SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt); - SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)"Cloned Stereo (4 Channels in 5.1)"); - SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)"4 Channels in 5.1"); + WIN32GUI_LoadUIString (IDS_SOUND_CLONED51, txt, sizeof (txt)); + SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt); + WIN32GUI_LoadUIString (IDS_SOUND_51, txt, sizeof (txt)); + SendDlgItemMessage(hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt); SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_SETCURSEL, workprefs.sound_stereo, 0); SendDlgItemMessage(hDlg, IDC_SOUNDSWAP, CB_RESETCONTENT, 0, 0); @@ -8644,7 +8646,7 @@ static void values_to_portsdlg (HWND hDlg) } } -static void init_portsdlg( HWND hDlg ) +static void init_portsdlg (HWND hDlg) { static int first; int port, numdevs; @@ -8657,13 +8659,12 @@ static void init_portsdlg( HWND hDlg ) unload_ghostscript (); ghostscript_available = 1; } + joy0previous = joy1previous = -1; } if (!ghostscript_available) { workprefs.parallel_postscript_emulation = 0; } - joy0previous = joy1previous = -1; - SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone); for (port = 0; port < MAX_SERIAL_PORTS && comports[port].name; port++) { diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 3760d620..5c96c237 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -1823,6 +1823,10 @@ RelativePath="..\..\uaelib.c" > + + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 1a9ec9bf..0586d796 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,21 @@ +Beta 20: + +- only reset sound when changing configuration if sound mode, sound card, + frequency, channels, or buffer size is changed +- 5.1 sound settings now also send mixed sound to center and LFE channel + (mixing volume may need adjusting, please test) +- superhires sprites in doublescan mode had halved horizontal resolution +- power led fade support (very crappy) +- possible fix to random joystick/mouse switch crash +- programmed resolutions (doublescan) are now horizontally centered +- right side max sprite clipping position was incorrect +- D3D/OGL filters do not crash anymore but still do not work as expected.. +- added Amiga-side uae.resource, safe method to find "uae rom" base and + other information. Version of resource is UAEVERSION.UAEREVISION + NOTE: in compatible modes resource may not be available. + Check source for more information. + Beta 19: - lha/lzh archives with directory entries ("-lhd-") crash fix diff --git a/savestate.c b/savestate.c index 942048fb..b7912c7c 100755 --- a/savestate.c +++ b/savestate.c @@ -75,7 +75,7 @@ static int frameextra; struct zfile *savestate_file; static uae_u8 *replaybuffer, *replaybufferend; -static int savestate_docompress, savestate_specialdump; +static int savestate_docompress, savestate_specialdump, savestate_nodialogs; static int replaybuffersize; char savestate_fname[MAX_DPATH]; @@ -384,7 +384,7 @@ static void restore_header (uae_u8 *src) /* restore all subsystems */ -void restore_state (char *filename) +void restore_state (const char *filename) { struct zfile *f; uae_u8 *chunk,*end; @@ -582,11 +582,12 @@ void savestate_restore_finish (void) } /* 1=compressed,2=not compressed,3=ram dump,4=audio dump */ -void savestate_initsave (char *filename, int mode) +void savestate_initsave (const char *filename, int mode, int nodialogs) { strcpy (savestate_fname, filename); savestate_docompress = (mode == 1) ? 1 : 0; savestate_specialdump = (mode == 3) ? 1 : (mode == 4) ? 2 : 0; + savestate_nodialogs = nodialogs; } static void save_rams (struct zfile *f, int comp) @@ -622,7 +623,7 @@ static void save_rams (struct zfile *f, int comp) /* Save all subsystems */ -int save_state (char *filename, char *description) +int save_state (const char *filename, const char *description) { uae_u8 endhunk[] = { 'E', 'N', 'D', ' ', 0, 0, 0, 8 }; uae_u8 header[1000]; @@ -633,13 +634,14 @@ int save_state (char *filename, char *description) char name[5]; int comp = savestate_docompress; - if (!savestate_specialdump) { + if (!savestate_specialdump && !savestate_nodialogs) { state_incompatible_warn (); if (!save_filesys_cando ()) { gui_message("Filesystem active. Try again later"); return -1; } } + savestate_nodialogs = 0; custom_prepare_savestate (); f = zfile_fopen (filename, "w+b"); if (!f) diff --git a/scsiemul.c b/scsiemul.c index c4506874..b353ee9e 100755 --- a/scsiemul.c +++ b/scsiemul.c @@ -971,7 +971,7 @@ void scsidev_install (void) dw (0x0004); /* 0.4 */ dw (0xD000); /* INITWORD */ dw (0x0016); /* LIB_REVISION */ - dw (0x0000); /* end of table already ??? */ + dw (0x0000); dw (0xC000); /* INITLONG */ dw (0x0018); /* LIB_IDSTRING */ dl (ROM_scsidev_resid); diff --git a/uaeresource.c b/uaeresource.c new file mode 100755 index 00000000..349995dd --- /dev/null +++ b/uaeresource.c @@ -0,0 +1,134 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * uae.resource + * + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "options.h" +#include "memory.h" +#include "custom.h" +#include "newcpu.h" +#include "traps.h" +#include "autoconf.h" +#include "execlib.h" +#include "uaeresource.h" + +#if 0 + struct uaebase + { + struct Library lib; + UWORD uae_version; + UWORD uae_revision; + UWORD uae_subrevision; + UWORD zero; + APTR uae_rombase; + }; +#endif + +static uaecptr res_init, res_name, res_id; + +static uae_u32 REGPARAM2 res_close (TrapContext *context) +{ + uaecptr base = m68k_areg (&context->regs, 6); + put_word (base + 32, get_word (base + 32) - 1); + return 0; +} +static uae_u32 REGPARAM2 res_open (TrapContext *context) +{ + uaecptr base = m68k_areg (&context->regs, 6); + put_word (base + 32, get_word (base + 32) + 1); + return 0; +} +static uae_u32 REGPARAM2 res_expunge (TrapContext *context) +{ + return 0; +} +static uae_u32 REGPARAM2 res_initcode (TrapContext *context) +{ + uaecptr base = m68k_dreg (&context->regs, 0); + uaecptr rb = base + SIZEOF_LIBRARY; + put_word (rb + 0, UAEMAJOR); + put_word (rb + 2, UAEMINOR); + put_word (rb + 4, UAESUBREV); + put_word (rb + 6, 0); + put_long (rb + 8, rtarea_base); + return base; +} + +uaecptr uaeres_startup (uaecptr resaddr) +{ + put_word (resaddr + 0x0, 0x4AFC); + put_long (resaddr + 0x2, resaddr); + put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */ + put_word (resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */ + put_word (resaddr + 0xC, 0x0878); /* NT_DEVICE; pri 05 */ + put_long (resaddr + 0xE, res_name); + put_long (resaddr + 0x12, res_id); + put_long (resaddr + 0x16, res_init); + resaddr += 0x1A; + return resaddr; +} + +void uaeres_install (void) +{ + uae_u32 functable, datatable; + uae_u32 initcode, openfunc, closefunc, expungefunc; + char tmp[100]; + + sprintf (tmp, "UAE resource %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV); + res_name = ds ("uae.resource"); + res_id = ds (tmp); + + /* initcode */ + initcode = here (); + calltrap (deftrap (res_initcode)); dw (RTS); + /* Open */ + openfunc = here (); + calltrap (deftrap (res_open)); dw (RTS); + /* Close */ + closefunc = here (); + calltrap (deftrap (res_close)); dw (RTS); + /* Expunge */ + expungefunc = here (); + calltrap (deftrap (res_expunge)); dw (RTS); + + /* FuncTable */ + functable = here (); + dl (openfunc); /* Open */ + dl (closefunc); /* Close */ + dl (expungefunc); /* Expunge */ + dl (EXPANSION_nullfunc); /* Null */ + dl (0xFFFFFFFF); /* end of table */ + + /* DataTable */ + datatable = here (); + dw (0xE000); /* INITBYTE */ + dw (0x0008); /* LN_TYPE */ + dw (0x0800); /* NT_RESOURCE */ + dw (0xC000); /* INITLONG */ + dw (0x000A); /* LN_NAME */ + dl (res_name); + dw (0xE000); /* INITBYTE */ + dw (0x000E); /* LIB_FLAGS */ + dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ + dw (0xD000); /* INITWORD */ + dw (0x0014); /* LIB_VERSION */ + dw (UAEMAJOR); + dw (0xD000); /* INITWORD */ + dw (0x0016); /* LIB_REVISION */ + dw (UAEMINOR); + dw (0xC000); /* INITLONG */ + dw (0x0018); /* LIB_IDSTRING */ + dl (res_id); + dw (0x0000); /* end of table */ + + res_init = here (); + dl (SIZEOF_LIBRARY + 16); /* size of device base */ + dl (functable); + dl (datatable); + dl (initcode); +} diff --git a/uaeserial.c b/uaeserial.c index 633818a2..236f338a 100755 --- a/uaeserial.c +++ b/uaeserial.c @@ -190,7 +190,7 @@ static uae_u32 REGPARAM2 dev_close (TrapContext *context) return 0; } -static void resetparams(struct devstruct *dev, uaecptr req) +static void resetparams (struct devstruct *dev, uaecptr req) { put_long (req + io_CtlChar, 0x00001311); put_long (req + io_RBufLen, 1024); @@ -206,7 +206,7 @@ static void resetparams(struct devstruct *dev, uaecptr req) put_word (req + io_Status, 0); } -static int setparams(struct devstruct *dev, uaecptr req) +static int setparams (struct devstruct *dev, uaecptr req) { int v; int rbuffer, baud, rbits, wbits, sbits, rtscts, parity, xonxoff; -- 2.47.3