]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1500b20.zip
authorToni Wilen <twilen@winuae.net>
Sat, 24 May 2008 14:28:09 +0000 (17:28 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:40:27 +0000 (21:40 +0200)
37 files changed:
audio.c
blitter.c
cfgfile.c
cia.c
custom.c
drawing.c
filesys.c
fsusage.c
include/audio.h
include/custom.h
include/execlib.h
include/gui.h
include/options.h
include/savestate.h
include/uaeresource.h [new file with mode: 0755]
inputdevice.c
main.c
memory.c
od-win32/cloanto/RetroPlatformIPC.h
od-win32/dinput.c
od-win32/direct3d.c
od-win32/opengl.c
od-win32/picasso96_win.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/rp.c
od-win32/sounddep/sound.c
od-win32/sounddep/sound.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
savestate.c
scsiemul.c
uaeresource.c [new file with mode: 0755]
uaeserial.c

diff --git a/audio.c b/audio.c
index 8408ebd76b32e8225df80de7975e2063c82e4f0a..9a2350aff2c7f34740893d55fbe15b31e13d61a8 100755 (executable)
--- 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)
index b57d5677d9ee466e7999a3f530fdb45b7629eadf..979a330c097a3cf985d522911ed2dda65d4d9bec 100755 (executable)
--- 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;
index ea91e0c7e416db759b8d63e14814e49717858a5a..97a01a1ddfb653319d28a6cb6c9ae91e48b46f68 100755 (executable)
--- 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 c3e8cbd40724ac12dee4175ee9610348d297eb62..ed0bc99f1e74484972eef5383f3817c3c7d86fff 100755 (executable)
--- 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)";
index 1a2f1061c808a429ed1adc2c5acb1722c17f5263..f7055ef489e7d85dc2cdfdf4031abd13d2720189 100755 (executable)
--- 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)));
        }
     }
index 85d8f4932871a876ac1d219bc93271fe5cee53e7..f5f5c4411c1f74713979803ee47efe7395abcfa9 100755 (executable)
--- 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)
index 203d73028a8daf38338e7d6231bef1db106729ad..e4d21e00d747f2c49411791fd6ea90a8028b325b 100755 (executable)
--- 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
index 2443f91938ac3d13c8d73a9acd58fa4687b620ca..2259911acb826d187aa222a8e81acb8b346a3e8f 100755 (executable)
--- 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;
     }
index d0c9fea26a0450b5ff9cdf933e9eb16b2f9ec44f..0d7723269ba2f3c79d8c676cdd1de4bb45462a08 100755 (executable)
@@ -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;
index bd6d96d11d6bd75b82fc5bb5ba7efa6347fee58c..d20813d0ee9080340ccb4f12d3018a1acd4cfcdb 100755 (executable)
@@ -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.
index 362bc6ce1f72bad5754256c4bfeab2f01eb97326..c1fe051343e968b44d2113564f6041f49de73e53 100755 (executable)
@@ -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
index 407fb2634a8bc268ec2be7db5e3569bd49ffa81e..1f777c4d89286cd9a35a459c8640521842e9befe 100755 (executable)
@@ -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 */
index 8a78877fa645d1e68f8f324f49cc1448244e5380..3e5cce00cc3bf48cf6263578b4eca027f0beea03 100755 (executable)
@@ -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
index a804b73544e3b62f2a9d1fb8e9eaf2da34a9be7f..b7b42944ce96000715201d3dc66ebf71d8115aa4 100755 (executable)
@@ -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 (executable)
index 0000000..46828d4
--- /dev/null
@@ -0,0 +1,3 @@
+
+uaecptr uaeres_startup (uaecptr resaddr);
+void uaeres_install (void);
\ No newline at end of file
index fed440c8939583b110c50967499ea2abba5634d5..5245014fc9b3caa028a003c85c9d6cb1e9f68a5c 100755 (executable)
@@ -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 6722ceb655b90bb8fba5641a77b632a54a879ccb..ed3497936084ad36341f06bc7b0daf99cd73438d 100755 (executable)
--- a/main.c
+++ b/main.c
 #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 ();
index ab67a7aa8c442b92d07d46c66946a4542d6578a0..3e041f931f92833a7d9df5d5cee9b4dfdcbbe682 100755 (executable)
--- 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);
index d2290d155606ddf39e0e79f2ed028a5eaa749d80..6985b2256124c550948d2fa8d871e66a987972c6 100755 (executable)
@@ -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 <windows.h>
 
-#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)
 
 
 // ****************************************************************************
 #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
 
index ddebcbf0b34073056212099ec31ffc45c208612b..132f0bbaa9022cc3a302d1031b9bb6edbc9fcab8 100755 (executable)
@@ -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;
index e4aaf9e9963587d9911445ec8aaf4833802e0e56..58ea8ddfca4c87be9f877d908699c68baf323572 100755 (executable)
@@ -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;
index 0c42db4de185343a93bb05cbbcaf8dee34bba5c3..0d9e550acf83614783a3fd80a33ef1a5d435fac7 100755 (executable)
@@ -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;
index e4e44780b1a46cc1927763a240b2088bf540e42d..bdaecd1f5af49208a647344c582450fee819b953 100755 (executable)
@@ -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;
index 17c1ff357d1e5b743c08ec7214be5de9459b702e..d80ec9fbc213d56396193f2edf60a2008e849b1f 100755 (executable)
 #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
index 4dea8cde021b4dfef7a32b42461d0f2849b935f2..316b2887cdb1a9d128e85ef7915c41e353101db8 100755 (executable)
@@ -1196,6 +1196,8 @@ BEGIN
     IDS_SOUND_STEREO2       "Cloned Stereo (4 Channels)"
     IDS_INPUT_CUSTOMEVENT   "<Custom event>"
     IDS_DEFAULT_NEWWINUAE   "WinUAE default (new)"
+    IDS_SOUND_CLONED51      "Cloned Stereo (5.1)"
+    IDS_SOUND_51            "5.1 Channels"
 END
 
 STRINGTABLE 
index 6ef94c353fdf2363990e36c0cbd8c8c443b96834..55792ecec42b7515062f30fd6bff570b6f1f1005 100755 (executable)
@@ -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:
index 3b5b9809c6e44c77b709d1d645fe2a7bb573ffcd..9b091bf1c9df42c0ea77959d348013ccc26f275b 100755 (executable)
@@ -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;
index 4ea9777e431cb5b8f08e14d473db510572acc349..c3b5b7b5e7caa6e74a9ab0b0e1f5b507dc339481 100755 (executable)
@@ -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) {
index 53efd59339e108061ec1d258901982e5db0a3c87..d46d7ce410a8d97979af853e26efa66e92c2a3c5 100755 (executable)
@@ -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);
index 7b179c72630f015a0db3a5eb01189e94d3ba1468..748c6ff4c85a5dcef50b9caa0fc2b43cc06f4f9f 100755 (executable)
@@ -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 ""
 
index 3b162b8da626cb10a164cb96c030475098085248..dfca0c5e1aae41a6f5514a5f3b8343dc1f3687ae 100755 (executable)
@@ -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++) {
index 3760d62066e36ed91506d5f035245b81563dfe76..5c96c237e4178a8ee6509199df0aa8121fef1fd7 100755 (executable)
                                RelativePath="..\..\uaelib.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\uaeresource.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\uaeserial.c"
                                >
index 1a9ec9bfcc571b58d9ccce64fc53a67043d9c260..0586d796847a70ed005642f9acc0c2cd2432e7db 100755 (executable)
@@ -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
index 942048fb15c7d3c0f031344d261bb345339243f7..b7912c7ca35ee13add9d047747322f668ff824d6 100755 (executable)
@@ -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)
index c4506874212d211e874b4cab646bf55011b753a7..b353ee9e439ba90c85b0cb828450d88ce264102f 100755 (executable)
@@ -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 (executable)
index 0000000..349995d
--- /dev/null
@@ -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);
+}
index 633818a2a7f1c3a8923990b1a69100b2f7a0b851..236f338a881856db3447cada0acb4e519e8053b3 100755 (executable)
@@ -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;