void check_prefs_changed_carts (int in_memory_reset)
{
+ if (!config_changed)
+ return;
if (currprefs.cart_internal != changed_prefs.cart_internal)
currprefs.cart_internal = changed_prefs.cart_internal;
if (_tcscmp (currprefs.cartfile, changed_prefs.cartfile) != 0) {
ret = 1;
audio_event_reset ();
}
- audio_work_to_do = 4 * maxvpos * 50;
+ audio_work_to_do = 4 * maxvpos_nom * 50;
return ret;
}
events_schedule ();
}
-STATIC_INLINE int sound_prefs_changed (void)
+static int sound_prefs_changed (void)
{
+ if (!config_changed)
+ return 0;
if (changed_prefs.produce_sound != currprefs.produce_sound
|| changed_prefs.win32_soundcard != currprefs.win32_soundcard
|| changed_prefs.win32_soundexclusive != currprefs.win32_soundexclusive
eventtab[ev_audio].active = 0;
events_schedule ();
}
+ config_changed = 1;
}
void update_audio (void)
#ifdef RETROPLATFORM
rp_cd_change (0, 0);
#endif
+ config_changed = 1;
}
static int ismedia (int unitnum, int quick)
cfgfile_dwrite_str (f, L"state_replay", p->statecapture ? L"yes" : L"no");
cfgfile_dwrite (f, L"state_replay_rate", L"%d", p->statecapturerate);
cfgfile_dwrite (f, L"state_replay_buffer", L"%d", p->statecapturebuffersize);
+ cfgfile_dwrite_bool (f, L"warp", p->turbo_emulation);
#ifdef FILESYS
write_filesys_config (p, UNEXPANDED, p->path_hardfile, f);
static TCHAR *configsearch;
static int configsearchfound;
+ config_changed = 1;
err = 0;
argv = 0;
p = 0;
}
return 1;
}
+
+void config_check_vsync (void)
+{
+ static int cnt = 0;
+ if (cnt == 0) {
+ /* resolution_check_change (); */
+ DISK_check_change ();
+ cnt = 5;
+ }
+ cnt--;
+ if (config_changed) {
+ if (config_changed == 1)
+ write_log (L"* configuration check trigger\n");
+ config_changed++;
+ if (config_changed > 10)
+ config_changed = 0;
+ }
+}
+
return 0;
}
resetwarning_phase = 1;
- resetwarning_timer = maxvpos * 5;
+ resetwarning_timer = maxvpos_nom * 5;
write_log (L"KB: reset warning triggered\n");
sendrw ();
return 1;
if (kback && !(ciaacra & 0x40) && ciaasdr_unread == 2) {
write_log (L"KB: reset warning second phase..\n");
resetwarning_phase = 2;
- resetwarning_timer = maxvpos * 5;
+ resetwarning_timer = maxvpos_nom * 5;
sendrw ();
}
} else if (resetwarning_phase == 2) {
if (ciaacra & 0x40) {
resetwarning_phase = 3;
write_log (L"KB: reset warning SP = output\n");
- resetwarning_timer = 10 * maxvpos * vblank_hz; /* wait max 10s */
+ resetwarning_timer = 10 * maxvpos_nom * vblank_hz; /* wait max 10s */
}
} else if (resetwarning_phase == 3) {
if (!(ciaacra & 0x40)) {
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);
+ int v = led_on / CYCLE_UNIT * 256 / (maxhpos * maxvpos_nom);
if (v < 0)
v = 0;
if (v > 255)
*
* Copyright 1995-2002 Bernd Schmidt
* Copyright 1995 Alessandro Bissacco
-* Copyright 2000-2009 Toni Wilen
+* Copyright 2000-2010 Toni Wilen
*/
#include "sysconfig.h"
#endif
int vpos;
-int hack_vpos;
-static int hack_vpos2, hack_vpos2vpos;
+static int vpos_count, vpos_count_prev;
static int lof, lol;
static int next_lineno, prev_lineno;
static enum nln_how nextline_how;
int maxhpos = MAXHPOS_PAL;
int maxhpos_short = MAXHPOS_PAL;
int maxvpos = MAXVPOS_PAL;
-int maxvpos_max = MAXVPOS_PAL;
+int maxvpos_nom = MAXVPOS_PAL; // nominal value (same as maxvpos but "faked" maxvpos in fake 60hz modes)
+static int maxvpos_total = 511;
int minfirstline = VBLANK_ENDLINE_PAL;
int equ_vblank_endline = EQU_ENDLINE_PAL;
int vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_skip, doublescan;
static struct copper cop_state;
static int copper_enabled_thisline;
static int cop_min_waittime;
+
/*
* Statistics
*/
-
-/* Used also by bebox.cpp */
unsigned long int frametime = 0, lastframetime = 0, timeframes = 0;
unsigned long hsync_counter = 0, vsync_counter = 0, ciavsync_counter = 0;
unsigned long int idletime;
/* Recording of custom chip register changes. */
static int current_change_set;
-
-#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
-/* sam: Those arrays uses around 7Mb of BSS... That seems */
-/* too much for AmigaDOS (uae crashes as soon as one loads */
-/* it. So I use a different strategy here (realloc the */
-/* arrays when needed. That strategy might be usefull for */
-/* computer with low memory. */
-struct sprite_entry *sprite_entries[2];
-struct color_change *color_changes[2];
-static int max_sprite_entry = 400;
-static int delta_sprite_entry = 0;
-static int max_color_change = 400;
-static int delta_color_change = 0;
-#else
static struct sprite_entry sprite_entries[2][MAX_SPR_PIXELS / 16];
static struct color_change color_changes[2][MAX_REG_CHANGE];
-#endif
struct decision line_decisions[2 * (MAXVPOS + 1) + 1];
static struct draw_info line_drawinfo[2][2 * (MAXVPOS + 1) + 1];
static int doflickerfix (void)
{
- return currprefs.gfx_linedbl && doublescan < 0;
+ return currprefs.gfx_linedbl && doublescan < 0 && vpos < MAXVPOS;
}
uae_u32 get_copper_address (int copno)
last_hdiw = 0 - 1;
}
last_hdiw = hdiw;
-
-
-#if 0
- pix_hpos = coord_diw_to_window_x (hdiw);
- if (pix_hpos >= diwfirstword && last_diw_pix_hpos < diwfirstword && hdiwstate == DIW_waiting_start) {
- if (thisline_decision.diwfirstword == -1)
- thisline_decision.diwfirstword = diwfirstword < 0 ? 0 : diwfirstword;
- hdiwstate = DIW_waiting_stop;
- }
- if (pix_hpos >= diwlastword && last_diw_pix_hpos < diwlastword && hdiwstate == DIW_waiting_stop) {
- if (thisline_decision.diwlastword == -1)
- thisline_decision.diwlastword = diwlastword < 0 ? 0 : diwlastword;
- hdiwstate = DIW_waiting_start;
- }
- last_diw_pix_hpos = pix_hpos;
-#endif
}
static int fetchmode;
return bplehb;
}
-// OCS/ECS, lores, 7 planes = 4 "real" planes + BPL5DAT and BPL6DAT as 5th and 6th plane
+// OCS/ECS, lores, 7 planes = 4 "real" planes + BPL5DAT and BPL6DAT as static 5th and 6th plane
STATIC_INLINE int isocs7planes (void)
{
return !(currprefs.chipset_mask & CSMASK_AGA) && bplcon0_res == 0 && bplcon0_planes == 7;
if (thisline_decision.ctable == -1)
remember_ctable ();
-#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
- if (next_color_change >= max_color_change) {
- ++delta_color_change;
- return;
- }
-#endif
if (regno < 0x1000 && hpos < HBLANK_OFFSET && !(beamcon0 & 0x80) && prev_lineno >= 0) {
struct draw_info *pdip = curr_drawinfo + prev_lineno;
int idx = pdip->last_color_change;
}
/* handle very rarely needed playfield collision (CLXDAT bit 0) */
+/* only known game needing this is Rotor */
static void do_playfield_collisions (void)
{
int bplres = bplcon0_res;
max = tospritexddf (thisline_decision.plfright);
if (min > sprite_minx && min < max) /* min < max = full line ddf */
sprite_minx = min;
- /* sprites are visible from first BPL0DAT write to end of line
- * (another undocumented feature)
+ /* sprites are visible from first BPL1DAT write to end of line
+ * (undocumented feature)
*/
}
}
if (cnt < 0)
return;
cnt--;
- write_log (L"BEAMCON0=%04X VTOTAL=%04X HTOTAL=%04X\n", new_beamcon0, vtotal, htotal);
- write_log (L"HSSTOP=%04X HBSTRT=%04X HBSTOP=%04X\n", hsstop, hbstrt, hbstop);
- write_log (L"VSSTOP=%04X VBSTRT=%04X VBSTOP=%04X\n", vsstop, vbstrt, vbstop);
- write_log (L"HSSTRT=%04X VSSTRT=%04X HCENTER=%04X\n", hsstrt, vsstrt, hcenter);
+ write_log (L"BEAMCON0=%04X VTOTAL=%04X HTOTAL=%04X\n", new_beamcon0, vtotal, htotal);
+ write_log (L" HSSTOP=%04X HBSTRT=%04X HBSTOP=%04X\n", hsstop, hbstrt, hbstop);
+ write_log (L" VSSTOP=%04X VBSTRT=%04X VBSTOP=%04X\n", vsstop, vbstrt, vbstop);
+ write_log (L" HSSTRT=%04X VSSTRT=%04X HCENTER=%04X\n", hsstrt, vsstrt, hcenter);
}
/* set PAL/NTSC or custom timing variables */
{
int isntsc;
int odbl = doublescan, omaxvpos = maxvpos;
+ int ovblank = vblank_hz;
int hzc = 0;
if (vsync_switchmode (-1, 0) > 0)
if ((beamcon0 & 0xA0) != (new_beamcon0 & 0xA0))
hzc = 1;
if (beamcon0 != new_beamcon0) {
- hack_vpos = 0;
write_log (L"BEAMCON0 %04x -> %04x\n", beamcon0, new_beamcon0);
+ vpos_count = 0;
}
- if (beamcon0 & 0x80)
- hack_vpos = -1;
beamcon0 = new_beamcon0;
isntsc = (beamcon0 & 0x20) ? 0 : 1;
if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
isntsc = currprefs.ntscmode ? 1 : 0;
- if (hack_vpos > 0) {
- if (maxvpos == hack_vpos) {
- hack_vpos = -1;
- return;
- }
- maxvpos = hack_vpos;
- vblank_hz = 15600 / hack_vpos;
- hack_vpos = -1;
- } else if (hack_vpos < 0) {
- hack_vpos = 0;
- }
- if (hack_vpos == 0) {
- if (!isntsc) {
- maxvpos = MAXVPOS_PAL;
- maxhpos = MAXHPOS_PAL;
- minfirstline = VBLANK_ENDLINE_PAL;
- vblank_hz = VBLANK_HZ_PAL;
- sprite_vblank_endline = VBLANK_SPRITE_PAL;
- equ_vblank_endline = EQU_ENDLINE_PAL;
- } else {
- maxvpos = MAXVPOS_NTSC;
- maxhpos = MAXHPOS_NTSC;
- minfirstline = VBLANK_ENDLINE_NTSC;
- vblank_hz = VBLANK_HZ_NTSC;
- sprite_vblank_endline = VBLANK_SPRITE_NTSC;
- equ_vblank_endline = EQU_ENDLINE_NTSC;
- }
- maxvpos_max = maxvpos;
+ if (!isntsc) {
+ maxvpos = MAXVPOS_PAL;
+ maxhpos = MAXHPOS_PAL;
+ minfirstline = VBLANK_ENDLINE_PAL;
+ vblank_hz = VBLANK_HZ_PAL;
+ sprite_vblank_endline = VBLANK_SPRITE_PAL;
+ equ_vblank_endline = EQU_ENDLINE_PAL;
+ } else {
+ maxvpos = MAXVPOS_NTSC;
+ maxhpos = MAXHPOS_NTSC;
+ minfirstline = VBLANK_ENDLINE_NTSC;
+ vblank_hz = VBLANK_HZ_NTSC;
+ sprite_vblank_endline = VBLANK_SPRITE_NTSC;
+ equ_vblank_endline = EQU_ENDLINE_NTSC;
+ }
+ maxvpos_nom = maxvpos;
+ if (vpos_count > 0) {
+ // we come here if vpos_count != maxvpos (someone poked VPOSW)
+ if (vpos_count < 10)
+ vpos_count = 10;
+ vblank_hz = (15600 + vpos_count - 1) / vpos_count;
+ maxvpos_nom = vpos_count;
+ reset_drawing ();
}
if (beamcon0 & 0x80) {
+ // programmable scanrates (ECS Agnus)
if (vtotal >= MAXVPOS)
vtotal = MAXVPOS - 1;
maxvpos = vtotal + 1;
if (minfirstline >= maxvpos)
minfirstline = maxvpos - 1;
sprite_vblank_endline = minfirstline - 2;
- maxvpos_max = maxvpos;
+ maxvpos_nom = maxvpos;
equ_vblank_endline = -1;
doublescan = htotal <= 164 ? 1 : 0;
dumpsync ();
if (isvsync ()) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate);
}
+ maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 2047 : 511;
+ if (maxvpos > MAXVPOS)
+ maxvpos = MAXVPOS;
compute_vsynctime ();
-#ifdef OPENGL
- OGL_refresh ();
-#endif
#ifdef PICASSO96
init_hz_p96 ();
#endif
+ if (vblank_hz != ovblank)
+ updatedisplayarea ();
inputdevice_tablet_strobe ();
write_log (L"%s mode%s%s V=%dHz H=%dHz (%dx%d)\n",
isntsc ? L"NTSC" : L"PAL",
(bplcon0 & 4) ? L" interlaced" : L"",
doublescan > 0 ? L" dblscan" : L"",
- vblank_hz, vblank_hz * maxvpos,
+ vblank_hz, vblank_hz * maxvpos_nom,
maxhpos, maxvpos);
-
+ config_changed = 1;
}
static void calcdiw (void)
#endif
if (currprefs.chipset_mask & CSMASK_ECS_DENISE)
return 0xFFFC;
- return 0xffff;
+ return 0xFFFF;
}
STATIC_INLINE uae_u16 DMACONR (int hpos)
{
lof = (v & 0x8000) ? 1 : 0;
if (currprefs.chipset_mask & CSMASK_ECS_AGNUS)
lol = (v & 0x0080) ? 1 : 0;
- hack_vpos2 = (vpos & 0xff);
- if (v & 1)
- hack_vpos2 |= 0x100;
- hack_vpos2vpos = vpos;
- if (hack_vpos2 > maxvpos)
- hack_vpos2 = maxvpos;
- // do not allow changing vpos backwards or vsync may never happen..
- if (vpos < hack_vpos2)
- vpos = hack_vpos2;
+ if (lof_changed)
+ return;
+ vpos &= 0x00ff;
+ v &= 7;
+ if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
+ v &= 1;
+ vpos |= v << 8;
}
static void VHPOSW (uae_u16 v)
if (M68K_GETPC < 0xf00000)
write_log (L"VHPOSW %04X PC=%08x\n", v, M68K_GETPC);
#endif
- v >>= 8;
- if (hack_vpos2 & 0x100)
- v |= 0x100;
- else if (vpos & 0x100)
- v |= 0x100;
- hack_vpos2 = v;
- hack_vpos2vpos = vpos;
- if (hack_vpos2 > maxvpos)
- hack_vpos2 = maxvpos;
- if (vpos < hack_vpos2)
- vpos = hack_vpos2;
+ v >>= 8; // lets ignore hpos for now
+ vpos &= 0xff00;
+ vpos |= v;
}
STATIC_INLINE uae_u16 VHPOSR (void)
static void varsync (void)
{
+ if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
+ return;
#ifdef PICASSO96
- if (p96refresh_active)
- {
- extern int p96hack_vpos2;
- static int p96hack_vpos_old;
- if (p96hack_vpos_old == p96hack_vpos2) return;
- vtotal = p96hack_vpos2;
- p96hack_vpos_old = p96hack_vpos2;
- hack_vpos = -1;
+ if (picasso_on && p96refresh_active) {
+ vtotal = p96refresh_active;
return;
}
#endif
- if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE))
- return;
if (!(beamcon0 & 0x80))
return;
- hack_vpos = -1;
+ vpos_count = 0;
dumpsync ();
}
+
+#ifdef PICASSO96
+void set_picasso_hack_rate (int hz)
+{
+ if (!picasso_on)
+ return;
+ vpos_count = 0;
+ p96refresh_active = hz * 2 * maxvpos / (currprefs.ntscmode ? 60 : 50);
+ if (!currprefs.cs_ciaatod)
+ changed_prefs.cs_ciaatod = currprefs.cs_ciaatod = currprefs.ntscmode ? 2 : 1;
+ if (p96refresh_active > 0) {
+ new_beamcon0 |= 0x80;
+ }
+}
+#endif
+
#endif
static void BPLxPTH (int hpos, uae_u16 v, int num)
BPLCON0_Denise (hpos, v);
}
-#if 0
-
-ddf_change = vpos;
-decide_line (hpos);
-decide_fetch (hpos);
-decide_blitter (hpos);
-
-bplcon0 = v;
-
-badmode = GET_RES_AGNUS (bplcon0) != GET_RES_DENISE (bplcon0);
-
-// fake unused 0x0080 bit as an EHB bit (see above)
-if (isehb (bplcon0, bplcon2))
- v |= 0x80;
-
-BPLCON0_Denise (hpos, v);
-
-expand_fmodes ();
-
-record_register_change (hpos, 0x100, v);
-
-calcdiw ();
-estimate_last_fetch_cycle (hpos);
-
-}
-#endif
-
STATIC_INLINE void BPLCON1 (int hpos, uae_u16 v)
{
if (!(currprefs.chipset_mask & CSMASK_AGA))
static void BLTCON0L (int hpos, uae_u16 v)
{
if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
- return;
+ return; // ei voittoa.
maybe_blit (hpos, 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF);
reset_blit (1);
}
if (!(currprefs.chipset_mask & CSMASK_AGA))
return;
clxcon2 = v;
- clxcon_bpl_enable |= v & (0x40|0x80);
- clxcon_bpl_match |= (v & (0x01|0x02)) << 6;
+ clxcon_bpl_enable |= v & (0x40 | 0x80);
+ clxcon_bpl_match |= (v & (0x01 | 0x02)) << 6;
}
static uae_u16 CLXDAT (void)
memset (sprctl, 0, sizeof sprctl);
}
-/*
-* On systems without virtual memory or with low memory, we allocate the
-* sprite_entries and color_changes tables dynamically rather than having
-* them declared static. We don't initially allocate at their maximum sizes;
-* we start the tables off small and grow them as required.
-*
-* This function expands the tables if necessary.
-*/
-static void adjust_array_sizes (void)
-{
-#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
- if (delta_sprite_entry) {
- void *p1;
- void *p2;
- int mcc = max_sprite_entry + 50 + delta_sprite_entry;
-
- delta_sprite_entry = 0;
-
- p1 = realloc (sprite_entries[0], mcc * sizeof (struct sprite_entry));
- p2 = realloc (sprite_entries[1], mcc * sizeof (struct sprite_entry));
-
- if (p1 && p2) {
- sprite_entries[0] = p1;
- sprite_entries[1] = p2;
-
- memset (&sprite_entries[0][max_sprite_entry], (mcc - max_sprite_entry) * sizeof(struct sprite_entry), 0);
- memset (&sprite_entries[1][max_sprite_entry], (mcc - max_sprite_entry) * sizeof(struct sprite_entry), 0);
-
- write_log (L"New max_sprite_entry=%d\n", mcc);
-
- max_sprite_entry = mcc;
- } else
- write_log (L"WARNING: Failed to enlarge sprite_entries table\n");
- }
- if (delta_color_change) {
- void *p1;
- void *p2;
- int mcc = max_color_change + 200 + delta_color_change;
-
- delta_color_change = 0;
-
- p1 = realloc (color_changes[0], mcc * sizeof (struct color_change));
- p2 = realloc (color_changes[1], mcc * sizeof (struct color_change));
-
- if (p1 && p2) {
- color_changes[0] = p1;
- color_changes[1] = p2;
-
- write_log (L"New max_color_change=%d\n", mcc);
-
- max_color_change = mcc;
- } else
- write_log (L"WARNING: Failed to enlarge color_changes table\n");
- }
-#endif
-}
-
static void init_hardware_frame (void)
{
int i;
next_color_entry = 0;
remembered_color_entry = -1;
- adjust_array_sizes ();
-
prev_sprite_entries = sprite_entries[current_change_set];
curr_sprite_entries = sprite_entries[current_change_set ^ 1];
prev_color_changes = color_changes[current_change_set];
return;
}
- {
- static int cnt = 0;
- if (cnt == 0) {
- /* resolution_check_change (); */
- DISK_check_change ();
- cnt = 5;
- }
- cnt--;
- }
+ config_check_vsync ();
if (debug_copper)
record_copper_reset ();
vsync_handle_redraw (lof, lof_changed);
- /* For now, let's only allow this to change at vsync time. It gets too
- * hairy otherwise. */
- if (hack_vpos2) {
- hack_vpos = hack_vpos2vpos + 1;
- if (hack_vpos2 < maxvpos)
- hack_vpos += maxvpos - hack_vpos2;
- if (hack_vpos > maxvpos)
- hack_vpos = maxvpos;
- if (hack_vpos < 10)
- hack_vpos = 10;
- hack_vpos2 = 0;
- }
- if ((beamcon0 & (0x20|0x80)) != (new_beamcon0 & (0x20|0x80)) || hack_vpos)
+ if (p96refresh_active) {
+ vpos_count = p96refresh_active;
+ vtotal = vpos_count;
+ }
+ if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1))
init_hz ();
+ vpos_count_prev = vpos_count;
lof_changed = 0;
{
if (currprefs.m68k_speed == -1) {
frame_time_t curr_time = read_processor_time ();
- vsyncmintime += vsynctime * N_LINES / maxvpos;
+ vsyncmintime += vsynctime * N_LINES / maxvpos_nom;
/* @@@ Mathias? How do you think we should do this? */
/* If we are too far behind, or we just did a reset, adjust the
* needed time. */
}
/* Allow this to be one frame's worth of cycles out */
while (diff32 (curr_time, vsyncmintime + vsynctime) > 0) {
- vsyncmintime += vsynctime * N_LINES / maxvpos;
+ vsyncmintime += vsynctime * N_LINES / maxvpos_nom;
if (currprefs.turbo_emulation)
break;
}
hsync_scandoubler ();
}
- /* In theory only an equality test is needed here - but if a program
- goes haywire with the VPOSW register, it can cause us to miss this,
- with vpos going into the thousands (and all the nasty consequences
- this has). */
- if (++vpos >= maxvpos + lof) {
+ /* Agnus vpos counter keeps counting until it wraps around if VPOSW writes put it past maxvpos */
+ vpos++;
+ vpos_count++;
+ if (vpos >= maxvpos_total)
+ vpos = 0;
+ if (vpos == maxvpos + lof || vpos == maxvpos + lof + 1 || vpos_count >= MAXVPOS) {
+ // vpos_count >= MAXVPOS just to not crash if VPOSW writes prevent vsync completely
if ((bplcon0 & 8) && !lightpen_triggered) {
vpos_lpen = vpos - 1;
hpos_lpen = maxhpos;
}
vpos = 0;
vsync_handler ();
+ vpos_count = 0;
#if 0
if (input_recording > 0) {
inprec_rstart (INPREC_VSYNC);
if (!nocustom ()) {
int lineno = vpos;
+ if (lineno >= MAXVPOS)
+ lineno %= MAXVPOS;
if ((bplcon0 & 4) && currprefs.gfx_linedbl)
notice_interlace_seen ();
nextline_how = nln_normal;
lightpen_x = lightpen_y = -1;
lightpen_triggered = 0;
lightpen_cx = lightpen_cy = -1;
- if (! savestate_state) {
+ if (!savestate_state) {
currprefs.chipset_mask = changed_prefs.chipset_mask;
update_mirrors ();
if (!aga_mode) {
diwstate = DIW_waiting_start;
set_cycles (0);
- hack_vpos = 0;
+ vpos_count = vpos_count_prev = 0;
init_hz ();
vpos_lpen = -1;
return 0;
}
-static int allocate_sprite_tables (void)
-{
-#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
- int num;
-
- delta_sprite_entry = 0;
- delta_color_change = 0;
-
- if (!sprite_entries[0]) {
- max_sprite_entry = DEFAULT_MAX_SPRITE_ENTRY;
- max_color_change = DEFAULT_MAX_COLOR_CHANGE;
-
- for (num = 0; num < 2; num++) {
- sprite_entries[num] = xmalloc (max_sprite_entry * sizeof (struct sprite_entry));
- color_changes[num] = xmalloc (max_color_change * sizeof (struct color_change));
-
- if (sprite_entries[num] && color_changes[num]) {
- memset (sprite_entries[num], 0, max_sprite_entry * sizeof (struct sprite_entry));
- memset (color_changes[num], 0, max_color_change * sizeof (struct color_change));
- } else
- return 0;
- }
- }
-
- if (!spixels) {
- spixels = xmalloc (2 * MAX_SPR_PIXELS * sizeof *spixels);
- if (!spixels)
- return 0;
- }
-#endif
- return 1;
-}
-
int custom_init (void)
{
- if (!allocate_sprite_tables ())
- return 0;
-
#ifdef AUTOCONFIG
if (uae_boot_rom) {
uaecptr pos;
* and finally returns either all ones or something weird if DMA happens
* in next (or previous) cycle.. FIXME.
*
- * OCS-only special case: DFF000 (BLTDAT) will always return whatever was left in bus
+ * OCS-only special case: DFF000 (BLTDDAT) will always return whatever was left in bus
*
* AGA:
* only writes to custom registers change last value, read returns
void check_prefs_changed_custom (void)
{
+ if (!config_changed)
+ return;
currprefs.gfx_framerate = changed_prefs.gfx_framerate;
+ if (currprefs.turbo_emulation != changed_prefs.turbo_emulation)
+ warpmode (changed_prefs.turbo_emulation);
if (inputdevice_config_change_test ())
inputdevice_copyconfig (&changed_prefs, &currprefs);
currprefs.immediate_blits = changed_prefs.immediate_blits;
{
if (beamcon0 & 0x80)
return currprefs.ntscmode == 0;
- return maxvpos >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2;
+ return maxvpos_nom >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2;
}
\ No newline at end of file
#endif
}
-static void reset_drive(int i)
+static void reset_drive (int i)
{
drive *drv = &floppy[i];
void disk_eject (int num)
{
+ config_changed = 1;
gui_filename (num, L"");
drive_eject (floppy + num);
*currprefs.df[num] = *changed_prefs.df[num] = 0;
void disk_insert (int num, const TCHAR *name)
{
+ config_changed = 1;
target_addtorecent (name, 0);
disk_insert_2 (num, name, 0);
}
if (currprefs.gfx_ycenter && !currprefs.gfx_filter_autoscale) {
/* @@@ verify maxvpos vs. MAXVPOS */
- extra_y_adjust = (gfxvidinfo.height - (maxvpos_max << (linedbl ? 1 : 0))) >> 1;
+ extra_y_adjust = (gfxvidinfo.height - (maxvpos_nom << (linedbl ? 1 : 0))) >> 1;
if (extra_y_adjust < 0)
extra_y_adjust = 0;
}
thisframe_y_adjust += diff >> 1;
}
#endif
- if (thisframe_y_adjust + max_drawn_amiga_line > 2 * maxvpos_max)
- thisframe_y_adjust = 2 * maxvpos_max - max_drawn_amiga_line;
+ if (thisframe_y_adjust + max_drawn_amiga_line > 2 * maxvpos_nom)
+ thisframe_y_adjust = 2 * maxvpos_nom - max_drawn_amiga_line;
if (thisframe_y_adjust < 0)
thisframe_y_adjust = 0;
} else {
/* Make sure the value makes sense */
- if (thisframe_y_adjust + max_drawn_amiga_line > maxvpos_max)
- thisframe_y_adjust = maxvpos_max - max_drawn_amiga_line;
+ if (thisframe_y_adjust + max_drawn_amiga_line > maxvpos_nom)
+ thisframe_y_adjust = maxvpos_nom - max_drawn_amiga_line;
if (thisframe_y_adjust < minfirstline)
thisframe_y_adjust = minfirstline;
}
thisframe_y_adjust_real = thisframe_y_adjust << (linedbl ? 1 : 0);
- tmp = (maxvpos_max - thisframe_y_adjust) << (linedbl ? 1 : 0);
+ tmp = (maxvpos_nom - thisframe_y_adjust) << (linedbl ? 1 : 0);
if (tmp != max_ypos_thisframe) {
last_max_ypos = tmp;
if (last_max_ypos < 0)
} else {
*dst = *src;
}
+ config_changed = 1;
break;
}
m++;
if (thisframe_first_drawn_line > thisframe_last_drawn_line)
thisframe_last_drawn_line = thisframe_first_drawn_line;
- maxline = linedbl ? (maxvpos_max + 1) * 2 + 1 : (maxvpos_max + 1) + 1;
+ maxline = linedbl ? (maxvpos_nom + 1) * 2 + 1 : (maxvpos_nom + 1) + 1;
maxline++;
#ifdef SMART_UPDATE
for (i = 0; i < maxline; i++) {
lightpen_cx -= maxhpos;
if (lightpen_cy < minfirstline)
lightpen_cy = minfirstline;
- if (lightpen_cy >= maxvpos_max)
- lightpen_cy = maxvpos_max - 1;
+ if (lightpen_cy >= maxvpos)
+ lightpen_cy = maxvpos - 1;
for (i = 0; i < LIGHTPEN_HEIGHT; i++) {
int line = lightpen_y + i - LIGHTPEN_HEIGHT / 2;
int line = i + thisframe_y_adjust_real;
int where2;
- if (linestate[line] == LINE_UNDECIDED)
- break;
-
where2 = amiga2aspect_line_map[i1];
if (where2 >= gfxvidinfo.height)
break;
; 2007.06.15 uninitialized variable in memory type selection fixed (stupid me) (TW)
; 2007.08.09 started implementing removable drive support (TW)
; 2007.09.01 ACTION_EXAMINE_ALL (TW)
-; 2007.09.05 full filesystem device mounting on the fly (TW)
+; 2007.09.05 fully filesystem device mounting on the fly (TW)
; 2008.01.09 ACTION_EXAMINE_ALL does not anymore return eac_Entries = 0 with continue (fixes some broken programs)
; 2008.12.11 mousehack -> tablet driver
; 2008.12.25 mousehack cursor sync
; 2009.01.20 clipboard sharing
-; 2009.12.27 console hook
AllocMem = -198
FreeMem = -210
our_seglist:
dc.l 0 ; 8 /* NextSeg */
start:
- dc.l 9 ;0 12
- bra.w filesys_mainloop ;1 16
- dc.l make_dev-start ;2 20
- dc.l filesys_init-start ;3 24
- dc.l exter_server-start ;4 28
- dc.l bootcode-start ;5 32
- dc.l setup_exter-start ;6 36
- dc.l mh_e-start ;7 40
- dc.l clipboard_init-start ;8 44
- ;52
+ bra.w filesys_mainloop ;12
+ dc.l make_dev-start ;16
+ dc.l filesys_init-start ;20
+ dc.l exter_server-start ;24
+ dc.l bootcode-start ;28
+ dc.l setup_exter-start ;32
+ dc.l mh_e-start ;36
+ ;40
bootcode:
lea.l doslibname(pc),a1
jsr (a0)
rts
-residenthack
- movem.l d0-d2/a0-a2/a6,-(sp)
- move.l 4.w,a6
- cmp.w #37,20(a6)
- bcs.s .rsh
- moveq #residentcodeend-residentcodestart,d0
- move.l d0,d2
- moveq #1,d1
- jsr AllocMem(a6)
- tst.l d0
- beq.s .rsh
- move.l d0,a2
-
- move.l a2,a0
- lea residentcodestart(pc),a1
-.cp1
- move.l (a1)+,(a0)+
- subq.l #4,d2
- bne.s .cp1
-
- jsr -$0078(a6) ;Disable
- move.l a6,a1
- move.w #-$48,a0 ;InitCode
- move.l a2,d0
- jsr -$01a4(a6) ;SetFunction
- move.l d0,residentcodejump2-residentcodestart+2(a2)
- lea myafterdos(pc),a0
- move.l a0,residentcodejump1-residentcodestart+2(a2)
- jsr -$27C(a6) ;CacheClearU
- jsr -$007e(a6) ;Enable
-.rsh
- movem.l (sp)+,d0-d2/a0-a2/a6
- rts
-
-myafterdos
- move.l (sp),a0
- move.l 2(a0),a0
- move.l a0,-(sp)
- jsr (a0) ;jump to original InitCode
- move.l (sp)+,a0
- addq.l #4,sp ;remove return address
- movem.l d0-d7/a1-a6,-(sp)
- move.l a6,a1
- move.l a0,d0
- move.w #-$48,a0 ;InitCode
- jsr -$01a4(a6) ;SetFunction (restore original)
- bsr.w clipboard_init
- bsr.w consolehook
- movem.l (sp)+,d0-d7/a1-a6
- rts ;return directly to caller
-
- cnop 0,4
-residentcodestart:
- btst #2,d0 ;RTF_AFTERDOS?
- beq.s resjump
-residentcodejump1
- jsr $f00000
-resjump
-residentcodejump2
- jmp $f00000
- cnop 0,4
-residentcodeend:
-
filesys_init:
movem.l d0-d7/a0-a6,-(sp)
move.l 4.w,a6
setup_exter:
movem.l d0-d1/a0-a1,-(sp)
- bsr.w residenthack
moveq.l #26,d0
move.l #$10001,d1
jsr AllocMem(a6)
beq.s .nomh
bsr.w mousehack_init
.nomh
+ cmp.w #36,20(a6)
+ bcs.s .noclip
+ bsr.w clipboard_init
+.noclip
movem.l (sp)+,d0-d1/a0-a1
rts
.f movem.l (sp)+,d2/d3/d4/a2/a3/a6
rts
-; mousehack/tablet
-
mousehack_init:
lea mhname(pc),a0
lea mousehack_task(pc),a1
MH_FOO_DIMS_X = 32
MH_FOO_DIMS_Y = 36
MH_FOO_VPXY = 40
-MH_FOO_MOFFSET = 44
-MH_FOO_ALIVE = 48
-MH_FOO_LIMITCNT = 52
-MH_FOO_DIMS = 56
+MH_FOO_ALIVE = 44
+MH_FOO_DIMS = 48
MH_FOO_DISP = (MH_FOO_DIMS+88)
-MH_FOO_PREFS = (MH_FOO_DISP+48)
-MH_FOO_SIZE = (MH_FOO_PREFS+102)
-
-PREFS_SIZE = 102
+MH_FOO_SIZE = (MH_FOO_DISP+48)
MH_IEV = (MH_FOO+MH_FOO_SIZE) ;InputEvent
MH_IEH = (MH_IEV+22) ;InputHandler (Interrupt)
MH_TM = (MH_IO+4)
MH_END = (MH_TM+4)
-MH_MOUSEHACK = 0
-MH_TABLET = 1
-MH_ACTIVE = 7
-
TAG_USER equ $80000000
TABLETA_Dummy EQU TAG_USER+$3A000
TABLETA_TabletZ EQU TABLETA_Dummy+$01
TABLETA_ResolutionX EQU TABLETA_Dummy+$09
TABLETA_ResolutionY EQU TABLETA_Dummy+$0A
-
DTAG_DISP EQU $80000000
DTAG_DIMS EQU $80001000
DTAG_MNTR EQU $80002000
DTAG_NAME EQU $80003000
getgfxlimits:
- movem.l d0-d4/a0-a6,-(sp)
+ movem.l d0-d3/a0-a6,-(sp)
move.l a0,a5
sub.l a2,a2
sub.l a3,a3
sub.l a4,a4
- moveq #0,d4
move.l MH_FOO_GFXBASE(a5),a6
move.l MH_FOO_INTBASE(a5),a0
move.l a0,a4
jsr -$318(a6) ;GetVPModeID
moveq #-1,d1
- moveq #-1,d2
cmp.l d0,d1
beq.s .end
move.l d0,d3
- ; mouse offset
- move.l MH_FOO_INTBASE(a5),a6
- lea MH_FOO_PREFS(a5),a0
- moveq #PREFS_SIZE,d0
- jsr -$84(a6) ;GetPrefs
- lea MH_FOO_PREFS(a5),a0
- move.w 100(a0),d4
- move.l MH_FOO_GFXBASE(a5),a6
-
; Text Overscan area needed
sub.l a0,a0
lea MH_FOO_DIMS(a5),a1
.end
move.l 28(a4),d0
- cmp.w MH_FOO_MOFFSET(a5),d4
- bne.s .dosend
cmp.l MH_FOO_VPXY(a5),d0
bne.s .dosend
cmp.l MH_FOO_DIMS_X(a5),d1
move.l d0,MH_FOO_VPXY(a5)
move.l d1,MH_FOO_DIMS_X(a5)
move.l d2,MH_FOO_DIMS_Y(a5)
- move.w d4,MH_FOO_MOFFSET(a5)
; This only for doublescan properties bit..
sub.l a0,a0
.nomntr
;send updated data to native side
- move.w MH_FOO_MOFFSET(a5),d2
move.w #$FF38,d0
moveq #1,d1
bsr.w getrtbase
jsr (a0)
.nosend
- movem.l (sp)+,d0-d4/a0-a6
+ movem.l (sp)+,d0-d3/a0-a6
rts
mousehack_task:
moveq #0,d0
jsr -$0228(a6) ;OpenLibrary
move.l d0,MH_FOO_INTBASE(a3)
- beq.s mhloop
+ beq.w mhloop
.intyes
tst.l MH_FOO_GFXBASE(a3)
bne.s .gfxyes
move.l d0,MH_TM(a5)
beq.w mhend
+ ; add handler
+; move.l MH_IO(a5),a1
+; lea MH_IEH(a5),a2
+; lea mhhandler(pc),a0
+; move.l a0,18(a2) ;is_Code
+; move.b #-1,9(a2) ;ln_pri, less than Intuition
+; lea mhname(pc),a0
+; move.l a0,10(a2) ;ln_Name
+; move.w #9,28(a1) ;IND_ADDHANDLER
+; move.l a2,40(a1)
+; move.b #1,30(a1) ;IOF_QUICK
+; jsr -$01c8(a6) ;DoIO
+
;tell native side that mousehack is now active
move.w #$FF38,d0
moveq #0,d1
.yestim
cmp.w #36,d7
- bcs.s .nodims
- subq.l #1,MH_FOO_LIMITCNT(a3)
- bpl.s .nodims
+ bcs.s .old
move.l a3,a0
bsr.w getgfxlimits
- moveq #50,d0
- move.l d0,MH_FOO_LIMITCNT(a3)
-.nodims
+.old
move.l MH_IO(a5),a1
lea MH_IEV(a5),a2
move.l a2,40(a1)
move.b mh_e(pc),d0
- cmp.w #39,d7
- bcs.w .notablet
- btst #MH_TABLET,d0
- beq.w .notablet
-
- ;IENewTablet
-
- lea MH_IEPT(a5),a0
- move.l a0,10(a2) ;ie_Addr
-
+ bpl.s .nomh
+ cmp.w #36,d7
+ bcs.w mhmode
+
+.nomh
move.b #$13,4(a2) ;ie_Class=IECLASS_NEWPOINTERPOS
- move.b #3,5(a2) ;ie_SubClass = IESUBCLASS_NEWTABLET
- clr.l (a0) ;ient_CallBack
- clr.l 4(a0)
clr.w 6(a2) ;ie_Code
- clr.l 8(a0)
- clr.w 12(a0)
-
;IEQUALIFIER_MIDBUTTON=0x1000/IEQUALIFIER_RBUTTON=0x2000/IEQUALIFIER_LEFTBUTTON=0x4000
move.l mh_buttonbits(pc),d1
and.w #7,d1
lsl.w #8,d0
lsl.w #4,d0
move.w d0,8(a2) ;ie_Qualifier
+
+ lea MH_IEPT(a5),a0
+ move.l a0,10(a2) ;ie_Addr
+ move.b mh_e(pc),d0
+ bmi.w .v37mh
+ cmp.w #39,d7
+ bcs.w .v37
+
+ ;IENewTablet
+
+ move.b #3,5(a2) ;ie_SubClass = IESUBCLASS_NEWTABLET
+ clr.l (a0) ;ient_CallBack
+ clr.l 4(a0)
+ clr.l 8(a0)
+ clr.w 12(a0)
move.w mh_x(pc),12+2(a0) ;ient_TabletX
clr.w 16(a0)
move.w mh_y(pc),16+2(a0) ;ient_TabletY
.noproxi
clr.l (a1) ;TAG_DONE
+ bra.s buttons
+
+.v37mh
+ clr.w 8(a2)
+.v37
+ cmp.w #36,d7
+ bcs.w mhloop
+
+ ;IEPointerTable
+ move.b #2,5(a2) ;ie_SubClass = IESUBCLASS_TABLET
+ move.w mh_maxx(pc),(a0) ;iept_Range.X
+ move.w mh_maxy(pc),2(a0) ;iept_Range.Y
+ move.w mh_x(pc),4(a0) ;iept_Value.X
+ move.w mh_y(pc),6(a0) ;iept_Value.Y
+ move.w mh_pressure(pc),d0
+ asr.w #8,d0
+ move.w d0,8(a0) ;iept_Pressure (-128 to 127)
+
+buttons
bsr.w mhdoio
+ ; mhmode = buttons are handled normally
+ move.b mh_e(pc),d0
+ bmi.w mhloop
+
;create mouse button events if button state changed
move.w #$68,d3 ;IECODE_LBUTTON->IECODE_RBUTTON->IECODE_MBUTTON
moveq #1,d2
cmp.w #8,d2
bne.s .nextbut
move.l d4,MH_FOO_BUTTONS(a3)
+ bra.w mhloop
-.notablet
-
- move.b mh_e(pc),d0
- btst #MH_MOUSEHACK,d0
- beq.w mhloop
+mhmode
clr.l (a2)
move.w #$0400,4(a2) ;IECLASS_POINTERPOS
lea $dff000,a0
moveq #0,d0
rts
-
-; clipboard sharing
+
+;mhhandler:
+; movem.l a0/a2,-(sp)
+; move.l a0,a2
+;.mhl
+; cmp.b #4,4(a2) ;IECLASS_POINTERPOS
+; bne.s .mhl1
+; move.w #$FF38,d0
+; moveq #3,d1
+; bsr.w getrtbase
+; jsr (a0)
+;.mhl1
+; move.l (a2),d0
+; move.l d0,a2
+; bne.s .mhl
+; movem.l (sp)+,a0/a2
+; move.l a0,d0
+; rts
CLIP_WRITE_SIZE = 0
CLIP_WRITE_ALLOC = (CLIP_WRITE_SIZE+4)
CLIP_HOOK = (CLIP_DOS+4)
CLIP_BUF = (CLIP_HOOK+20)
CLIP_BUF_SIZE = 8
-CLIP_POINTER_NOTIFY = (CLIP_BUF+CLIP_BUF_SIZE)
-CLIP_POINTER_PREFS = (CLIP_POINTER_NOTIFY+48)
-CLIP_END = (CLIP_POINTER_PREFS+32)
+CLIP_END = (CLIP_BUF+CLIP_BUF_SIZE)
clipboard_init:
- movem.l a5/a6,-(sp)
+ lea clname(pc),a0
+ lea clipboard_task(pc),a1
+ moveq #-10,d0
+ bsr createtask
+ rts
+
+clipboard_task:
+ sub.l a5,a5
move.l 4.w,a6
+
move.l #CLIP_END,d0
move.l #$10001,d1
jsr AllocMem(a6)
tst.l d0
- beq.w clipdie
+ beq.s clipdie
move.l d0,a5
+
move.l a6,CLIP_EXEC(a5)
+ sub.l a1,a1
+ jsr -294(a6) ; FindTask
+ move.l d0,CLIP_TASK(a5)
+
move.w #$FF38,d0
moveq #14,d1
bsr.w getrtbase
move.l a5,d0
jsr (a0)
- ; we need to be a process, LoadLibrary() needs to call dos
+.wait
+ moveq #0,d0
+ bset #13,d0
+ jsr -$013e(a6) ;Wait
+ jsr -$0084(a6) ;Forbid
+ lea 378(a6),a0 ;LibList
+ lea doslibname(pc),a1
+ jsr -$114(a6) ;FindName
+ move.l d0,d2
+ jsr -$008a(a6) ;Permit
+ tst.l d2
+ beq.s .wait
+
+ clr.l CLIP_TASK(a5)
+
lea clname(pc),a0
lea clipboard_proc(pc),a1
moveq #-10,d0
- move.l #10000,d1
+ move.l #3000,d1
bsr.w createproc
-
+
+ ; task has done its job, process continues..
moveq #0,d0
- movem.l (sp)+,a5/a6
rts
-clipkill
+clipdie:
move.w #$FF38,d0
moveq #10,d1
bsr.w getrtbase
jsr (a0)
- rts
-
-clipdie:
- bsr.s clipkill
move.l a5,d0
beq.s .cd1
move.l CLIP_EXEC(a5),a6
jsr -414(a6) ; CloseLibrary
.cd2
move.l a5,a1
- move.l #CLIP_END,d0
+ moveq #CLIP_END,d0
jsr FreeMem(a6)
.cd1
moveq #0,d0
rts
-prefsread:
- movem.l d2-d4/a2-a6,-(sp)
- move.l CLIP_DOS(a5),a6
- lea pointer_prefs(pc),a0
- move.l a0,d1
- move.l #1005,d2
- jsr -$001e(a6) ;Open
- move.l d0,d4
- beq.s .pr1
- lea CLIP_POINTER_PREFS(a5),a2
-.pr4
- clr.l (a2)
-.pr3
- move.w 2(a2),(a2)
- move.l a2,d2
- addq.l #2,d2
- moveq #2,d3
- move.l d4,d1
- jsr -$002a(a6) ;Read
- cmp.l d0,d3
- bne.s .pr1
- cmp.l #'PNTR',(a2)
- bne.s .pr3
- move.l a2,d2
- moveq #4,d3
- move.l d4,d1
- jsr -$002a(a6) ;Read
- move.l a2,d2
- moveq #32,d3
- move.l d4,d1
- jsr -$002a(a6) ;Read
- cmp.l d0,d3
- bne.s .pr1
- tst.w 16(a2) ;pp_Which
- bne.s .pr4
- move.w #$FF38,d0
- moveq #16,d1
- bsr.w getrtbase
- jsr (a0)
-.pr1
- move.l d4,d1
- beq.s .pr2
- jsr -$0024(a6) ;Close
-.pr2
- movem.l (sp)+,d2-d4/a2-a6
- rts
-
-prefshook:
- move.l CLIP_DOS(a5),a6
- lea ram_name(pc),a0
- move.l a0,d1
- moveq #-2,d2
- jsr -$0054(a6) ;Lock
- move.l d0,d1
- beq.s .ph1
- jsr -$005a(a6) ;Unlock
- move.l CLIP_EXEC(a5),a6
- lea CLIP_POINTER_NOTIFY(a5),a2
- moveq #-1,d0
- jsr -$014a(a6) ;AllocSignal
- move.b d0,20(a2) ;nr_SignalNum
- lea pointer_prefs(pc),a0
- move.l a0,(a2) ;nr_Name
- move.l #NRF_SEND_SIGNAL|NRF_NOTIFY_INITIAL,12(a2) ;nr_Flags
- move.l CLIP_TASK(a5),16(a2) ;nr_Task
- move.l CLIP_DOS(a5),a6
- move.l a2,d1
- jsr -$378(a6) ;StartNotify
-.ph1
- move.l CLIP_EXEC(a5),a6
- rts
-
cnop 0,4
dc.l 16
clipboard_proc:
moveq #0,d0
jsr -$0228(a6) ; OpenLibrary
move.l d0,CLIP_DOS(a5)
+ tst.l d0
beq.w clipdie
move.l d0,a6
moveq #0,d0
bset #13,d0
jsr -$013e(a6) ;Wait
-
+
moveq #0,d1
move.l CLIP_UNIT(a5),d0
lea clip_dev(pc),a0
jsr -$01bc(a6) ;OpenDevice
tst.l d0
bne.s cfloop2
- move.l 20(a4),a0 ;device node
- cmp.w #37,20(a0) ;must be at least v37
- bcc.s cfversion
- ;too lazy to free everything..
- bsr.w clipkill
-cfloop3
- moveq #0,d0
- jsr -$013e(a6) ;Wait
- bra.s cfloop3
-
-cfversion
- bsr.w prefshook
+
+ move.w #$FF38,d0
+ moveq #15,d1
+ bsr.w getrtbase
+ jsr (a0)
lea CLIP_HOOK(a5),a0
move.l a0,40(a4)
move.l a4,a1
jsr -$01c8(a6) ;DoIO
- move.w #$FF38,d0
- moveq #15,d1
- bsr.w getrtbase
- jsr (a0)
- tst.l CLIP_WRITE_SIZE(a5)
- bne.s clipsignal
-
cfloop
moveq #0,d0
- moveq #0,d2
- move.b CLIP_POINTER_NOTIFY+20(a5),d2
- bset d2,d0
bset #13,d0
jsr -$013e(a6) ;Wait
- btst d2,d0
- beq.s clipsignal
- bsr.w prefsread
- bra.s cfloop
-clipsignal
move.l CLIP_WRITE_SIZE(a5),d0
beq.w clipread
;allocate amiga-side space
moveq #0,d0
rts
-consolehook:
- move.l 4.w,a6
- moveq #-1,d2
- move.w #$FF38,d0
- moveq #100,d1
- bsr.w getrtbase
- jsr (a0)
- tst.l d0
- beq.s .ch2
- moveq #0,d2
- jsr -$0084(a6) ;Forbid
- lea 350(a6),a0 ;DeviceList
- lea con_dev(pc),a1
- jsr -$114(a6) ;FindName
- tst.l d0
- beq.s .ch1
- move.l d0,a0
- lea chook(pc),a1
- move.l -$1e+2(a0),a2 ; BeginIO
- move.l a1,-$1e+2(a0)
- move.l a0,a1
- move.w #$FF38,d0
- moveq #101,d1
- bsr.w getrtbase
- jsr (a0)
- moveq #1,d2
-.ch1
- jsr -$008a(a6) ;Permit
-.ch2
- move.l d2,d0
- rts
-
-chook:
- subq.l #4,sp ; native code fills with original return address
- movem.l d0-d1/a0,-(sp)
- move.w #$FF38,d0
- moveq #102,d1
- bsr.w getrtbase
- jsr (a0)
- movem.l (sp)+,d0-d1/a0
- rts
-
-
inp_dev: dc.b 'input.device',0
tim_dev: dc.b 'timer.device',0
-con_dev: dc.b 'console.device',0
-devsn_name: dc.b 'DEVS',0
devs_name: dc.b 'DEVS:',0
clip_name: dc.b 'DEVS:clipboard.device',0
-ram_name: dc.b 'RAM:',0
clip_dev: dc.b 'clipboard.device',0
- ;argghh but StartNotify()ing non-existing ENV: causes "Insert disk ENV: in any drive" dialog..
-pointer_prefs: dc.b 'RAM:Env/Sys/Pointer.prefs',0
clname: dc.b 'UAE clipboard sharing',0
mhname: dc.b 'UAE mouse driver',0
exter_name: dc.b 'UAE filesystem',0
fill_prefetch_full ();
break;
case i_RTE:
- if (using_mmu) {
- printf ("\tm68k_do_rte_mmu ();\n");
+ if (cpu_level == 0) {
+ genamode (Aipi, "7", sz_word, "sr", 1, 0, GF_NOREFILL);
+ genamode (Aipi, "7", sz_long, "pc", 1, 0, GF_NOREFILL);
+ printf ("\tregs.sr = sr;\n");
+ setpc ("pc");
+ printf ("\tMakeFromSR ();\n");
} else {
- if (cpu_level == 0) {
- genamode (Aipi, "7", sz_word, "sr", 1, 0, GF_NOREFILL);
- genamode (Aipi, "7", sz_long, "pc", 1, 0, GF_NOREFILL);
- printf ("\tregs.sr = sr;\n");
- setpc ("pc");
- printf ("\tMakeFromSR ();\n");
- } else {
- int old_brace_level = n_braces;
- if (next_cpu_level < 0)
- next_cpu_level = 0;
- genamode (Aipi, "7", sz_word, "sr", 1, 0, 0);
- genamode (Aipi, "7", sz_long, "pc", 1, 0, 0);
- genamode (Aipi, "7", sz_word, "format", 1, 0, 0);
- printf ("\tm68k_do_rte (pc, sr, format, 0x%04x);\n", opcode);
- }
- /* PC is set and prefetch filled. */
+ int old_brace_level = n_braces;
+ if (next_cpu_level < 0)
+ next_cpu_level = 0;
+ printf ("\tuae_u16 newsr; uae_u32 newpc;\n");
+ printf ("\tfor (;;) {\n");
+ genamode (Aipi, "7", sz_word, "sr", 1, 0, 0);
+ genamode (Aipi, "7", sz_long, "pc", 1, 0, 0);
+ genamode (Aipi, "7", sz_word, "format", 1, 0, 0);
+ printf ("\tnewsr = sr; newpc = pc;\n");
+ printf ("\tif ((format & 0xF000) == 0x0000) { break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0x1000) { ; }\n");
+ printf ("\telse if ((format & 0xF000) == 0x2000) { m68k_areg (regs, 7) += 4; break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0x4000) { m68k_areg (regs, 7) += 8; break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0x8000) { m68k_areg (regs, 7) += 50; break; }\n");
+ if (using_mmu)
+ printf ("\telse if ((format & 0xF000) == 0x7000) { m68k_do_rte_mmu (); m68k_areg (regs, 7) += 52; break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0x9000) { m68k_areg (regs, 7) += 12; break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0xa000) { m68k_areg (regs, 7) += 24; break; }\n");
+ printf ("\telse if ((format & 0xF000) == 0xb000) { m68k_areg (regs, 7) += 84; break; }\n");
+ printf ("\telse { Exception (14, 0); goto %s; }\n", endlabelstr);
+ printf ("\tregs.sr = newsr; MakeFromSR ();\n}\n");
+ pop_braces (old_brace_level);
+ printf ("\tregs.sr = newsr; MakeFromSR ();\n");
+ printf ("\tif (newpc & 1)\n");
+ printf ("\t\texception3 (0x%04X, m68k_getpc (), newpc);\n", opcode);
+ printf ("\telse\n");
+ printf ("\t\tm68k_setpc (newpc);\n");
+ need_endlabel = 1;
}
+ /* PC is set and prefetch filled. */
m68k_pc_offset = 0;
fill_prefetch_full ();
break;
#define GRN 1
#define BLU 2
-/*
-* dither matrix
-*/
-static uae_u8 dither[4][4] =
-{
- { 0, 8, 2, 10 },
- { 12, 4, 14, 6 },
- { 3, 11, 1, 9 },
- { 14 /* 15 */, 7, 13, 5 }
-};
-
-
unsigned int doMask (int p, int bits, int shift)
{
/* scale to 0..255, shift to align msb with mask, and apply mask */
xgreencolor_m = (1 << gw) - 1;
xbluecolor_m = (1 << bw) - 1;
}
-
-static int color_diff[4096];
-static int newmaxcol = 0;
-
-void setup_maxcol (int max)
-{
- newmaxcol = max;
-}
-
-void alloc_colors256 (allocfunc_type allocfunc)
-{
- int nb_cols[3]; /* r,g,b */
- int maxcol = newmaxcol == 0 ? 256 : newmaxcol;
- int i,j,k,l;
- xcolnr *map;
-
- map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
- if (!map) {
- write_log (L"Not enough mem for colormap!\n");
- abort ();
- }
-
- /*
- * compute #cols per components
- */
- for (i = 1; i*i*i <= maxcol; ++i)
- ;
- --i;
-
- nb_cols[RED] = i;
- nb_cols[GRN] = i;
- nb_cols[BLU] = i;
-
- /*
- * set the colormap
- */
- l = 0;
- for (i = 0; i < nb_cols[RED]; ++i) {
- int r = (i * 15) / (nb_cols[RED] - 1);
- for (j = 0; j < nb_cols[GRN]; ++j) {
- int g = (j * 15) / (nb_cols[GRN] - 1);
- for (k = 0; k < nb_cols[BLU]; ++k) {
- int b = (k * 15) / (nb_cols[BLU] - 1);
- int result;
- result = allocfunc (r, g, b, map + l);
- l++;
- }
- }
- }
- /* printf("%d color(s) lost\n",maxcol - l);*/
-
- /*
- * for each component compute the mapping
- */
- {
- int diffr, diffg, diffb, maxdiff = 0, won = 0, lost;
- int r, d = 8;
- for (r = 0; r < 16; ++r) {
- int cr, g, q;
-
- k = nb_cols[RED]-1;
- cr = (r * k) / 15;
- q = (r * k) % 15;
- if (q > d && cr < k) ++cr;
- diffr = abs (cr*k - r);
- for (g = 0; g < 16; ++g) {
- int cg, b;
-
- k = nb_cols[GRN]-1;
- cg = (g * k) / 15;
- q = (g * k) % 15;
- if (q > d && cg < k) ++cg;
- diffg = abs (cg*k - g);
- for (b = 0; b < 16; ++b) {
- int cb, rgb = (r << 8) | (g << 4) | b;
-
- k = nb_cols[BLU]-1;
- cb = (b * k) / 15;
- q = (b * k) % 15;
- if (q > d && cb < k) ++cb;
- diffb = abs (cb*k - b);
- xcolors[rgb] = map[(cr * nb_cols[GRN] + cg) * nb_cols[BLU] + cb];
- color_diff[rgb] = diffr + diffg + diffb;
- if (color_diff[rgb] > maxdiff)
- maxdiff = color_diff[rgb];
- }
- }
- }
- while (maxdiff > 0 && l < maxcol) {
- int newmaxdiff = 0;
- lost = 0; won++;
- for (r = 15; r >= 0; r--) {
- int g;
-
- for (g = 15; g >= 0; g--) {
- int b;
-
- for (b = 15; b >= 0; b--) {
- int rgb = (r << 8) | (g << 4) | b;
-
- if (color_diff[rgb] == maxdiff) {
- int result;
-
- if (l >= maxcol)
- lost++;
- else {
- result = allocfunc (r, g, b, xcolors + rgb);
- l++;
- }
- color_diff[rgb] = 0;
- } else if (color_diff[rgb] > newmaxdiff)
- newmaxdiff = color_diff[rgb];
-
- }
- }
- }
- maxdiff = newmaxdiff;
- }
- /* printf("%d color(s) lost, %d stages won\n",lost, won);*/
- }
- free (map);
-}
-
-/*
-* This dithering process works by letting UAE run internaly in 12bit
-* mode and doing the dithering on the fly when rendering to the display.
-* The dithering algorithm is quite fast but uses lot of memory (4*8*2^12 =
-* 128Kb). I don't think that is a trouble right now, but when UAE will
-* emulate AGA and work internaly in 24bit mode, that dithering algorithm
-* will need 4*8*2^24 = 512Mb. Obviously that fast algorithm will not be
-* tractable. However, we could then use an other algorithm, slower, but
-* far more reasonable (I am thinking about the one that is used in DJPEG).
-*/
-
-uae_u8 cidx[4][8*4096]; /* fast, but memory hungry =:-( */
-
-/*
-* Compute dithering structures
-*/
-void setup_greydither_maxcol (int maxcol, allocfunc_type allocfunc)
-{
- int i,j,k;
- xcolnr *map;
-
- for (i = 0; i < 4096; i++)
- xcolors[i] = i << 16 | i;
-
- map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
- if (!map) {
- write_log (L"Not enough mem for colormap!\n");
- abort();
- }
-
- /*
- * set the colormap
- */
- for (i = 0; i < maxcol; ++i) {
- int c, result;
- c = (15 * i + (maxcol-1)/2) / (maxcol - 1);
- result = allocfunc(c, c, c, map + i);
- /* @@@ check for errors */
- }
-
- /*
- * for each componant compute the mapping
- */
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j) {
- int r, d = dither[i][j]*17;
- for (r = 0; r<16; ++r) {
- int g;
- for (g = 0; g < 16; ++g) {
- int b;
- for (b = 0; b < 16; ++b) {
- int rgb = (r << 8) | (g << 4) | b;
- int c,p,q;
-
- c = (77 * r +
- 151 * g +
- 28 * b) / 15; /* c in 0..256 */
-
- k = maxcol-1;
- p = (c * k) / 256;
- q = (c * k) % 256;
- if (q /*/ k*/> d /*/ k*/ && p < k) ++p;
- /* sam: ^^^^^^^ */
- /* It seems that produces better output */
- cidx[i][rgb + (j+4)*4096] =
- cidx[i][rgb + j*4096] = (uae_u8)map[p];
- }
- }
- }
- }
- }
- free (map);
-}
-
-void setup_greydither (int bits, allocfunc_type allocfunc)
-{
- setup_greydither_maxcol(1 << bits, allocfunc);
-}
-
-void setup_dither (int bits, allocfunc_type allocfunc)
-{
- int nb_cols[3]; /* r,g,b */
- int maxcol = 1 << bits;
- int i,j,k,l;
-
- xcolnr *map;
- int *redvals, *grnvals, *bluvals;
-
- map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
- if (!map) {
- write_log (L"Not enough mem for colormap!\n");
- abort();
- }
-
- for (i = 0; i < 4096; i++)
- xcolors[i] = i << 16 | i;
-
- /*
- * compute #cols per components
- */
- for (i = 1; i*i*i <= maxcol; ++i)
- ;
- --i;
-
- nb_cols[RED] = i;
- nb_cols[GRN] = i;
- nb_cols[BLU] = i;
-
- if (nb_cols[RED]*(++i)*nb_cols[BLU] <= maxcol) {
- nb_cols[GRN] = i;
- if ((i)*nb_cols[GRN]*nb_cols[BLU] <= maxcol)
- nb_cols[RED] = i;
- }
-
- redvals = (int *)malloc (sizeof(int) * maxcol);
- grnvals = redvals + nb_cols[RED];
- bluvals = grnvals + nb_cols[GRN];
- /*
- * set the colormap
- */
- l = 0;
- for (i = 0; i < nb_cols[RED]; ++i) {
- int r = (i * 15) / (nb_cols[RED] - 1);
- redvals[i] = r;
- for (j = 0; j < nb_cols[GRN]; ++j) {
- int g = (j * 15) / (nb_cols[GRN] - 1);
- grnvals[j] = g;
- for (k = 0; k < nb_cols[BLU]; ++k) {
- int b = (k * 15) / (nb_cols[BLU] - 1);
- int result;
- bluvals[k] = b;
- result = allocfunc(r, g, b, map + l);
- l++;
- }
- }
- }
- /* write_log (L"%d color(s) lost\n",maxcol - l);*/
-
- /*
- * for each component compute the mapping
- */
- {
- int r;
- for (r = 0; r < 16; ++r) {
- int g;
- for (g = 0; g < 16; ++g) {
- int b;
- for (b = 0; b < 16; ++b) {
- int rgb = (r << 8) | (g << 4) | b;
-
- for (i = 0; i < 4; ++i) for (j = 0; j < 4; ++j) {
- int d = dither[i][j];
- int cr, cg, cb, k, q;
-#if 0 /* Slightly different algorithm. Needs some tuning. */
- int rederr = 0, grnerr = 0, bluerr = 0;
-
- k = nb_cols[RED]-1;
- cr = r * k / 15;
- q = r * k - 15*cr;
- if (cr < 0)
- cr = 0;
- else if (q / k > d / k && rederr <= 0)
- ++cr;
- if (cr > k) cr = k;
- rederr += redvals[cr]-r;
-
- k = nb_cols[GRN]-1;
- cg = g * k / 15;
- q = g * k - 15*cg;
- if (cg < 0)
- cg = 0;
- else if (q / k > d / k && grnerr <= 0)
- ++cg;
- if (cg > k) cg = k;
- grnerr += grnvals[cg]-g;
-
- k = nb_cols[BLU]-1;
- cb = b * k / 15;
- q = b * k - 15*cb;
- if (cb < 0)
- cb = 0;
- else if (q / k > d / k && bluerr <= 0)
- ++cb;
- if (cb > k) cb = k;
- bluerr += bluvals[cb]-b;
-#else
- k = nb_cols[RED]-1;
- cr = r * k / 15;
- q = r * k - 15*cr;
- if (cr < 0)
- cr = 0;
- else if (q /*/ k*/ > d /*/ k*/)
- ++cr;
- if (cr > k) cr = k;
-
- k = nb_cols[GRN]-1;
- cg = g * k / 15;
- q = g * k - 15*cg;
- if (cg < 0)
- cg = 0;
- else if (q /*/ k*/ > d /*/ k*/)
- ++cg;
- if (cg > k) cg = k;
-
- k = nb_cols[BLU]-1;
- cb = b * k / 15;
- q = b * k - 15*cb;
- if (cb < 0)
- cb = 0;
- else if (q /*/ k*/ > d /*/ k*/)
- ++cb;
- if (cb > k) cb = k;
-#endif
- cidx[i][rgb + (j+4)*4096] = cidx[i][rgb + j*4096] = (uae_u8)map[(cr*nb_cols[GRN]+cg)*nb_cols[BLU]+cb];
- }
- }
- }
- }
- }
- free (redvals);
- free (map);
-}
-
-#if !defined X86_ASSEMBLY
-/*
-* Dither the line.
-* Make sure you call this only with (len & 3) == 0, or you'll just make
-* yourself unhappy.
-*/
-
-void DitherLine (uae_u8 *l, uae_u16 *r4g4b4, int x, int y, uae_s16 len, int bits)
-{
- uae_u8 *dith = cidx[y&3]+(x&3)*4096;
- uae_u8 d = 0;
- int bitsleft = 8;
-
- if (bits == 8) {
- while (len > 0) {
- *l++ = dith[0*4096 + *r4g4b4++];
- *l++ = dith[1*4096 + *r4g4b4++];
- *l++ = dith[2*4096 + *r4g4b4++];
- *l++ = dith[3*4096 + *r4g4b4++];
- len -= 4;
- }
- return;
- }
-
- while (len) {
- int v;
- v = dith[0*4096 + *r4g4b4++];
- bitsleft -= bits;
- d |= (v << bitsleft);
- if (!bitsleft)
- *l++ = d, bitsleft = 8, d = 0;
-
- v = dith[1*4096 + *r4g4b4++];
- bitsleft -= bits;
- d |= (v << bitsleft);
- if (!bitsleft)
- *l++ = d, bitsleft = 8, d = 0;
-
- v = dith[2*4096 + *r4g4b4++];
- bitsleft -= bits;
- d |= (v << bitsleft);
- if (!bitsleft)
- *l++ = d, bitsleft = 8, d = 0;
-
- v = dith[3*4096 + *r4g4b4++];
- bitsleft -= bits;
- d |= (v << bitsleft);
- if (!bitsleft)
- *l++ = d, bitsleft = 8, d = 0;
- len -= 4;
- }
-}
-#endif
extern int picasso_requested_on;
extern int picasso_on;
+extern void set_picasso_hack_rate (int hz);
/* Set to 1 to leave out the current frame in average frame time calculation.
* Useful if the debugger was active. */
#define EQU_ENDLINE_NTSC 10
extern int maxhpos, maxhpos_short;
-extern int maxvpos, maxvpos_max;
+extern int maxvpos, maxvpos_nom;
extern int minfirstline, vblank_endline, numscrlines;
extern int vblank_hz, fake_vblank_hz, vblank_skip, doublescan;
extern frame_time_t syncbase;
extern void event2_newevent2(evt, uae_u32, evfunc2);
extern void event2_remevent(int);
+#if 0
#ifdef JIT
#include "events_jit.h"
#else
#include "events_normal.h"
#endif
+#else
+#include "events_jit.h"
+#endif
STATIC_INLINE int current_hpos (void)
{
-#if 1
-
/* Let's see whether hiding this away somewhere where the compiler can't
see it will cure it of its silly urge to mis-optimize the comparison */
extern long int diff32(frame_time_t x, frame_time_t y);
#define do_cycles do_cycles_slow
#define countdown pissoff
-#else
-
-/* Let's see whether hiding this away somewhere where the compiler can't
-see it will cure it of its silly urge to mis-optimize the comparison */ extern long int diff32(frame_time_t x, frame_time_t y);
-
-extern long cycles_to_next_event;
-extern long max_cycles_to_next_event;
-extern long cycles_to_hsync_event;
-extern long pissoff;
-
-STATIC_INLINE void cycles_do_special(void)
-{
- if (cycles_to_next_event >= 0) {
- pissoff += cycles_to_next_event;
- cycles_to_next_event = 0;
- }
-}
-
-
-STATIC_INLINE void do_extra_cycles (unsigned long cycles_to_add) {
- pissoff -= cycles_to_add;
-}
-
-STATIC_INLINE unsigned long int get_cycles (void)
-{
- if (cycles_to_next_event <= max_cycles_to_next_event) {
- max_cycles_to_next_event = cycles_to_next_event;
- return nextevent - cycles_to_next_event;
- } else {
- return nextevent - max_cycles_to_next_event;
- }
-}
-
-STATIC_INLINE void events_schedule (void)
-{
- int i;
-
- unsigned long int curcycles = get_cycles();
- unsigned long int mintime = ~0L;
-
- cycles_to_hsync_event=eventtab[ev_hsync].evtime - curcycles;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active) {
- unsigned long int eventtime = eventtab[i].evtime - curcycles;
- if (eventtime < mintime)
- mintime = eventtime;
- }
- }
- nextevent = curcycles + mintime;
- max_cycles_to_next_event = mintime;
- cycles_to_next_event = mintime;
- cycles_to_hsync_event = mintime - cycles_to_hsync_event;
-}
-
-STATIC_INLINE void set_cycles (unsigned long int x)
-{
- cycles_to_next_event = nextevent - x;
- events_schedule ();
-}
-
-STATIC_INLINE void do_cycles_slow (long cycles_to_add)
-{
- cycles_to_next_event -= cycles_to_add;
- if (cycles_to_next_event > 0)
- return;
-
- cycles_to_next_event += pissoff;
- pissoff=0;
-
- if (is_lastline
- && /*cycles_to_next_event <= cycles_to_hsync_event*/
- eventtab[ev_hsync].evtime == nextevent)
- {
- frame_time_t now=read_processor_time();
- if (diff32(now, vsyncmintime)<0)
- {
- cycles_to_next_event += 3000 * CYCLE_UNIT;
- return;
- }
- }
- cycles_to_add=0;
- while (cycles_to_next_event <= cycles_to_add) {
- int i;
-
- cycles_to_add-=cycles_to_next_event;
- cycles_to_next_event=0;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active && eventtab[i].evtime == nextevent) {
- (*eventtab[i].handler) ();
- }
- }
- events_schedule();
- }
- cycles_to_next_event -= cycles_to_add;
-}
-
-#define do_cycles do_cycles_slow
-#define countdown cycles_to_next_event
-
-#endif
-
/* This is a special-case function. Normally, all events should lie in the
future; they should only ever be active at the current cycle during
do_cycles. However, a snapshot is saved during do_cycles, and so when
-restoring it, we may have other events pending. */ STATIC_INLINE void handle_active_events (void) {
+restoring it, we may have other events pending. */
+
+STATIC_INLINE void handle_active_events (void)
+{
int i;
for (i = 0; i < ev_max; i++) {
if (eventtab[i].active && eventtab[i].evtime == currcycle) {
STATIC_INLINE void events_schedule (void)
{
- int i;
+ int i;
- unsigned long int mintime = ~0L;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active) {
- unsigned long int eventtime = eventtab[i].evtime - currcycle;
- if (eventtime < mintime)
- mintime = eventtime;
+ unsigned long int mintime = ~0L;
+ for (i = 0; i < ev_max; i++) {
+ if (eventtab[i].active) {
+ unsigned long int eventtime = eventtab[i].evtime - currcycle;
+ if (eventtime < mintime)
+ mintime = eventtime;
+ }
}
- }
- nextevent = currcycle + mintime;
+ nextevent = currcycle + mintime;
}
STATIC_INLINE void do_cycles_slow (unsigned long cycles_to_add)
{
- if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= cycles_to_add
- && (long int)(read_processor_time () - vsyncmintime) < 0)
- return;
+ if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= cycles_to_add
+ && (long int)(read_processor_time () - vsyncmintime) < 0)
+ return;
- while ((nextevent - currcycle) <= cycles_to_add) {
- int i;
- cycles_to_add -= (nextevent - currcycle);
- currcycle = nextevent;
+ while ((nextevent - currcycle) <= cycles_to_add) {
+ int i;
+ cycles_to_add -= (nextevent - currcycle);
+ currcycle = nextevent;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active && eventtab[i].evtime == currcycle) {
- (*eventtab[i].handler)();
- }
+ for (i = 0; i < ev_max; i++) {
+ if (eventtab[i].active && eventtab[i].evtime == currcycle) {
+ (*eventtab[i].handler)();
+ }
+ }
+ events_schedule();
}
- events_schedule();
- }
- currcycle += cycles_to_add;
+ currcycle += cycles_to_add;
}
STATIC_INLINE void do_cycles_fast (void)
{
- if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= 1
- && (long int)(read_processor_time () - vsyncmintime) < 0)
- return;
+ if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= 1
+ && (long int)(read_processor_time () - vsyncmintime) < 0)
+ return;
- currcycle++;
- if (nextevent == currcycle) {
- int i;
+ currcycle++;
+ if (nextevent == currcycle) {
+ int i;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active && eventtab[i].evtime == currcycle) {
- (*eventtab[i].handler) ();
- }
+ for (i = 0; i < ev_max; i++) {
+ if (eventtab[i].active && eventtab[i].evtime == currcycle) {
+ (*eventtab[i].handler) ();
+ }
+ }
+ events_schedule();
}
- events_schedule();
- }
}
/* This is a special-case function. Normally, all events should lie in the
- future; they should only ever be active at the current cycle during
- do_cycles. However, a snapshot is saved during do_cycles, and so when
- restoring it, we may have other events pending. */
+future; they should only ever be active at the current cycle during
+do_cycles. However, a snapshot is saved during do_cycles, and so when
+restoring it, we may have other events pending. */
STATIC_INLINE void handle_active_events (void)
{
- int i;
- for (i = 0; i < ev_max; i++) {
- if (eventtab[i].active && eventtab[i].evtime == currcycle) {
- (*eventtab[i].handler)();
+ int i;
+ for (i = 0; i < ev_max; i++) {
+ if (eventtab[i].active && eventtab[i].evtime == currcycle) {
+ (*eventtab[i].handler)();
+ }
}
- }
}
STATIC_INLINE unsigned long get_cycles (void)
{
- return currcycle;
+ return currcycle;
}
extern void init_eventtab (void);
uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth);
uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth);
+extern void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height);
#endif
extern void m68k_reset (int);
extern int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor);
-extern void m68k_do_rte (uae_u32 pc, uae_u16 opcode, uae_u16 sr, uae_u16 format);
+extern void m68k_do_rte (void);
extern void mmu_op (uae_u32, uae_u32);
extern void mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr);
*/
#define UAEMAJOR 2
-#define UAEMINOR 0
-#define UAESUBREV 2
+#define UAEMINOR 1
+#define UAESUBREV 0
typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
int dongle;
};
+extern int config_changed;
+extern void config_check_vsync (void);
+
/* Contains the filename of .uaerc */
extern TCHAR optionsfile[];
extern void save_options (struct zfile *, struct uae_prefs *, int);
changed_prefs.chipset_refreshrate = 10;
if (changed_prefs.chipset_refreshrate > 900)
changed_prefs.chipset_refreshrate = 900;
+ config_changed = 1;
}
break;
case AKS_DISKSWAPPER_NEXT:
case AKS_DISKSWAPPER_INSERT2:
case AKS_DISKSWAPPER_INSERT3:
_tcscpy (changed_prefs.df[code - AKS_DISKSWAPPER_INSERT0], currprefs.dfxlist[swapperslot]);
+ config_changed = 1;
break;
break;
scanevents (prefs);
+ config_changed = 1;
+
#if 0
#ifdef CD32
if (currprefs.input_selected_setting == 0 && currprefs.cs_cd32cd)
inputdevice_copyconfig (&changed_prefs, &currprefs);
if (acc)
inputdevice_acquire (TRUE);
+ config_changed = 1;
}
static void set_kbr_default (struct uae_prefs *p, int index, int num)
#ifdef RETROPLATFORM
rp_turbo (currprefs.turbo_emulation);
#endif
+ changed_prefs.turbo_emulation = currprefs.turbo_emulation;
+ config_changed = 1;
}
void pausemode (int mode)
pause_emulation = pause_emulation ? 0 : 9;
else
pause_emulation = mode;
+ config_changed = 1;
}
int jsem_isjoy (int port, const struct uae_prefs *p)
int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, int mode, int type)
{
+ config_changed = 1;
switch (type)
{
case 1:
long int version = 256 * 65536L * UAEMAJOR + 65536L * UAEMINOR + UAESUBREV;
struct uae_prefs currprefs, changed_prefs;
+int config_changed;
int no_gui = 0, quit_to_gui = 0;
int cloanto_rom = 0;
}
fixup_prefs_dimensions (p);
+#if !defined (JIT)
+ p->cachesize = 0;
+#endif
#ifdef CPU_68000_ONLY
p->cpu_model = 68000;
p->fpu_model = 0;
do_leave_program ();
}
-#ifdef _WIN64
+#ifndef JIT
extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except)
{
return EXCEPTION_CONTINUE_SEARCH;
#ifdef USE_SDL
SDL_Init (SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);
#endif
-
+ config_changed = 1;
if (restart_config[0]) {
default_prefs (&currprefs, 0);
fixup_prefs (&currprefs);
if (! no_gui) {
int err = gui_init ();
currprefs = changed_prefs;
+ config_changed = 1;
if (err == -1) {
write_log (L"Failed to initialize the GUI\n");
return -1;
extern uae_u8* compiled_code;
#include "jit/compemu.h"
#include <signal.h>
-/* For faster cycles handling */
-signed long pissoff = 0;
#else
/* Need to have these somewhere */
static void build_comp (void) {}
void check_prefs_changed_comp (void) {}
#endif
+/* For faster JIT cycles handling */
+signed long pissoff = 0;
/* Opcode of faulting instruction */
static uae_u16 last_op_for_exception_3;
if (cpucycleunit < 1)
cpucycleunit = 1;
write_log (L"CPU cycleunit: %d (%.3f)\n", cpucycleunit, (float)cpucycleunit / CYCLE_UNIT);
+ config_changed = 1;
}
static void prefs_changed_cpu (void)
{
int changed = 0;
+ if (!config_changed)
+ return;
#ifdef JIT
changed = check_prefs_changed_comp ();
#endif
if (dp & 0x80) base = 0;
if (dp & 0x40) regd = 0;
- if ((dp & 0x30) == 0x20) base += (uae_s32)(uae_s16) next_iword_mmu ();
- if ((dp & 0x30) == 0x30) base += next_ilong_mmu ();
+ if ((dp & 0x30) == 0x20)
+ base += (uae_s32)(uae_s16) next_iword_mmu ();
+ if ((dp & 0x30) == 0x30)
+ base += next_ilong_mmu ();
- if ((dp & 0x3) == 0x2) outer = (uae_s32)(uae_s16) next_iword_mmu ();
- if ((dp & 0x3) == 0x3) outer = next_ilong_mmu ();
+ if ((dp & 0x3) == 0x2)
+ outer = (uae_s32)(uae_s16) next_iword_mmu ();
+ if ((dp & 0x3) == 0x3)
+ outer = next_ilong_mmu ();
- if ((dp & 0x4) == 0) base += regd;
- if (dp & 0x3) base = get_long_mmu (base);
- if (dp & 0x4) base += regd;
+ if ((dp & 0x4) == 0)
+ base += regd;
+ if (dp & 0x3)
+ base = get_long_mmu (base);
+ if (dp & 0x4)
+ base += regd;
return base + outer;
} else {
typedef void compiled_handler (void);
-static void m68k_run_2a (void)
+static void m68k_run_jit (void)
{
for (;;) {
((compiled_handler*)(pushall_call_handler))();
regs.spcflags |= of & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
}
#endif
-#ifndef JIT
- run_func = currprefs.cpu_model == 68000 && currprefs.cpu_cycle_exact ? m68k_run_1_ce :
- currprefs.cpu_model == 68000 && currprefs.cpu_compatible ? m68k_run_1 :
- currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
-#else
if (mmu_enabled && !currprefs.cachesize) {
run_func = m68k_run_mmu;
} else {
run_func = currprefs.cpu_cycle_exact && currprefs.cpu_model == 68000 ? m68k_run_1_ce :
currprefs.cpu_compatible > 0 && currprefs.cpu_model == 68000 ? m68k_run_1 :
- currprefs.cpu_model >= 68020 && currprefs.cachesize ? m68k_run_2a :
+#ifdef JIT
+ currprefs.cpu_model >= 68020 && currprefs.cachesize ? m68k_run_jit :
+#endif
(currprefs.cpu_model == 68040 || currprefs.cpu_model == 68060) && currprefs.mmu_model ? m68k_run_mmu040 :
currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
}
-#endif
run_func ();
}
in_m68k_go--;
f_out (f, L" A%d %08lX ", i, m68k_areg (regs, i));
if ((i & 3) == 3) f_out (f, L"\n");
}
- if (regs.s == 0) regs.usp = m68k_areg (regs, 7);
- if (regs.s && regs.m) regs.msp = m68k_areg (regs, 7);
- if (regs.s && regs.m == 0) regs.isp = m68k_areg (regs, 7);
+ if (regs.s == 0)
+ regs.usp = m68k_areg (regs, 7);
+ if (regs.s && regs.m)
+ regs.msp = m68k_areg (regs, 7);
+ if (regs.s && regs.m == 0)
+ regs.isp = m68k_areg (regs, 7);
j = 2;
f_out (f, L"USP %08X ISP %08X ", regs.usp, regs.isp);
for (i = 0; m2cregs[i].regno>= 0; i++) {
do_cycles_ce (clocks * cpucycleunit);
}
-void m68k_do_rte (uae_u32 pc, uae_u16 sr, uae_u16 format, uae_u16 opcode)
+void m68k_do_rte_mmu (void)
{
- int f;
-
- f = format >> 12;
- if (f == 0) {
- ;
- } else if (f == 0x1) {
- ;
- } else if (f == 0x2) {
- m68k_areg (regs, 7) += 4;
- } else if (f == 0x4) {
- m68k_areg (regs, 7) += 8;
- } else if (f == 0x8) {
- m68k_areg (regs, 7) += 50;
- } else if (f == 0x7) {
- uae_u16 ssr = get_word_mmu (m68k_areg (regs, 7) + 4);
- if (ssr & MMU_SSW_CT) {
- uaecptr src_a7 = m68k_areg (regs, 7) - 8;
- uaecptr dst_a7 = m68k_areg (regs, 7) + 52;
- put_word_mmu (dst_a7 + 0, get_word_mmu (src_a7 + 0));
- put_long_mmu (dst_a7 + 2, get_long_mmu (src_a7 + 2));
- // skip this word
- put_long_mmu (dst_a7 + 8, get_long_mmu (src_a7 + 8));
- }
- m68k_areg (regs, 7) += 52;
- } else if (f == 0x9) {
- m68k_areg (regs, 7) += 12;
- } else if (f == 0xa) {
- m68k_areg (regs, 7) += 24;
- } else if (f == 0xb) {
- m68k_areg (regs, 7) += 84;
- } else {
- Exception (14, 0);
- return;
+ uae_u16 ssr = get_word_mmu (m68k_areg (regs, 7) + 4);
+ if (ssr & MMU_SSW_CT) {
+ uaecptr src_a7 = m68k_areg (regs, 7) - 8;
+ uaecptr dst_a7 = m68k_areg (regs, 7) + 52;
+ put_word_mmu (dst_a7 + 0, get_word_mmu (src_a7 + 0));
+ put_long_mmu (dst_a7 + 2, get_long_mmu (src_a7 + 2));
+ // skip this word
+ put_long_mmu (dst_a7 + 8, get_long_mmu (src_a7 + 8));
}
- regs.sr = sr;
- MakeFromSR ();
- if (pc & 1)
- exception3 (0x4E73, m68k_getpc (), pc);
- else
- m68k_setpc (pc);
}
void flush_mmu (uaecptr addr, int n)
{
}
-void m68k_do_rte_mmu (void)
-{
- uaecptr src = m68k_areg (regs, 7);
- uae_s16 sr = get_word_mmu (src);
- uae_s32 pc = get_long_mmu (src + 2);
- uae_s16 format = get_word_mmu (src + 6);
- m68k_areg (regs, 7) += 8;
- m68k_do_rte (pc, sr, format, 0x4e73);
-}
-
void m68k_do_rts_mmu (void)
{
m68k_setpc (get_long_mmu (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
+
void m68k_do_bsr_mmu (uaecptr oldpc, uae_s32 offset)
{
put_long_mmu (m68k_areg (regs, 7) - 4, oldpc);
m68k_incpci (offset);
}
-
void put_long_slow (uaecptr addr, uae_u32 v)
{
if (currprefs.mmu_model)
case 13: /* HACK */
{ //for higher P96 mouse draw rate
- extern int p96hack_vpos2, hack_vpos ,p96refresh_active;
- extern uae_u16 vtotal;
- extern unsigned int new_beamcon0;
- p96hack_vpos2 = 0;
- if (m68k_dreg (regs, 1) > 0)
- p96hack_vpos2 = 15625 / m68k_dreg (regs, 1);
- if (!currprefs.cs_ciaatod)
- changed_prefs.cs_ciaatod = currprefs.cs_ciaatod = currprefs.ntscmode ? 2 : 1;
- p96refresh_active=1;
- picasso_refresh ();
+ set_picasso_hack_rate (m68k_dreg (regs, 1));
} //end for higher P96 mouse draw rate
return 0;
f = ((double)(freq >> 16)) + ((double)(freq & 0xffff)) / 65536.0;
if (f < 1)
return;
- cycles = maxhpos * maxvpos * vblank_hz;
+ cycles = maxhpos * maxvpos_nom * vblank_hz;
t = (evt)(cycles / f);
if (dsahip->evttime == t)
return;
-#undef CINTERFACE
#include <windows.h>
#include "sysconfig.h"
#if defined (D3D) && defined (GFXFILTER)
+
#include "options.h"
#include "xwin.h"
#include "custom.h"
#include "direct3d.h"
static TCHAR *D3DHEAD = L"-";
-static int tex_pow2, tex_square, tex_dynamic;
static int psEnabled, psActive, psPreProcess;
static D3DFORMAT tformat;
static IDirect3DDevice9Ex *d3ddevex;
static D3DSURFACE_DESC dsdbb;
static LPDIRECT3DTEXTURE9 texture, sltexture, ledtexture, masktexture;
-static LPDIRECT3DTEXTURE9 lpWorkTexture1, lpWorkTexture2;
+static int masktexture_w, masktexture_h;
+static LPDIRECT3DTEXTURE9 lpWorkTexture1, lpWorkTexture2, lpTempTexture;
+LPDIRECT3DTEXTURE9 cursorsurfaced3d;
static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture;
static IDirect3DVertexBuffer9 *vertexBuffer;
static ID3DXSprite *sprite;
static HWND d3dhwnd;
static int devicelost;
+static int locked;
+static int cursor_offset_x, cursor_offset_y;
static D3DXMATRIX m_matProj, m_matProj2;
static D3DXMATRIX m_matWorld, m_matWorld2;
static D3DXMATRIX m_matPreProj;
static D3DXMATRIX m_matPreView;
static D3DXMATRIX m_matPreWorld;
+static D3DXMATRIX postproj;
+static D3DXVECTOR4 maskmult;
static int ledwidth, ledheight;
static int twidth, theight, max_texture_w, max_texture_h;
static int t_depth, mult;
static int required_sl_texture_w, required_sl_texture_h;
static int vsync2, guimode;
-static int needclear;
static int resetcount;
+static int cursor_x, cursor_y, cursor_v;
#define D3DFVF_TLVERTEX D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1
struct TLVERTEX {
TCHAR *s = NULL;
if (Errors)
- s = (TCHAR*)Errors->GetBufferPointer ();
+ s = au ((char*)Errors->GetBufferPointer ());
_tcscpy (buffer, D3D_ErrorString (hr));
if (s) {
_tcscat (buffer, L" ");
_tcscat (buffer, s);
}
+ xfree (s);
return buffer;
}
+static LPD3DXEFFECT postEffect;
+static D3DXHANDLE postSourceTextureHandle;
+static D3DXHANDLE postMaskTextureHandle;
+static D3DXHANDLE postTechnique, postTechniquePlain, postTechniqueAlpha;
+static D3DXHANDLE postMatrixSource;
+static D3DXHANDLE postMaskMult;
+static D3DXHANDLE postFilterMode;
+
static LPD3DXEFFECT pEffect;
static D3DXEFFECT_DESC EffectDesc;
static float m_scale;
static D3DXHANDLE m_PreprocessTechnique1EffectHandle;
static D3DXHANDLE m_PreprocessTechnique2EffectHandle;
static D3DXHANDLE m_CombineTechniqueEffectHandle;
-enum psEffect_Pass { psEffect_PreProcess1, psEffect_PreProcess2, psEffect_Combine };
+enum psEffect_Pass { psEffect_None, psEffect_PreProcess1, psEffect_PreProcess2, psEffect_Combine };
+
+static int postEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect)
+{
+ postSourceTextureHandle = effect->GetParameterByName (NULL, "SourceTexture");
+ postMaskTextureHandle = effect->GetParameterByName (NULL, "OverlayTexture");
+ postTechnique = effect->GetTechniqueByName ("PostTechnique");
+ postTechniquePlain = effect->GetTechniqueByName ("PostTechniquePlain");
+ postTechniqueAlpha = effect->GetTechniqueByName ("PostTechniqueAlpha");
+ postMatrixSource = effect->GetParameterByName (NULL, "mtx");
+ postMaskMult = effect->GetParameterByName (NULL, "maskmult");
+ postFilterMode = effect->GetParameterByName (NULL, "filtermode");
+ return true;
+}
-static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler)
+static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect)
{
HRESULT hr = S_OK;
// Look at parameters for semantics and annotations that we know how to interpret
LPDIRECT3DBASETEXTURE9 pTex = NULL;
UINT iParam, iAnnot;
- if(pEffect == NULL)
+ if(effect == NULL)
return 0;
for(iParam = 0; iParam < EffectDesc.Parameters; iParam++) {
INT Height= D3DX_DEFAULT;
INT Depth = D3DX_DEFAULT;
- hParam = pEffect->GetParameter (NULL, iParam);
- pEffect->GetParameterDesc (hParam, &ParamDesc);
+ hParam = effect->GetParameter (NULL, iParam);
+ effect->GetParameterDesc (hParam, &ParamDesc);
if(ParamDesc.Semantic != NULL) {
if(ParamDesc.Class == D3DXPC_MATRIX_ROWS || ParamDesc.Class == D3DXPC_MATRIX_COLUMNS) {
m_TexelSizeEffectHandle = hParam;
} else if(ParamDesc.Class == D3DXPC_SCALAR && ParamDesc.Type == D3DXPT_FLOAT) {
if(strcmpi(ParamDesc.Semantic, "SCALING") == 0)
- pEffect->GetFloat(hParam, &m_scale);
+ effect->GetFloat(hParam, &m_scale);
} else if(ParamDesc.Class == D3DXPC_OBJECT && ParamDesc.Type == D3DXPT_TEXTURE) {
if(strcmpi(ParamDesc.Semantic, "SOURCETEXTURE") == 0)
m_SourceTextureEffectHandle = hParam;
LPCSTR pstrTechnique = NULL;
if(strcmpi(ParamDesc.Semantic, "COMBINETECHNIQUE") == 0) {
- pEffect->GetString(hParam, &pstrTechnique);
- m_CombineTechniqueEffectHandle = pEffect->GetTechniqueByName(pstrTechnique);
+ effect->GetString(hParam, &pstrTechnique);
+ m_CombineTechniqueEffectHandle = effect->GetTechniqueByName(pstrTechnique);
}
else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE") == 0) {
- pEffect->GetString(hParam, &pstrTechnique);
- m_PreprocessTechnique1EffectHandle = pEffect->GetTechniqueByName(pstrTechnique);
+ effect->GetString(hParam, &pstrTechnique);
+ m_PreprocessTechnique1EffectHandle = effect->GetTechniqueByName(pstrTechnique);
}
else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE1") == 0) {
- pEffect->GetString(hParam, &pstrTechnique);
- m_PreprocessTechnique2EffectHandle = pEffect->GetTechniqueByName(pstrTechnique);
+ effect->GetString(hParam, &pstrTechnique);
+ m_PreprocessTechnique2EffectHandle = effect->GetTechniqueByName(pstrTechnique);
}
else if(strcmpi(ParamDesc.Semantic, "NAME") == 0)
- pEffect->GetString(hParam, &m_strName);
+ effect->GetString(hParam, &m_strName);
}
}
for(iAnnot = 0; iAnnot < ParamDesc.Annotations; iAnnot++) {
- hAnnot = pEffect->GetAnnotation (hParam, iAnnot);
- pEffect->GetParameterDesc(hAnnot, &AnnotDesc);
+ hAnnot = effect->GetAnnotation (hParam, iAnnot);
+ effect->GetParameterDesc(hAnnot, &AnnotDesc);
if(strcmpi(AnnotDesc.Name, "name") == 0)
- pEffect->GetString(hAnnot, &pstrName);
+ effect->GetString(hAnnot, &pstrName);
else if(strcmpi(AnnotDesc.Name, "function") == 0)
- pEffect->GetString(hAnnot, &pstrFunction);
+ effect->GetString(hAnnot, &pstrFunction);
else if(strcmpi(AnnotDesc.Name, "target") == 0)
- pEffect->GetString(hAnnot, &pstrTarget);
+ effect->GetString(hAnnot, &pstrTarget);
else if(strcmpi(AnnotDesc.Name, "width") == 0)
- pEffect->GetInt(hAnnot, &Width);
+ effect->GetInt(hAnnot, &Width);
else if(strcmpi(AnnotDesc.Name, "height") == 0)
- pEffect->GetInt(hAnnot, &Height);
+ effect->GetInt(hAnnot, &Height);
else if(strcmpi(AnnotDesc.Name, "depth") == 0)
- pEffect->GetInt(hAnnot, &Depth);
+ effect->GetInt(hAnnot, &Depth);
else if(strcmpi(AnnotDesc.Name, "type") == 0)
- pEffect->GetString(hAnnot, &pstrTextureType);
+ effect->GetString(hAnnot, &pstrTextureType);
}
if(pstrFunction != NULL) {
}
}
}
- pEffect->SetTexture(pEffect->GetParameter(NULL, iParam), pTex);
+ effect->SetTexture(effect->GetParameter(NULL, iParam), pTex);
if (pTex)
pTex->Release ();
if (pTextureShader)
d3d_good = -1;
d3dx = Direct3DCreate9 (D3D_SDK_VERSION);
if (d3dx != NULL) {
- if (SUCCEEDED (IDirect3D9_GetDeviceCaps (d3dx, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))) {
- if(d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2,0))
- d3d_good = 1;
+ if (SUCCEEDED (d3dx->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))) {
+ if (d3dCaps.PixelShaderVersion >= D3DPS_VERSION(1, 0) && d3dCaps.VertexShaderVersion >= D3DVS_VERSION(1, 0)) {
+ if ((d3dCaps.TextureCaps & (D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_NONPOW2CONDITIONAL)) != D3DPTEXTURECAPS_POW2) {
+ if (!(d3dCaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) && (d3dCaps.Caps2 & D3DCAPS2_DYNAMICTEXTURES)) {
+ d3d_good = 1;
+ }
+ }
+ }
}
- IDirect3D9_Release (d3dx);
+ d3dx->Release ();
}
return d3d_good > 0 ? 1 : 0;
}
FreeLibrary (h);
d3dx = Direct3DCreate9 (D3D_SDK_VERSION);
if (d3dx != NULL) {
- if (SUCCEEDED (IDirect3D9_GetDeviceCaps (d3dx, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))) {
- if(d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2,0)) {
+ if (SUCCEEDED (d3dx->GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))) {
+ if (d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2,0)) {
write_log (L"Direct3D: Pixel shader 2.0+ support detected, shader filters enabled.\n");
d3d_yesno = 1;
}
}
- IDirect3D9_Release (d3dx);
+ d3dx->Release ();
}
}
return d3d_yesno > 0 ? 1 : 0;
}
-static int psEffect_LoadEffect (const TCHAR *shaderfile)
+static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full)
{
int ret = 0;
LPD3DXEFFECTCOMPILER EffectCompiler = NULL;
LPD3DXBUFFER BufferEffect = NULL;
HRESULT hr;
TCHAR tmp[MAX_DPATH];
+ LPD3DXEFFECT effect = NULL;
static int first;
+ DWORD compileflags = psEnabled ? 0 : D3DXSHADER_USE_LEGACY_D3DX9_31_DLL;
- if (!D3D_canshaders ()) {
- if (!first)
- gui_message (L"Installed DirectX is too old\nD3D shaders disabled.");
- first = 1;
- return 0;
- }
- _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\%s", start_path_exe, WIN32_PLUGINDIR, shaderfile);
- hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, 0, &EffectCompiler, &Errors);
+ _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\%s", start_path_data, WIN32_PLUGINDIR, shaderfile);
+ hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, compileflags, &EffectCompiler, &Errors);
if (FAILED (hr)) {
- write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
- goto end;
+ if (hr == 0x88760B59)
+ hr = D3DXCreateEffectCompilerFromFile (shaderfile, NULL, NULL, compileflags, &EffectCompiler, &Errors);
+ if (FAILED (hr)) {
+ write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
+ goto end;
+ }
}
hr = EffectCompiler->CompileEffect (0, &BufferEffect, &Errors);
if (FAILED (hr)) {
BufferEffect->GetBufferSize (),
NULL, NULL,
0,
- NULL, &pEffect, &Errors);
+ NULL, &effect, &Errors);
if (FAILED (hr)) {
write_log (L"%s: D3DXCreateEffect failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
goto end;
}
- pEffect->GetDesc (&EffectDesc);
- if (!psEffect_ParseParameters (EffectCompiler))
- goto end;
+ effect->GetDesc (&EffectDesc);
+ if (full) {
+ if (!psEffect_ParseParameters (EffectCompiler, effect))
+ goto end;
+ } else {
+ if (!postEffect_ParseParameters (EffectCompiler, effect))
+ goto end;
+ }
ret = 1;
end:
if (Errors)
if (EffectCompiler)
EffectCompiler->Release ();
- psActive = FALSE;
- psPreProcess = FALSE;
- if (ret) {
- psActive = TRUE;
- if (psEffect_hasPreProcess ())
- psPreProcess = TRUE;
- write_log (L"%s: pixelshader filter '%s' enabled, preproc=%d\n", D3DHEAD, tmp, psPreProcess);
- } else {
- write_log (L"%s: pixelshader filter '%s' failed to initialize\n", D3DHEAD, tmp);
+ if (full) {
+ psActive = FALSE;
+ psPreProcess = FALSE;
+ if (ret) {
+ psActive = TRUE;
+ if (psEffect_hasPreProcess ())
+ psPreProcess = TRUE;
+ }
}
- return ret;
+ if (ret)
+ write_log (L"%s: pixelshader filter '%s' loaded\n", D3DHEAD, tmp);
+ else
+ write_log (L"%s: pixelshader filter '%s' failed to initialize\n", D3DHEAD, tmp);
+ return effect;
}
static int psEffect_SetMatrices (D3DXMATRIX *matProj, D3DXMATRIX *matView, D3DXMATRIX *matWorld)
}
return 1;
}
+
static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, LPDIRECT3DTEXTURE9 lpWorking1,
LPDIRECT3DTEXTURE9 lpWorking2, LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture)
{
write_log (L"%s: Texture with SOURCETEXTURE semantic not found\n", D3DHEAD);
return 0;
}
- hr = pEffect->SetTexture (m_SourceTextureEffectHandle, (LPDIRECT3DBASETEXTURE9)lpSource);
+ hr = pEffect->SetTexture (m_SourceTextureEffectHandle, lpSource);
if (FAILED (hr)) {
write_log (L"%s: SetTextures:lpSource %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
- if(m_WorkingTexture1EffectHandle) {
- hr = pEffect->SetTexture (m_WorkingTexture1EffectHandle, (LPDIRECT3DBASETEXTURE9)lpWorking1);
+ if (m_WorkingTexture1EffectHandle) {
+ hr = pEffect->SetTexture (m_WorkingTexture1EffectHandle, lpWorking1);
if (FAILED (hr)) {
write_log (L"%s: SetTextures:lpWorking1 %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
}
- if(m_WorkingTexture2EffectHandle) {
- hr = pEffect->SetTexture (m_WorkingTexture2EffectHandle, (LPDIRECT3DBASETEXTURE9)lpWorking2);
+ if (m_WorkingTexture2EffectHandle) {
+ hr = pEffect->SetTexture (m_WorkingTexture2EffectHandle, lpWorking2);
if (FAILED (hr)) {
write_log (L"%s: SetTextures:lpWorking2 %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
}
- if(m_Hq2xLookupTextureHandle) {
- hr = pEffect->SetTexture (m_Hq2xLookupTextureHandle, (LPDIRECT3DBASETEXTURE9)lpHq2xLookupTexture);
+ if (m_Hq2xLookupTextureHandle) {
+ hr = pEffect->SetTexture (m_Hq2xLookupTextureHandle, lpHq2xLookupTexture);
if (FAILED (hr)) {
write_log (L"%s: SetTextures:lpHq2xLookupTexture %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
return 1;
}
-static int psEffect_Begin (enum psEffect_Pass pass, UINT *pPasses)
+
+static int psEffect_Begin (LPD3DXEFFECT effect, enum psEffect_Pass pass, UINT *pPasses)
{
HRESULT hr;
- switch (pass) {
+ switch (pass)
+ {
case psEffect_PreProcess1:
- hr = pEffect->SetTechnique (m_PreprocessTechnique1EffectHandle);
+ hr = effect->SetTechnique (m_PreprocessTechnique1EffectHandle);
break;
case psEffect_PreProcess2:
- hr = pEffect->SetTechnique (m_PreprocessTechnique2EffectHandle);
+ hr = effect->SetTechnique (m_PreprocessTechnique2EffectHandle);
break;
case psEffect_Combine:
- hr = pEffect->SetTechnique (m_CombineTechniqueEffectHandle);
+ hr = effect->SetTechnique (m_CombineTechniqueEffectHandle);
+ break;
+ default:
+ hr = S_OK;
break;
}
- if(FAILED(hr)) {
+ if (FAILED (hr)) {
write_log (L"%s: SetTechnique: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
- hr = pEffect->Begin (pPasses, D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESHADERSTATE);
- if(FAILED(hr)) {
+ hr = effect->Begin (pPasses, 0);
+ if (FAILED (hr)) {
write_log (L"%s: Begin: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
return 1;
}
-static int psEffect_BeginPass (UINT Pass)
+
+static int psEffect_BeginPass (LPD3DXEFFECT effect, UINT Pass)
{
HRESULT hr;
- hr = pEffect->BeginPass (Pass);
+ hr = effect->BeginPass (Pass);
if (FAILED (hr)) {
write_log (L"%s: BeginPass: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
return 1;
}
-static int psEffect_EndPass (void)
+static int psEffect_EndPass (LPD3DXEFFECT effect)
{
HRESULT hr;
- hr = pEffect->EndPass ();
+ hr = effect->EndPass ();
if (FAILED (hr)) {
write_log (L"%s: EndPass: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
return 1;
}
-static int psEffect_End (void)
+static int psEffect_End (LPD3DXEFFECT effect)
{
HRESULT hr;
- hr = pEffect->End ();
+ hr = effect->End ();
if (FAILED (hr)) {
write_log (L"%s: End: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
return 1;
}
-static LPDIRECT3DTEXTURE9 createtext (int *ww, int *hh, D3DFORMAT format)
+static LPDIRECT3DTEXTURE9 createtext (int w, int h, D3DFORMAT format)
{
LPDIRECT3DTEXTURE9 t;
D3DLOCKED_RECT locked;
HRESULT hr;
- int w, h;
- w = *ww;
- h = *hh;
- if (tex_pow2) {
- if (w < 256)
- w = 256;
- else if (w < 512)
- w = 512;
- else if (w < 1024)
- w = 1024;
- else if (w < 2048)
- w = 2048;
- else if (w < 4096)
- w = 4096;
- else
- w = 8192;
- if (h < 256)
- h = 256;
- else if (h < 512)
- h = 512;
- else if (h < 1024)
- h = 1024;
- else if (h < 2048)
- h = 2048;
- else if (h < 4096)
- h = 4096;
- else
- h = 8192;
- }
- if (tex_square) {
- if (w > h)
- h = w;
- else
- w = h;
- }
-
- if (tex_dynamic) {
- hr = IDirect3DDevice9_CreateTexture (d3ddev, w, h, 1, D3DUSAGE_DYNAMIC, format,
- D3DPOOL_DEFAULT, &t, NULL);
- if (FAILED (hr))
- write_log (L"%s: CreateTexture() D3DUSAGE_DYNAMIC failed: %s (%d*%d %08x)\n",
- D3DHEAD,
- D3D_ErrorString (hr), w, h, format);
- }
- if (!tex_dynamic || (tex_dynamic && FAILED (hr))) {
- hr = IDirect3DDevice9_CreateTexture (d3ddev, w, h, 1, 0, format,
- D3DPOOL_DEFAULT, &t, NULL);
+ hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_DYNAMIC, format,
+ D3DPOOL_DEFAULT, &t, NULL);
+ if (FAILED (hr))
+ write_log (L"%s: CreateTexture() D3DUSAGE_DYNAMIC failed: %s (%d*%d %08x)\n",
+ D3DHEAD,
+ D3D_ErrorString (hr), w, h, format);
+ if (FAILED (hr)) {
+ hr = d3ddev->CreateTexture (w, h, 1, 0, format, D3DPOOL_DEFAULT, &t, NULL);
}
if (FAILED (hr)) {
write_log (L"%s: CreateTexture() failed: %s (%d*%d %08x)\n",
D3DHEAD, D3D_ErrorString (hr), w, h, format);
return 0;
}
- *ww = w;
- *hh = h;
- hr = IDirect3DTexture9_LockRect (t, 0, &locked, NULL, 0);
+ hr = t->LockRect (0, &locked, NULL, 0);
if (SUCCEEDED (hr)) {
int y;
int wb;
wb = w * 1;
for (y = 0; y < h; y++)
memset ((uae_u8*)locked.pBits + y * locked.Pitch, 0, wb);
- IDirect3DTexture9_UnlockRect (t, 0);
+ t->UnlockRect (0);
}
return t;
}
static int createtexture (int w, int h)
{
HRESULT hr;
- int ww = w;
- int hh = h;
- texture = createtext (&ww, &hh, tformat);
+ texture = createtext (w, h, tformat);
if (!texture)
return 0;
- twidth = ww;
- theight = hh;
- write_log (L"%s: %d*%d texture allocated, bits per pixel %d\n", D3DHEAD, ww, hh, t_depth);
+ twidth = w;
+ theight = h;
+ write_log (L"%s: %d*%d texture allocated, bits per pixel %d\n", D3DHEAD, w, h, t_depth);
+ if (FAILED (hr = d3ddev->CreateTexture (w, h, 1,
+ D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) {
+ write_log (L"%s: Failed to create working texture1: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ return 0;
+ }
if (psActive) {
D3DLOCKED_BOX lockedBox;
- if (FAILED (hr = d3ddev->CreateTexture (ww, hh, 1,
+ if (FAILED (hr = d3ddev->CreateTexture (w, h, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
- write_log (L"%s: Failed to create working texture1: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ write_log (L"%s: Failed to create temp texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
- if (FAILED (hr = d3ddev->CreateTexture (ww, hh, 1,
+ if (FAILED (hr = d3ddev->CreateTexture (w, h, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
write_log (L"%s: Failed to create working texture2: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
write_log (L"%s: Failed to lock box of volume texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
- //BuildHq2xLookupTexture(tin_w / mult, tin_w / mult, window_w, window_h, (unsigned char*)lockedBox.pBits);
- BuildHq2xLookupTexture(window_w, window_h, tin_w / mult, tin_w / mult, (unsigned char*)lockedBox.pBits);
+ BuildHq2xLookupTexture (w, h, w, h, (unsigned char*)lockedBox.pBits);
lpHq2xLookupTexture->UnlockBox (0);
}
}
done = 1;
}
- hr = IDirect3DTexture9_LockRect (ledtexture, 0, &locked, NULL, 0);
+ hr = ledtexture->LockRect (0, &locked, NULL, 0);
if (FAILED (hr)) {
write_log (L"%d: SL LockRect failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
return;
uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
draw_status_line_single (buf, 32 / 8, y, ledwidth, rc, gc, bc, a);
}
- IDirect3DTexture9_UnlockRect (ledtexture, 0);
+ ledtexture->UnlockRect (0);
}
static int createledtexture (void)
{
ledwidth = window_w;
ledheight = TD_TOTAL_HEIGHT;
- ledtexture = createtext (&ledwidth, &ledheight, D3DFMT_A8R8G8B8);
+ ledtexture = createtext (ledwidth, ledheight, D3DFMT_A8R8G8B8);
if (!ledtexture)
return 0;
return 1;
static int createsltexture (void)
{
- int ww = required_sl_texture_w;
- int hh = required_sl_texture_h;
-
- sltexture = createtext (&ww, &hh, t_depth < 32 ? D3DFMT_A4R4G4B4 : D3DFMT_A8R8G8B8);
+ if (masktexture)
+ return 0;
+ sltexture = createtext (required_sl_texture_w, required_sl_texture_h, t_depth < 32 ? D3DFMT_A4R4G4B4 : D3DFMT_A8R8G8B8);
if (!sltexture)
return 0;
- required_sl_texture_w = ww;
- required_sl_texture_h = hh;
- write_log (L"%s: SL %d*%d texture allocated\n", D3DHEAD, ww, hh);
+ write_log (L"%s: SL %d*%d texture allocated\n", D3DHEAD, required_sl_texture_w, required_sl_texture_h);
return 1;
}
static int createmasktexture (TCHAR *filename)
{
- int ww = tin_w;
- int hh = tin_h;
+ int ww = window_w;
+ int hh = window_h;
struct zfile *zf;
int size;
uae_u8 *buf;
- D3DSURFACE_DESC tmpdesc, maskdesc;
+ D3DSURFACE_DESC maskdesc;
LPDIRECT3DTEXTURE9 tx;
HRESULT hr;
D3DLOCKED_RECT lock, slock;
+ D3DXIMAGE_INFO dinfo;
TCHAR tmp[MAX_DPATH];
+ if (filename[0] == 0)
+ return 0;
tx = NULL;
_stprintf (tmp, L"%s%soverlays\\%s", start_path_exe, WIN32_PLUGINDIR, filename);
zf = zfile_fopen (tmp, L"rb", ZFD_NORMAL);
zfile_fread (buf, size, 1, zf);
zfile_fclose (zf);
hr = D3DXCreateTextureFromFileInMemoryEx (d3ddev, buf, size,
- D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, NULL, NULL,
- &tx);
+ D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, &dinfo, NULL, &tx);
xfree (buf);
if (FAILED (hr)) {
write_log (L"%s: temp mask texture load failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
goto end;
}
- hr = tx->GetLevelDesc (0, &tmpdesc);
- if (FAILED (hr)) {
- write_log (L"%s: temp mask texture GetLevelDesc() failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
- goto end;
- }
- masktexture = createtext (&ww, &hh, D3DFMT_X8R8G8B8);
+ masktexture_w = dinfo.Width;
+ masktexture_h = dinfo.Height;
+#if 0
+ masktexture = tx;
+#else
+ masktexture = createtext (ww, hh, D3DFMT_X8R8G8B8);
if (FAILED (hr)) {
write_log (L"%s: mask texture creation failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
goto end;
// v |= 0x80000000;
*ptr = v;
sx++;
- if (sx >= tmpdesc.Width)
+ if (sx >= dinfo.Width)
sx = 0;
}
sy++;
- if (sy >= tmpdesc.Height)
+ if (sy >= dinfo.Height)
sy = 0;
}
tx->UnlockRect (0);
masktexture->UnlockRect (0);
}
tx->Release ();
- write_log (L"%s: mask %d*%d ('%s') texture allocated\n", D3DHEAD, ww, hh, filename);
+ masktexture_w = maskdesc.Width;
+ masktexture_h = maskdesc.Height;
+#endif
+ write_log (L"%s: mask %d*%d ('%s') texture allocated\n", D3DHEAD, masktexture_w, masktexture_h, filename);
return 1;
end:
return 0;
}
-
-static void setupscenescaled (void)
-{
- HRESULT hr;
- int v;
-
- // Set up the texture
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- hr = IDirect3DDevice9_SetTextureStageState (d3ddev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
- switch (currprefs.gfx_filter_bilinear)
- {
- case 0:
- v = D3DTEXF_POINT;
- break;
- case 1:
- default:
- v = D3DTEXF_LINEAR;
- break;
- }
- hr = IDirect3DDevice9_SetSamplerState (d3ddev, 0, D3DSAMP_MINFILTER, v);
- hr = IDirect3DDevice9_SetSamplerState (d3ddev, 0, D3DSAMP_MAGFILTER, v);
- hr = IDirect3DDevice9_SetSamplerState (d3ddev, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
- hr = IDirect3DDevice9_SetRenderState (d3ddev, D3DRS_ALPHABLENDENABLE, FALSE);
-}
-
-static void setupscenecoordssl (void)
-{
- float w, h;
-
- w = window_w;
- h = window_h;
-
- MatrixOrthoOffCenterLH (&m_matProj, 0.0f, (float)w, 0.0f, (float)h, 0.0f, 1.0f);
- MatrixTranslation (&m_matView,
- (float)w / 2 - 0.5,
- (float)h / 2 + 0.5,
- 0.0f);
- MatrixScaling (&m_matWorld, w, h, 1.0f);
-}
-
static void setupscenecoords (void)
{
RECT sr, dr, zr;
float w, h;
float dw, dh;
- static RECT sro, dro, zro;
+ static RECT sr2, dr2, zr2;
//write_log (L"%dx%d %dx%d %dx%d\n", twidth, theight, tin_w, tin_h, window_w, window_h);
getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / mult, tin_h / mult, mult, tin_w, tin_h);
- //write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n",
- // dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
+
+ if (memcmp (&sr, &sr2, sizeof RECT) || memcmp (&dr, &dr2, sizeof RECT) || memcmp (&zr, &zr2, sizeof RECT)) {
+ write_log (L"POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d)\n",
+ dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom,
+ sr.right - sr.left, sr.bottom - sr.top,
+ zr.left, zr.top);
+ sr2 = sr;
+ dr2 = dr;
+ zr2 = zr;
+ }
+ cursor_offset_x = -zr.left;
+ cursor_offset_y = -zr.top;
dw = dr.right - dr.left;
dh = dr.bottom - dr.top;
+0.5f + dh * tin_h / window_h / 2 - zr.top - (tin_h - 2 * zr.top - h) + sr.top, // <- ???
0);
+ float sw = dw * tin_w / window_w + 0.5;
+ float sh = dh * tin_h / window_h + 0.5;
MatrixScaling (&m_matWorld,
- dw * tin_w / window_w,
- dh * tin_h / window_h,
+ sw,
+ sh,
1.0f);
- if (memcmp (&sr, &sro, sizeof (RECT)) || memcmp (&dr, &dro, sizeof (RECT)) || memcmp (&zr, &zro, sizeof (RECT))) {
- needclear = 1;
- sro = sr;
- dro = dr;
- zro = zr;
- }
+ // ratio between Amiga texture and overlay texture
+ maskmult.x = sw / w;
+ maskmult.y = sh / h;
+ maskmult.z = maskmult.w = 0;
+
+ D3DXMATRIX tmp;
+ D3DXMatrixMultiply (&tmp, &m_matWorld, &m_matView);
+ D3DXMatrixMultiply (&postproj, &tmp, &m_matProj);
+
}
uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth)
float sizex, sizey;
sizex = 1.0;
- if (twidth > tin_w)
- sizex = (float)tin_w / twidth;
sizey = 1.0;
- if (theight > tin_h)
- sizey = (float)tin_h / theight;
-
- hr = IDirect3DVertexBuffer9_Lock (vertexBuffer, 0, 0, (void**)&vertices, 0);
+ if (FAILED (hr = vertexBuffer->Lock (0, 0, (void**)&vertices, 0))) {
+ write_log (L"%s: Vertexbuffer lock failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ return;
+ }
//Setup vertices
vertices[0].position.x = -0.5f; vertices[0].position.y = -0.5f;
vertices[0].diffuse = 0xFFFFFFFF;
vertices[3].position.x = 0.5f; vertices[3].position.y = 0.5f;
vertices[3].diffuse = 0xFFFFFFFF;
vertices[3].texcoord.x = sizex; vertices[3].texcoord.y = 0.0f;
- // fullscreen vertices
- vertices[4].position.x = -0.5f; vertices[0].position.y = -0.5f;
- vertices[4].diffuse = 0xFFFFFFFF;
- vertices[4].texcoord.x = 0.0f; vertices[0].texcoord.y = 1.0f;
- vertices[5].position.x = -0.5f; vertices[1].position.y = 0.5f;
- vertices[5].diffuse = 0xFFFFFFFF;
- vertices[5].texcoord.x = 0.0f; vertices[1].texcoord.y = 0.0f;
- vertices[6].position.x = 0.5f; vertices[2].position.y = -0.5f;
- vertices[6].diffuse = 0xFFFFFFFF;
- vertices[6].texcoord.x = 1.0f; vertices[2].texcoord.y = 1.0f;
- vertices[7].position.x = 0.5f; vertices[3].position.y = 0.5f;
- vertices[7].diffuse = 0xFFFFFFFF;
- vertices[7].texcoord.x = 1.0f; vertices[3].texcoord.y = 0.0f;
// Additional vertices required for some PS effects
- if (psPreProcess) {
- vertices[8].position.x = 0.0f; vertices[4].position.y = 0.0f;
- vertices[8].diffuse = 0xFFFFFF00;
- vertices[8].texcoord.x = 0.0f; vertices[4].texcoord.y = 1.0f;
- vertices[9].position.x = 0.0f; vertices[5].position.y = 1.0f;
- vertices[9].diffuse = 0xFFFFFF00;
- vertices[9].texcoord.x = 0.0f; vertices[5].texcoord.y = 0.0f;
- vertices[10].position.x = 1.0f; vertices[6].position.y = 0.0f;
- vertices[10].diffuse = 0xFFFFFF00;
- vertices[10].texcoord.x = 1.0f; vertices[6].texcoord.y = 1.0f;
- vertices[11].position.x = 1.0f; vertices[7].position.y = 1.0f;
- vertices[11].diffuse = 0xFFFFFF00;
- vertices[11].texcoord.x = 1.0f; vertices[7].texcoord.y = 0.0f;
- }
- hr = IDirect3DVertexBuffer9_Unlock (vertexBuffer);
-}
-
-static void settransformsl (void)
-{
- HRESULT hr;
-
- // Disable Shaders
- hr = IDirect3DDevice9_SetVertexShader (d3ddev, 0);
- hr = IDirect3DDevice9_SetPixelShader (d3ddev, 0);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_PROJECTION, &m_matProj);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_VIEW, &m_matView);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_WORLD, &m_matWorld);
-}
-
-static void settransformfs (void)
-{
- HRESULT hr;
-
- // Disable Shaders
- hr = IDirect3DDevice9_SetVertexShader (d3ddev, 0);
- hr = IDirect3DDevice9_SetPixelShader (d3ddev, 0);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_PROJECTION, &m_matProj2);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_VIEW, &m_matView2);
- hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_WORLD, &m_matWorld2);
+ vertices[4].position.x = 0.0f; vertices[4].position.y = 0.0f;
+ vertices[4].diffuse = 0xFFFFFF00;
+ vertices[4].texcoord.x = 0.0f; vertices[4].texcoord.y = 1.0f;
+ vertices[5].position.x = 0.0f; vertices[5].position.y = 1.0f;
+ vertices[5].diffuse = 0xFFFFFF00;
+ vertices[5].texcoord.x = 0.0f; vertices[5].texcoord.y = 0.0f;
+ vertices[6].position.x = 1.0f; vertices[6].position.y = 0.0f;
+ vertices[6].diffuse = 0xFFFFFF00;
+ vertices[6].texcoord.x = 1.0f; vertices[6].texcoord.y = 1.0f;
+ vertices[7].position.x = 1.0f; vertices[7].position.y = 1.0f;
+ vertices[7].diffuse = 0xFFFFFF00;
+ vertices[7].texcoord.x = 1.0f; vertices[7].texcoord.y = 0.0f;
+ hr = vertexBuffer->Unlock ();
}
static void settransform (void)
{
- if (!psActive) {
- settransformsl ();
- } else {
- if (psPreProcess) {
- // Projection is (0,0,0) -> (1,1,1)
- MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
- // Align texels with pixels
- MatrixTranslation (&m_matPreView, -0.5f / twidth, 0.5f / theight, 0.0f);
- // Identity for world
- D3DXMatrixIdentity (&m_matPreWorld);
- } else {
- psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld);
- }
- }
+ // Projection is (0,0,0) -> (1,1,1)
+ MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
+ // Align texels with pixels
+ MatrixTranslation (&m_matPreView, -0.5f / twidth, 0.5f / theight, 0.0f);
+ // Identity for world
+ D3DXMatrixIdentity (&m_matPreWorld);
+ psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld);
}
static void createscanlines (int force)
if (l1 + l2 <= 0)
return;
- hr = IDirect3DTexture9_LockRect (sltexture, 0, &locked, NULL, 0);
+ hr = sltexture->LockRect (0, &locked, NULL, 0);
if (FAILED (hr)) {
write_log (L"%s: SL LockRect failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
return;
}
}
}
- IDirect3DTexture9_UnlockRect (sltexture, 0);
+ sltexture->UnlockRect (0);
}
masktexture->Release ();
masktexture = NULL;
}
+ if (lpTempTexture) {
+ lpTempTexture->Release ();
+ lpTempTexture = NULL;
+ }
if (lpWorkTexture1) {
lpWorkTexture1->Release ();
lpWorkTexture1 = NULL;
lpHq2xLookupTexture->Release ();
lpHq2xLookupTexture = NULL;
}
+ if (cursorsurfaced3d) {
+ cursorsurfaced3d->Release ();
+ cursorsurfaced3d = NULL;
+ }
if (pEffect) {
pEffect->Release ();
pEffect = NULL;
}
+ if (postEffect) {
+ postEffect->Release ();
+ postEffect = NULL;
+ }
if (d3ddev)
- IDirect3DDevice9_SetStreamSource (d3ddev, 0, NULL, 0, 0);
+ d3ddev->SetStreamSource (0, NULL, 0, 0);
if (vertexBuffer) {
- IDirect3DVertexBuffer9_Release (vertexBuffer);
+ vertexBuffer->Release ();
vertexBuffer = NULL;
}
m_MatWorldEffectHandle = NULL;
m_PreprocessTechnique1EffectHandle = NULL;
m_PreprocessTechnique2EffectHandle = NULL;
m_CombineTechniqueEffectHandle = NULL;
+ locked = 0;
}
static int restoredeviceobjects (void)
HRESULT hr;
invalidatedeviceobjects ();
+ postEffect = psEffect_LoadEffect (psEnabled ? L"winuae.fx" : L"winuae_old.fx", false);
+ if (!postEffect)
+ return 0;
if (currprefs.gfx_filtershader[0]) {
- if (!psEnabled || !psEffect_LoadEffect (currprefs.gfx_filtershader))
+ if (!(pEffect = psEffect_LoadEffect (currprefs.gfx_filtershader, true)))
currprefs.gfx_filtershader[0] = changed_prefs.gfx_filtershader[0] = 0;
}
if (!createtexture (tin_w, tin_h))
if (currprefs.gfx_filter_scanlines > 0)
createsltexture ();
createledtexture ();
- if (currprefs.gfx_filtermask[0])
- createmasktexture (currprefs.gfx_filtermask);
+ createmasktexture (currprefs.gfx_filtermask);
+
+ hr = D3DXCreateSprite (d3ddev, &sprite);
+ if (FAILED (hr)) {
+ write_log (L"%s: LED D3DXSprite failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ }
+
+ int curw = 64, curh = 64;
+ cursorsurfaced3d = createtext (curw, curh, D3DFMT_A8R8G8B8);
+ cursor_v = 0;
vbsize = sizeof (struct TLVERTEX) * 8;
- if (psPreProcess)
- vbsize = sizeof (struct TLVERTEX) * 12;
- hr = d3ddev->SetFVF (D3DFVF_TLVERTEX);
- if (FAILED (d3ddev->CreateVertexBuffer (vbsize, D3DUSAGE_WRITEONLY,
+ if (FAILED (hr = d3ddev->SetFVF (D3DFVF_TLVERTEX)))
+ write_log (L"%s: SetFVF failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ if (FAILED (hr = d3ddev->CreateVertexBuffer (vbsize, D3DUSAGE_WRITEONLY,
D3DFVF_TLVERTEX, D3DPOOL_DEFAULT, &vertexBuffer, NULL))) {
write_log (L"%s: failed to create vertex buffer: %s\n", D3DHEAD, D3D_ErrorString (hr));
return 0;
}
createvertex ();
- hr = d3ddev->SetStreamSource (0, vertexBuffer, 0, sizeof (struct TLVERTEX));
+ if (FAILED (hr = d3ddev->SetStreamSource (0, vertexBuffer, 0, sizeof (struct TLVERTEX))))
+ write_log (L"%s: SetStreamSource failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
- // turn off culling
hr = d3ddev->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE);
- // turn off lighting
hr = d3ddev->SetRenderState (D3DRS_LIGHTING, FALSE);
- // turn of zbuffer
hr = d3ddev->SetRenderState (D3DRS_ZENABLE, FALSE);
+ hr = d3ddev->SetRenderState (D3DRS_ALPHABLENDENABLE, FALSE);
- setupscenescaled ();
setupscenecoords ();
settransform ();
static void D3D_free2 (void)
{
- D3D_clear ();
invalidatedeviceobjects ();
if (d3ddev) {
d3ddev->Release ();
hr = d3dex->GetAdapterDisplayModeEx (adapter, &modeex, NULL);
}
if (FAILED (hr = d3d->GetAdapterDisplayMode (adapter, &mode)))
- write_log (L"%s: IDirect3D9_GetAdapterDisplayMode failed %s\n", D3DHEAD, D3D_ErrorString (hr));
+ write_log (L"%s: GetAdapterDisplayMode failed %s\n", D3DHEAD, D3D_ErrorString (hr));
if (FAILED (hr = d3d->GetDeviceCaps (adapter, D3DDEVTYPE_HAL, &d3dCaps)))
- write_log (L"%s: IDirect3D9_GetDeviceCaps failed %s\n", D3DHEAD, D3D_ErrorString (hr));
+ write_log (L"%s: GetDeviceCaps failed %s\n", D3DHEAD, D3D_ErrorString (hr));
memset (&dpp, 0, sizeof (dpp));
dpp.Windowed = isfullscreen() <= 0;
d3dhwnd = ahwnd;
t_depth = depth;
+ flags = 0;
// Check if hardware vertex processing is available
if(d3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
- flags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
+ flags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
- flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
+ flags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
flags |= D3DCREATE_FPU_PRESERVE;
if (d3d_ex && D3DEX) {
ret = d3dex->CreateDeviceEx (adapter, D3DDEVTYPE_HAL, d3dhwnd, flags, &dpp, dpp.Windowed ? NULL : &modeex, &d3ddevex);
- d3ddev = (LPDIRECT3DDEVICE9)d3ddevex;
+ d3ddev = d3ddevex;
} else {
ret = d3d->CreateDevice (adapter, D3DDEVTYPE_HAL, d3dhwnd, flags, &dpp, &d3ddev);
}
return errmsg;
}
- if(d3dCaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
- tex_square = TRUE;
- if(d3dCaps.TextureCaps & D3DPTEXTURECAPS_POW2) {
- if(d3dCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) {
- tex_pow2 = FALSE;
- } else {
- tex_pow2 = TRUE;
- }
- } else {
- tex_pow2 = FALSE;
- }
- if(d3dCaps.Caps2 & D3DCAPS2_DYNAMICTEXTURES)
- tex_dynamic = TRUE;
-
- if(d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2,0)) {
- if((d3dCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && tex_dynamic && !tex_pow2 && !tex_square) {
- psEnabled = TRUE;
- } else {
- psEnabled = FALSE;
- }
- }else {
+ if (d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2, 0))
+ psEnabled = TRUE;
+ else
psEnabled = FALSE;
- }
max_texture_w = d3dCaps.MaxTextureWidth;
max_texture_h = d3dCaps.MaxTextureHeight;
- write_log (L"%s: PS=%d.%d VS=%d.%d Square=%d, Pow2=%d, Dyn=%d, %d*%d*%d%s\n",
+ write_log (L"%s:", D3DHEAD);
+ if (d3dCaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
+ write_log (L"SQUAREONLY ");
+ if (d3dCaps.TextureCaps & D3DPTEXTURECAPS_POW2)
+ write_log (L"POW2 ");
+ if (d3dCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL)
+ write_log (L"NPOTCONDITIONAL ");
+ if (d3dCaps.TextureCaps & D3DPTEXTURECAPS_ALPHA)
+ write_log (L"ALPHA ");
+ if (d3dCaps.Caps2 & D3DCAPS2_DYNAMICTEXTURES)
+ write_log (L"DYNAMIC ");
+ write_log (L"\n");
+
+ write_log (L"%s: PS=%d.%d VS=%d.%d %d*%d*%d%s%s %d-bit\n",
D3DHEAD,
(d3dCaps.PixelShaderVersion >> 8) & 0xff, d3dCaps.PixelShaderVersion & 0xff,
(d3dCaps.VertexShaderVersion >> 8) & 0xff, d3dCaps.VertexShaderVersion & 0xff,
- tex_square, tex_pow2, tex_dynamic,
max_texture_w, max_texture_h,
- dpp.Windowed ? 0 : dpp.FullScreen_RefreshRateInHz, currprefs.gfx_avsync ? L" VSYNC" : L""
+ dpp.Windowed ? 0 : dpp.FullScreen_RefreshRateInHz,
+ dpp.Windowed ? L"" : L" FS",
+ currprefs.gfx_avsync ? L" VSYNC" : L"",
+ t_depth
);
- if ((d3dCaps.PixelShaderVersion < 3 || d3dCaps.VertexShaderVersion < 3 || tex_pow2 || tex_square || !tex_dynamic || max_texture_w < 4096 || max_texture_h < 4096) && D3DEX) {
+ if ((d3dCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || d3dCaps.VertexShaderVersion < D3DVS_VERSION(3,0) || !psEnabled || max_texture_w < 4096 || max_texture_h < 4096) && d3d_ex) {
D3DEX = 0;
write_log (L"Disabling D3D9Ex\n");
return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth);
}
-
mult = S2X_getmult ();
t_w *= mult;
t_h *= mult;
switch (depth)
{
- case 32:
- if (currprefs.gfx_filter_scanlines)
+ case 32:
+ default:
tformat = D3DFMT_A8R8G8B8;
- else
- tformat = D3DFMT_X8R8G8B8;
break;
- case 15:
- case 16:
- if (currprefs.gfx_filter_scanlines)
+ case 15:
+ case 16:
tformat = D3DFMT_A1R5G5B5;
- else
- tformat = D3DFMT_X1R5G5B5;
break;
}
window_w = w_w;
window_h = w_h;
tin_w = t_w;
tin_h = t_h;
- if (!restoredeviceobjects ()) {
- D3D_free ();
- _stprintf (errmsg, L"%s: texture creation failed", D3DHEAD);
- return errmsg;
- }
changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET;
- hr = D3DXCreateSprite (d3ddev, &sprite);
- if (FAILED (hr)) {
- write_log (L"%s: LED D3DXSprite failed: %s\n", D3D_ErrorString (hr), D3DHEAD);
- }
-
MatrixOrthoOffCenterLH (&m_matProj2, 0, window_w, 0, window_h, 0.0f, 1.0f);
MatrixTranslation (&m_matView2, -0.5f + window_w / 2, 0.5f + window_h / 2, 0);
MatrixScaling (&m_matWorld2, window_w, window_h, 1.0f);
- createscanlines (1);
+ if (!restoredeviceobjects ()) {
+ D3D_free ();
+ _stprintf (errmsg, L"%s: initialization failed.", D3DHEAD);
+ return errmsg;
+ }
+
d3d_enabled = 1;
+
return 0;
}
return 1;
}
+static HRESULT reset (void)
+{
+ if (d3dex)
+ return d3ddevex->ResetEx (&dpp, dpp.Windowed ? NULL : &modeex);
+ else
+ return d3ddev->Reset (&dpp);
+}
+
int D3D_needreset (void)
{
HRESULT hr;
write_log (L"%s: DEVICENOTRESET\n", D3DHEAD);
devicelost = 2;
invalidatedeviceobjects ();
- if (d3dex)
- hr = d3ddevex->ResetEx (&dpp, dpp.Windowed ? NULL : &modeex);
- else
- hr = d3ddev->Reset (&dpp);
+ hr = reset ();
if (FAILED (hr)) {
write_log (L"%s: Reset failed %s\n", D3DHEAD, D3D_ErrorString (hr));
resetcount++;
}
return 1;
}
+ devicelost = 0;
write_log (L"%s: Reset succeeded\n", D3DHEAD);
restoredeviceobjects ();
- return 1;
+ return -1;
} else if (hr == D3DERR_DEVICELOST) {
invalidatedeviceobjects ();
- Sleep (500);
+ return 0;
} else if (SUCCEEDED (hr)) {
+ devicelost = 0;
+ invalidatedeviceobjects ();
+ hr = reset ();
+ if (FAILED (hr))
+ write_log (L"%s: Reset failed %s\n", D3DHEAD, D3D_ErrorString (hr));
+ restoredeviceobjects ();
return -1;
}
write_log (L"%s: TestCooperativeLevel %s\n", D3DHEAD, D3D_ErrorString (hr));
}
}
-static void D3D_render22 (int clear)
+static void D3D_render22 (void)
{
HRESULT hr;
+ LPDIRECT3DTEXTURE9 srctex;
+ UINT uPasses, uPass;
if (!isd3d ())
return;
setupscenecoords ();
- settransform ();
- if (needclear || clear) {
- hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, d3ddebug ? 0x80 : 0x00, 0), 0, 0);
- if (FAILED (hr))
- write_log (L"%s: Clear() failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
- needclear = 0;
- }
+ hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, d3ddebug ? 0x80 : 0, 0), 0, 0);
if (FAILED (hr = d3ddev->BeginScene ())) {
write_log (L"%s: BeginScene: %s\n", D3DHEAD, D3D_ErrorString (hr));
return;
}
- setupscenescaled ();
- if (window_h > tin_h || window_w > tin_w) {
- D3DRECT r[4];
- int num;
- num = 0;
- if (window_w > tin_w) {
- r[num].x1 = 0;
- r[num].y1 = 0;
- r[num].x2 = (window_w - tin_w) / 2;
- r[num].y2 = window_h;
- num++;
- r[num].x1 = window_w - (window_w - tin_w) / 2;
- r[num].y1 = 0;
- r[num].x2 = window_w;
- r[num].y2 = window_h;
- num++;
- }
- if (window_h > tin_h) {
- r[num].x1 = 0;
- r[num].y1 = 0;
- r[num].x2 = window_w;
- r[num].y2 = (window_h - tin_h) / 2;
- num++;
- r[num].x1 = 0;
- r[num].y1 = window_h - (window_h - tin_h) / 2;
- r[num].x2 = window_w;
- r[num].y2 = window_h;
- num++;
- }
- d3ddev->Clear (num, r, D3DCLEAR_TARGET, D3DCOLOR_XRGB(d3ddebug ? 0x80 : 0x00, 0, 0), 0, 0);
- }
if (psActive) {
- UINT uPasses, uPass;
LPDIRECT3DSURFACE9 lpRenderTarget;
LPDIRECT3DSURFACE9 lpNewRenderTarget;
LPDIRECT3DTEXTURE9 lpWorkTexture;
+ settransform ();
if (!psEffect_SetTextures (texture, lpWorkTexture1, lpWorkTexture2, lpHq2xLookupTexture))
return;
if (psPreProcess) {
if (!psEffect_SetMatrices (&m_matPreProj, &m_matPreView, &m_matPreWorld))
return;
- if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) {
+
+ if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget)))
write_log (L"%s: GetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr));
- return;
- }
lpWorkTexture = lpWorkTexture1;
+ lpNewRenderTarget = NULL;
pass2:
- if (FAILED (hr = lpWorkTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) {
+ if (FAILED (hr = lpWorkTexture->GetSurfaceLevel (0, &lpNewRenderTarget)))
write_log (L"%s: GetSurfaceLevel: %s\n", D3DHEAD, D3D_ErrorString (hr));
- return;
- }
- if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) {
+ if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget)))
write_log (L"%s: SetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr));
- return;
- }
+
uPasses = 0;
- if (!psEffect_Begin ((lpWorkTexture == lpWorkTexture1) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses))
- return;
- for (uPass = 0; uPass < uPasses; uPass++) {
- if (!psEffect_BeginPass (uPass))
- return;
- d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 8, 2);
- psEffect_EndPass ();
+ if (psEffect_Begin (pEffect, (lpWorkTexture == lpWorkTexture1) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses)) {
+ for (uPass = 0; uPass < uPasses; uPass++) {
+ if (psEffect_BeginPass (pEffect, uPass)) {
+ if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 4, 2))) {
+ write_log (L"%s: Effect DrawPrimitive failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ }
+ psEffect_EndPass (pEffect);
+ }
+ }
+ psEffect_End (pEffect);
}
- if (!psEffect_End ())
- return;
if (psEffect_hasPreProcess2 () && lpWorkTexture == lpWorkTexture1) {
lpWorkTexture = lpWorkTexture2;
+ lpNewRenderTarget->Release ();
+ lpNewRenderTarget = NULL;
goto pass2;
}
- if (lpRenderTarget) {
- d3ddev->SetRenderTarget (0, lpRenderTarget);
- lpRenderTarget->Release ();
- }
- if (!psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld))
- return;
+ if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget)))
+ write_log (L"%s: Effect RenderTarget reset failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ lpRenderTarget->Release ();
+ lpRenderTarget = NULL;
+ lpNewRenderTarget->Release ();
+ lpNewRenderTarget = NULL;
}
+ psEffect_SetMatrices (&m_matProj2, &m_matView2, &m_matWorld2);
+
+ if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget)))
+ write_log (L"%s: GetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ if (FAILED (hr = lpTempTexture->GetSurfaceLevel (0, &lpNewRenderTarget)))
+ write_log (L"%s: GetSurfaceLevel: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget)))
+ write_log (L"%s: SetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, d3ddebug ? 0x80 : 0), 0, 0);
+
uPasses = 0;
- if (!psEffect_Begin (psEffect_Combine, &uPasses))
- return;
- for (uPass = 0; uPass < uPasses; uPass++) {
- if (!psEffect_BeginPass (uPass))
- return;
- d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2);
- psEffect_EndPass ();
+ if (psEffect_Begin (pEffect, psEffect_Combine, &uPasses)) {
+ for (uPass = 0; uPass < uPasses; uPass++) {
+ if (!psEffect_BeginPass (pEffect, uPass))
+ return;
+ if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2)))
+ write_log (L"%s: Effect2 DrawPrimitive failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ psEffect_EndPass (pEffect);
+ }
+ psEffect_End (pEffect);
}
- if (!psEffect_End ())
- return;
+ if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget)))
+ write_log (L"%s: SetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ lpNewRenderTarget->Release ();
+ lpRenderTarget->Release ();
+ srctex = lpTempTexture;
+
+ } else {
+
+ srctex = texture;
+
+ }
+
+ if (masktexture) {
+ if (FAILED (hr = postEffect->SetTechnique (postTechnique)))
+ write_log (L"%s: SetTechnique(postTechnique) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ if (FAILED (hr = postEffect->SetTexture (postMaskTextureHandle, masktexture)))
+ write_log (L"%s: SetTexture(masktexture) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ } else if (sltexture) {
+ if (FAILED (hr = postEffect->SetTechnique (postTechniqueAlpha)))
+ write_log (L"%s: SetTechnique(postTechniqueAlpha) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ if (FAILED (hr = postEffect->SetTexture (postMaskTextureHandle, sltexture)))
+ write_log (L"%s: SetTexture(sltexture) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
} else {
+ if (FAILED (hr = postEffect->SetTechnique (postTechniquePlain)))
+ write_log (L"%s: SetTechnique(postTechniquePlain) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ }
+ hr = postEffect->SetInt (postFilterMode, currprefs.gfx_filter_bilinear ? D3DTEXF_LINEAR : D3DTEXF_POINT);
- if (masktexture) {
- hr = d3ddev->SetTexture (0, masktexture);
- hr = d3ddev->SetTextureStageState (0, D3DTSS_TEXCOORDINDEX, 0);
- hr = d3ddev->SetTextureStageState (0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- hr = d3ddev->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- hr = d3ddev->SetTextureStageState (0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
-
- hr = d3ddev->SetTexture (1, texture);
- hr = d3ddev->SetTextureStageState (1, D3DTSS_TEXCOORDINDEX, 0);
- hr = d3ddev->SetTextureStageState (1, D3DTSS_COLOROP, D3DTOP_MODULATE);
- hr = d3ddev->SetTextureStageState (1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- hr = d3ddev->SetTextureStageState (1, D3DTSS_COLORARG2, D3DTA_CURRENT);
- } else {
- hr = d3ddev->SetTexture (0, texture);
+ if (FAILED (hr = postEffect->SetTexture (postSourceTextureHandle, srctex)))
+ write_log (L"%s: SetTexture(srctex) failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ setupscenecoords ();
+ hr = postEffect->SetMatrix (postMatrixSource, &postproj);
+ hr = postEffect->SetVector (postMaskMult, &maskmult);
+
+ uPasses = 0;
+ if (psEffect_Begin (postEffect, psEffect_None, &uPasses)) {
+ for (uPass = 0; uPass < uPasses; uPass++) {
+ if (psEffect_BeginPass (postEffect, uPass)) {
+ if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2)))
+ write_log (L"%s: Post DrawPrimitive failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
+ psEffect_EndPass (postEffect);
+ }
}
- hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2);
+ psEffect_End (postEffect);
}
- if (sprite && (sltexture || ledtexture)) {
+ if (sprite && ((ledtexture) || (cursorsurfaced3d && cursor_v))) {
D3DXVECTOR3 v;
sprite->Begin (D3DXSPRITE_ALPHABLEND);
- if (sltexture) {
- v.x = v.y = v.z = 0;
- sprite->Draw (sltexture, NULL, NULL, &v, 0xffffffff);
+ if (cursorsurfaced3d && cursor_v) {
+ D3DXMATRIX t;
+
+ MatrixScaling (&t, ((float)(window_w) / (tin_w + 2 * cursor_offset_x)), ((float)(window_h) / (tin_h + 2 * cursor_offset_y)), 0);
+ v.x = cursor_x + cursor_offset_x;
+ v.y = cursor_y + cursor_offset_y;
+ v.z = 0;
+ sprite->SetTransform (&t);
+ sprite->Draw (cursorsurfaced3d, NULL, NULL, &v, 0xffffffff);
+ MatrixScaling (&t, 1, 1, 0);
+ sprite->SetTransform (&t);
}
if (ledtexture) {
v.x = 0;
}
}
-static void D3D_render2 (int clear)
+static void D3D_render2 (void)
{
int fpuv;
fpux_save (&fpuv);
- D3D_render22 (clear);
+ D3D_render22 ();
fpux_restore (&fpuv);
}
+void D3D_setcursor (int x, int y, int visible)
+{
+ cursor_x = x;
+ cursor_y = y;
+ cursor_v = visible;
+}
+
void D3D_unlocktexture (void)
{
HRESULT hr;
if (currprefs.leds_on_screen & STATUSLINE_CHIPSET)
updateleds ();
- hr = texture->UnlockRect (0);
+ if (locked)
+ hr = texture->UnlockRect (0);
+ locked = 0;
- D3D_render2 (0);
+ D3D_render2 ();
if (vsync2 && !currprefs.turbo_emulation)
- D3D_render2 (0);
+ D3D_render2 ();
}
uae_u8 *D3D_locktexture (int *pitch)
{
static int frameskip;
- D3DLOCKED_RECT locked;
+ D3DLOCKED_RECT lock;
HRESULT hr;
+ if (D3D_needreset () > 0)
+ return NULL;
if (!isd3d ())
return NULL;
if (currprefs.turbo_emulation && isfullscreen () > 0 && frameskip-- > 0)
return NULL;
frameskip = 50;
- locked.pBits = NULL;
- locked.Pitch = 0;
- hr = texture->LockRect (0, &locked, NULL, 0);
+ lock.pBits = NULL;
+ lock.Pitch = 0;
+ hr = texture->LockRect (0, &lock, NULL, 0);
if (FAILED (hr)) {
write_log (L"%s: LockRect failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
return NULL;
}
- if (locked.pBits == NULL || locked.Pitch == 0) {
+ if (lock.pBits == NULL || lock.Pitch == 0) {
write_log (L"%s: LockRect returned NULL texture\n", D3DHEAD);
D3D_unlocktexture ();
return NULL;
}
- *pitch = locked.Pitch;
- return (uae_u8*)locked.pBits;
+ locked = 1;
+ *pitch = lock.Pitch;
+ return (uae_u8*)lock.pBits;
}
void D3D_refresh (void)
{
if (!isd3d ())
return;
- createscanlines (1);
- D3D_render2 (1);
- D3D_render2 (1);
+ D3D_render2 ();
+ D3D_render2 ();
+ createscanlines (0);
}
-void D3D_getpixelformat (int depth,int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a)
+void D3D_getpixelformat (int depth, int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a)
{
switch (depth)
{
if (SUCCEEDED (hr))
return hdc;
write_log (L"%s: GetDC() failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
- return 0;
}
- bb->ReleaseDC (hdc);
+ if (hdc)
+ bb->ReleaseDC (hdc);
bb->Release ();
+ bb = NULL;
return 0;
}
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
extern void D3D_resize (int width, int height);
extern void D3D_free (void);
extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
extern void D3D_clear (void);
extern int D3D_canshaders (void);
extern int D3D_goodenough (void);
-
-#ifdef __cplusplus
-}
-#endif
\ No newline at end of file
+extern void D3D_setcursor (int x, int y, int visible);
+extern LPDIRECT3DTEXTURE9 cursorsurfaced3d;
struct ddcaps dxcaps;
static int flipinterval_supported = 1;
int ddforceram = DDFORCED_DEFAULT;
-int useoverlay = 0;
-int ddsoftwarecolorkey = 0;
HRESULT DirectDraw_GetDisplayMode (void)
{
DirectDraw_SetClipper (NULL);
releaser (dxdata.dclip, IDirectDrawClipper_Release);
}
- releaser (dxdata.palette, IDirectDrawPalette_Release);
releaser (dxdata.flipping[1], IDirectDrawSurface7_Release);
releaser (dxdata.flipping[0], IDirectDrawSurface7_Release);
releaser (dxdata.primary, IDirectDrawSurface7_Release);
releaser (dxdata.secondary, IDirectDrawSurface7_Release);
- releaser (dxdata.cursorsurface1, IDirectDrawSurface7_Release);
- releaser (dxdata.cursorsurface2, IDirectDrawSurface7_Release);
releaser (dxdata.statussurface, IDirectDrawSurface7_Release);
dxdata.backbuffers = 0;
}
if (SUCCEEDED (ddrval))
return ddrval;
ddrval = IDirectDrawSurface7_Restore (surf);
- if (SUCCEEDED (ddrval)) {
- if (surf == dxdata.primary && dxdata.palette)
- IDirectDrawSurface7_SetPalette (dxdata.primary, dxdata.palette);
- }
return ddrval;
}
ddrval = IDirectDrawSurface7_Restore (surf);
if (FAILED (ddrval)) {
write_log (L"IDirectDrawSurface7_Restore: %s\n", DXError (ddrval));
- } else {
- if (surf == dxdata.primary && dxdata.palette)
- IDirectDrawSurface7_SetPalette (dxdata.primary, dxdata.palette);
}
return ddrval;
}
}
#endif
-static void createcursorsurface (void)
+static void createstatussurface (void)
{
- releaser (dxdata.cursorsurface1, IDirectDrawSurface7_Release);
- releaser (dxdata.cursorsurface2, IDirectDrawSurface7_Release);
releaser (dxdata.statussurface, IDirectDrawSurface7_Release);
- dxdata.cursorsurface1 = allocsurface_2 (dxcaps.cursorwidth, dxcaps.cursorheight, TRUE);
- dxdata.cursorsurface2 = allocsurface_2 (dxcaps.cursorwidth, dxcaps.cursorheight, FALSE);
dxdata.statussurface = allocsurface_2 (dxdata.statuswidth, dxdata.statusheight, FALSE);
- if (dxdata.cursorsurface1)
- clearsurf (dxdata.cursorsurface1, 0);
- if (dxdata.cursorsurface2)
- clearsurf (dxdata.cursorsurface2, 0);
if (dxdata.statussurface)
clearsurf (dxdata.statussurface, 0);
}
ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
}
} else {
- if (useoverlay && DirectDraw_GetCurrentDepth () == 32) {
- DDPIXELFORMAT of;
- DWORD dwDDSColor;
- memset (&of, 0, sizeof (of));
- of.dwRGBBitCount = 16;
- of.dwRBitMask = 0xF800;
- of.dwGBitMask = 0x07E0;
- of.dwBBitMask = 0x001F;
- desc.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_PRIMARYSURFACE;
- desc.ddpfPixelFormat = of;
- dxdata.overlayfx.dwSize = sizeof (DDOVERLAYFX);
- dxdata.overlayflags = DDOVER_SHOW | DDOVER_DDFX | DDOVER_KEYDESTOVERRIDE;
- dwDDSColor = 0xff00ff;
- dxdata.overlayfx.dckDestColorkey.dwColorSpaceLowValue = dwDDSColor;
- dxdata.overlayfx.dckDestColorkey.dwColorSpaceHighValue = dwDDSColor;
- ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
- dxdata.isoverlay = 1;
- } else {
- ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
- }
+ ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
}
if (FAILED (ddrval)) {
write_log (L"IDirectDraw7_CreateSurface: %s\n", DXError (ddrval));
} else {
write_log (L"Couldn't get surface pitch!\n");
}
- createcursorsurface ();
+ createstatussurface ();
} else {
ddrval = DD_FALSE;
}
switch (pfp->dwRGBBitCount)
{
case 8:
- if ((pfp->dwFlags & DDPF_PALETTEINDEXED8) != 0)
- return RGBFB_CHUNKY;
break;
case 16:
return 1;
}
-HRESULT DirectDraw_SetPaletteEntries (int start, int count, PALETTEENTRY *palette)
-{
- HRESULT ddrval = DDERR_NOPALETTEATTACHED;
- if (dxdata.palette)
- ddrval = IDirectDrawPalette_SetEntries(dxdata.palette, 0, start, count, palette);
- return ddrval;
-}
-HRESULT DirectDraw_SetPalette (int remove)
-{
- HRESULT ddrval;
- if (dxdata.fsmodeset <= 0 || (!dxdata.palette && !remove))
- return DD_FALSE;
- ddrval = IDirectDrawSurface7_SetPalette (dxdata.primary, remove ? NULL : dxdata.palette);
- if (FAILED (ddrval))
- write_log (L"IDirectDrawSurface7_SetPalette: %s\n", DXError (ddrval));
- return ddrval;
-}
-HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal)
-{
- HRESULT ddrval;
- ddrval = IDirectDraw_CreatePalette (dxdata.maindd, DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &dxdata.palette, NULL);
- if (FAILED (ddrval))
- write_log (L"IDirectDraw_CreatePalette: %s\n", DXError (ddrval));
- return ddrval;
-}
-
void DirectDraw_Release (void)
{
if (!dxdata.ddinit)
dxcaps.cancolorkey = TRUE;
if (dc->dwCaps2 & DDCAPS2_NONLOCALVIDMEM)
dxcaps.cannonlocalvidmem = TRUE;
- if (ddsoftwarecolorkey)
- dxcaps.cancolorkey = FALSE;
}
dxdata.statuswidth = 800;
dxdata.statusheight = TD_TOTAL_HEIGHT;
- dxcaps.cursorwidth = 48;
- dxcaps.cursorheight = 48;
if (!d3ddone) {
d3dDLL = LoadLibrary (L"D3D9.DLL");
if (d3dDLL) {
#define __DXWRAP_H__
#include "rtgmodes.h"
-#include "ddraw.h"
+#include <ddraw.h>
+#include <d3d9.h>
extern int ddforceram;
extern int useoverlay;
struct ddstuff
{
- int ddinit;
- int ddzeroguid;
- GUID ddguid;
- LPDIRECTDRAW7 maindd;
- LPDIRECTDRAWCLIPPER dclip;
- LPDIRECTDRAWSURFACE7 primary, secondary, flipping[2];
- LPDIRECTDRAWPALETTE palette;
- DDOVERLAYFX overlayfx;
- DWORD overlayflags;
- int fsmodeset, backbuffers;
- int width, height, depth, freq;
- int swidth, sheight;
- DDSURFACEDESC2 native;
- DDSURFACEDESC2 locksurface;
- int lockcnt;
- DWORD pitch;
- HWND hwnd;
- uae_u32 colorkey;
- int islost, isoverlay;
-
- LPDIRECTDRAWSURFACE7 cursorsurface1;
- LPDIRECTDRAWSURFACE7 cursorsurface2;
- LPDIRECTDRAWSURFACE7 statussurface;
- int statuswidth, statusheight;
+ int ddinit;
+ int ddzeroguid;
+ GUID ddguid;
+ LPDIRECTDRAW7 maindd;
+ LPDIRECTDRAWCLIPPER dclip;
+ LPDIRECTDRAWSURFACE7 primary, secondary, flipping[2];
+ DDOVERLAYFX overlayfx;
+ DWORD overlayflags;
+ int fsmodeset, backbuffers;
+ int width, height, depth, freq;
+ int swidth, sheight;
+ DDSURFACEDESC2 native;
+ DDSURFACEDESC2 locksurface;
+ int lockcnt;
+ DWORD pitch;
+ HWND hwnd;
+ uae_u32 colorkey;
+ int islost, isoverlay;
+
+ LPDIRECTDRAWSURFACE7 statussurface;
+ int statuswidth, statusheight;
};
struct ddcaps
{
- int cursorwidth, cursorheight;
- int maxwidth, maxheight;
- int cancolorkey;
- int cannonlocalvidmem;
+ int maxwidth, maxheight;
+ int cancolorkey;
+ int cannonlocalvidmem;
};
extern struct ddstuff dxdata;
extern struct ddcaps dxcaps;
struct ScreenResolution
{
- uae_u32 width; /* in pixels */
- uae_u32 height; /* in pixels */
+ uae_u32 width; /* in pixels */
+ uae_u32 height; /* in pixels */
};
#define MAX_PICASSO_MODES 300
#define MAX_REFRESH_RATES 100
struct PicassoResolution
{
- struct ScreenResolution res;
- int depth; /* depth in bytes-per-pixel */
- int residx;
- int refresh[MAX_REFRESH_RATES]; /* refresh-rates in Hz */
- int refreshtype[MAX_REFRESH_RATES]; /* 0=dx,1=enumdisplaysettings */
- TCHAR name[25];
- /* Bit mask of RGBFF_xxx values. */
- uae_u32 colormodes;
- int nondx;
+ struct ScreenResolution res;
+ int depth; /* depth in bytes-per-pixel */
+ int residx;
+ int refresh[MAX_REFRESH_RATES]; /* refresh-rates in Hz */
+ int refreshtype[MAX_REFRESH_RATES]; /* 0=dx,1=enumdisplaysettings */
+ TCHAR name[25];
+ /* Bit mask of RGBFF_xxx values. */
+ uae_u32 colormodes;
+ int nondx;
};
extern GUID *displayGUID;
#define MAX_DISPLAYS 10
struct MultiDisplay {
- int primary, disabled, gdi;
- GUID guid;
- TCHAR *name, *name2, *name3;
- struct PicassoResolution *DisplayModes;
- RECT rect;
+ int primary, disabled, gdi;
+ GUID guid;
+ TCHAR *name, *name2, *name3;
+ struct PicassoResolution *DisplayModes;
+ RECT rect;
};
extern struct MultiDisplay Displays[MAX_DISPLAYS];
typedef enum
{
- red_mask,
- green_mask,
- blue_mask
+ red_mask,
+ green_mask,
+ blue_mask
} DirectDraw_Mask_e;
extern const TCHAR *DXError (HRESULT hr);
void DirectDraw_Fill (RECT *rect, uae_u32 color);
void DirectDraw_FillPrimary (void);
-HRESULT DirectDraw_SetPaletteEntries (int start, int count, PALETTEENTRY *palette);
-HRESULT DirectDraw_SetPalette (int remove);
-HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal);
-
void dx_check (void);
int dx_islost (void);
changed_prefs.df[i][0] = 0;
}
_tcscpy (changed_prefs.df[swapperdrive], currprefs.dfxlist[num]);
+ config_changed = 1;
}
}
break;
static HANDLE hPrt = INVALID_HANDLE_VALUE;
static DWORD dwJob;
static int prtopen;
-extern void flushpixels(void);
void DoSomeWeirdPrintingStuff(uae_char val);
static int uartbreak;
static int parflush;
#include "rp.h"
#include "picasso96_win.h"
#include "win32gfx.h"
+#include "direct3d.h"
#include "clipboard.h"
#define NOBLITTER 0
static int picasso96_BT = BT_uaegfx;
static int picasso96_GCT = GCT_Unknown;
static int picasso96_PCT = PCT_Unknown;
-#ifndef UAEGFX_INTERNAL
-static int uaegfxcard_old = 1;
-#endif
int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity);
void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize);
#define P96TRACING_ENABLED 0
#define P96SPRTRACING_ENABLED 0
-int p96hack_vpos, p96hack_vpos2, p96refresh_active;
+int p96refresh_active;
int have_done_picasso = 1; /* For the JIT compiler */
static int p96syncrate;
int p96hsync_counter, full_refresh;
#define P96TRACING_ENABLED 1
#define P96TRACING_LEVEL 1
#endif
-static void flushpixels (void);
+static int flushpixels (void);
#if P96TRACING_ENABLED
#define P96TRACE(x) do { write_log x; } while(0)
#else
#endif
static int cursorwidth, cursorheight, cursorok;
static uae_u32 cursorrgb[4], cursorrgbn[4];
-static int reloadcursor, cursorvisible, cursordeactivate;
+static int cursorvisible, cursordeactivate;
static HCURSOR wincursor;
static int wincursor_shown;
static uaecptr boardinfo;
static void disablemouse (void)
{
+ if (!currprefs.gfx_api)
+ return;
cursorok = FALSE;
cursordeactivate = 0;
+ D3D_setcursor (0, 0, 0);
}
-static int remcursor_x, remcursor_y, remcursor_w, remcursor_h;
static int newcursor_x, newcursor_y;
-static int oldcursor_x, oldcursor_y;
+
static void mouseupdate (void)
{
- int fx1, fy1, fx2, fy2;
int x = newcursor_x;
int y = newcursor_y;
int forced = 0;
+ if (!currprefs.gfx_api)
+ return;
+
if (cursordeactivate > 0) {
cursordeactivate--;
if (cursordeactivate == 0) {
disablemouse ();
cursorvisible = 0;
- oldcursor_x = -10000;
}
- x = oldcursor_x;
- y = oldcursor_y;
- forced = 1;
}
- if (oldcursor_x == x && oldcursor_y == y && !forced)
- return;
- oldcursor_x = x;
- oldcursor_y = y;
-
- if (x <= -cursorwidth)
- x = -cursorwidth;
- if (y <= -cursorheight)
- y = -cursorheight;
- if (x >= picasso96_state.Width)
- x = picasso96_state.Width;
- if (y >= picasso96_state.Height)
- y = picasso96_state.Height;
-
- fx1 = remcursor_x;
- fy1 = remcursor_y;
- fx2 = fx1 + remcursor_w;
- fy2 = fy1 + remcursor_h;
-
- remcursor_x = x;
- remcursor_y = y;
- remcursor_w = cursorwidth;
- remcursor_h = cursorheight;
-
- if (fx2 == fx1 || fy1 == fy2)
- return;
- if (x < fx1)
- fx1 = x;
- if (y < fy1)
- fy1 = y;
- if (x + cursorwidth > fx2)
- fx2 = x + cursorwidth;
- if (y + cursorheight > fy2)
- fy2 = y + cursorheight;
-
- if (fx1 < 0)
- fx1 = 0;
- if (fy1 < 0)
- fy1 = 0;
- if (fx1 >= picasso96_state.Width)
- fx1 = picasso96_state.Width - 1;
- if (fy1 >= picasso96_state.Height)
- fy1 = picasso96_state.Height - 1;
- fx2 -= fx1;
- fy2 -= fy1;
- if (fx1 + fx2 >= picasso96_state.Width)
- fx2 = picasso96_state.Width - fx1;
- if (fy1 + fy2 >= picasso96_state.Height)
- fy2 = picasso96_state.Height - fy1;
- DX_Invalidate (fx1, fy1, fx2, fy2);
- gfx_unlock_picasso ();
+ D3D_setcursor (x, y, cursorvisible);
}
static int framecnt;
return currprefs.gfx_pfullscreen && currprefs.gfx_pvsync;
}
-static void flushpixels_do (void)
-{
- if (multithreaded)
- uae_sem_post (&sem);
- else
- flushpixels ();
-}
-
void picasso_handle_vsync (void)
{
static int vsynccnt;
mouseupdate ();
if (thisisvsync) {
- if (multithreaded) {
- uae_sem_post (&sem);
+ int flushed = 0;
+ if (doskip () && p96skipmode == 0) {
+ ;
} else {
- if (doskip () && p96skipmode == 0) {
- ;
- } else {
- flushpixels_do ();
- }
- gfx_unlock_picasso ();
+ flushed = flushpixels ();
}
+ if (!flushed)
+ gfx_unlock_picasso ();
}
}
static uae_u32 setspriteimage (uaecptr bi);
static void recursor (void)
{
- restoresurface (dxdata.cursorsurface1);
- restoresurface (dxdata.cursorsurface2);
- clearsurface (dxdata.cursorsurface1);
- clearsurface (dxdata.cursorsurface2);
- reloadcursor = 1;
cursorok = FALSE;
setspriteimage (boardinfo);
}
* 2. Picasso-->Picasso transition, via SetPanning().
* 3. whenever the graphics code notifies us that the screen contents have been lost.
*/
-extern uae_u16 new_beamcon0;
void picasso_refresh (void)
{
struct RenderInfo ri;
- static int beamcon0_before, p96refresh_was;
if (! picasso_on)
return;
- { //for higher P96 mousedraw rate
- /* HACK */
- extern uae_u16 vtotal;
- if (p96hack_vpos2) {
- vtotal = p96hack_vpos2;
- beamcon0_before = new_beamcon0;
- new_beamcon0 |= 0x80;
- p96refresh_active = 1;
- p96refresh_was = 1;
- } else {
- if (p96refresh_was) {
- new_beamcon0 = beamcon0_before;
- p96refresh_was = 0;
- }
- new_beamcon0 |= 0x20;
- }
- /* HACK until ntsc timing is fixed.. */
- } //end for higher P96 mousedraw rate
full_refresh = 1;
setconvert ();
width = picasso96_state.Width;
height = picasso96_state.Height;
}
- flushpixels_do ();
+ flushpixels ();
} else {
write_log (L"ERROR - picasso_refresh() can't refresh!\n");
}
return 1;
}
-
-static RECT cursor_r1, cursor_r2;
-static int mouseput;
-void picasso_putcursor (int sx, int sy, int sw, int sh)
-{
- int xdiff, ydiff, xdiff2, ydiff2;
- LPDIRECTDRAWSURFACE7 dstsurf = dxdata.secondary;
-
- if (!cursorvisible || !hwsprite || !cursorok || wincursor_shown)
- return;
-
- if (remcursor_x + remcursor_w < sx)
- return;
- if (remcursor_y + remcursor_h < sy)
- return;
- if (remcursor_x > sx + sw)
- return;
- if (remcursor_y > sy + sh)
- return;
- if (remcursor_w == 0 || remcursor_h == 0)
- return;
-
- cursor_r1.left = remcursor_x;
- cursor_r1.top = remcursor_y;
- cursor_r1.right = cursor_r1.left + remcursor_w;
- cursor_r1.bottom = cursor_r1.top + remcursor_h;
-
- xdiff = ydiff = 0;
- xdiff2 = ydiff2 = 0;
- if (cursor_r1.right > picasso96_state.Width)
- xdiff = picasso96_state.Width - cursor_r1.right;
- if (cursor_r1.bottom > picasso96_state.Height)
- ydiff = picasso96_state.Height - cursor_r1.bottom;
- if (xdiff <= -cursorwidth)
- return;
- if (ydiff <= -cursorheight)
- return;
-
- if (cursor_r1.left < 0) {
- xdiff2 = cursor_r1.left;
- cursor_r1.left = 0;
- }
- if (cursor_r1.top < 0) {
- ydiff2 = cursor_r1.top;
- cursor_r1.top = 0;
- }
-
- cursor_r1.right += xdiff;
- cursor_r1.bottom += ydiff;
-
- cursor_r2.left = 0;
- cursor_r2.top = 0;
- cursor_r2.right = cursorwidth + xdiff + xdiff2;
- cursor_r2.bottom = cursorheight + ydiff + ydiff2;
-
- if (!DirectDraw_BlitRect (dxdata.cursorsurface2, &cursor_r2, dstsurf, &cursor_r1)) {
- recursor ();
- return;
- }
-
- cursor_r2.left = -xdiff2;
- cursor_r2.top = -ydiff2;
- cursor_r2.right = cursor_r2.left + cursorwidth + xdiff + xdiff2;
- cursor_r2.bottom = cursor_r2.top + cursorheight + ydiff + ydiff2;
-
- if (!DirectDraw_BlitRectCK (dstsurf, &cursor_r1, dxdata.cursorsurface1, &cursor_r2)) {
- recursor ();
- return;
- }
-
- cursor_r2.left = 0;
- cursor_r2.top = 0;
- cursor_r2.right = cursorwidth + xdiff + xdiff2;
- cursor_r2.bottom = cursorheight + ydiff + ydiff2;
-
- mouseput = 1;
-}
-void picasso_clearcursor (void)
-{
- DWORD ddrval;
- LPDIRECTDRAWSURFACE7 dstsurf = dxdata.secondary;
-
- if (!cursorok || wincursor_shown)
- return;
- if (!mouseput)
- return;
- mouseput = 0;
-
- ddrval = IDirectDrawSurface7_Blt (dstsurf, &cursor_r1, dxdata.cursorsurface2, &cursor_r2, DDBLT_WAIT, NULL);
- if (FAILED(ddrval)) {
- if (ddrval != DDERR_SURFACELOST)
- write_log (L"Cursor surface clearblit failed: %s\n", DXError (ddrval));
- }
-}
-
STATIC_INLINE uae_u16 rgb32torgb16pc (uae_u32 rgb)
{
return (((rgb >> (16 + 3)) & 0x1f) << 11) | (((rgb >> (8 + 2)) & 0x3f) << 5) | (((rgb >> (0 + 3)) & 0x1f) << 0);
}
-static void updatesprcolors (void)
+static void updatesprcolors (int bpp)
{
int i;
- for (i = 1; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
uae_u32 v = cursorrgb[i];
- switch (picasso_vidinfo.pixbytes)
+ switch (bpp)
{
case 1:
/* use custom chip sprite palette */
cursorrgbn[i] = rgb32torgb16pc (v);
break;
case 4:
+ if (i > 0)
+ v |= 0xff000000;
+ else
+ v &= 0x00ffffff;
cursorrgbn[i] = v;
break;
}
{
uae_u32 val;
- if (idx == 0)
+ if (idx == 0 && !currprefs.gfx_api)
val = dxdata.colorkey;
else
val = cursorrgbn[idx];
static uae_u32 setspriteimage (uaecptr bi)
{
- DDSURFACEDESC2 desc;
uae_u32 flags;
int x, y, yy, bits, bpp;
- DWORD ddrval;
- uae_u8 *dptr;
uae_u8 *tmpbuf;
- DWORD pitch;
int hiressprite, doubledsprite;
int ret = 0;
int w, h;
cursordeactivate = 0;
- if (!hwsprite || !dxdata.cursorsurface1)
+ if (!hwsprite || !cursorsurfaced3d)
return 0;
- oldcursor_x = -10000;
+ bpp = 4;
w = get_byte (bi + PSSO_BoardInfo_MouseWidth);
h = get_byte (bi + PSSO_BoardInfo_MouseHeight);
tmpbuf = NULL;
hiressprite = 2;
if (flags & BIF_BIGSPRITE)
doubledsprite = 1;
- updatesprcolors ();
+ updatesprcolors (bpp);
P96TRACE_SPR ((L"SetSpriteImage(%08x,%08x,w=%d,h=%d,%d/%d,%08x)\n",
bi, get_long (bi + PSSO_BoardInfo_MouseImage), w, h,
hiressprite - 1, doubledsprite, bi + PSSO_BoardInfo_MouseImage));
- if (w > dxcaps.cursorwidth)
- w = dxcaps.cursorwidth;
- if (h > dxcaps.cursorheight)
- h = dxcaps.cursorheight;
-
- bpp = picasso_vidinfo.pixbytes;
if (!w || !h || get_long (bi + PSSO_BoardInfo_MouseImage) == 0) {
cursordeactivate = 1;
ret = 1;
}
}
- if (cursorok) {
- for (;;) {
- if (!reloadcursor && w == cursorwidth && h == cursorheight) {
- int different = 0;
- desc.dwSize = sizeof (desc);
- while (FAILED ((ddrval = IDirectDrawSurface7_Lock (dxdata.cursorsurface1, NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL)))) {
- if (ddrval == DDERR_SURFACELOST) {
- ddrval = IDirectDrawSurface7_Restore (dxdata.cursorsurface1);
- if (FAILED (ddrval))
- break;
- }
- }
- if (FAILED (ddrval))
- break;
- dptr = (uae_u8*)desc.lpSurface;
- pitch = desc.lPitch;
- for (y = 0; y < h; y++) {
- uae_u8 *p1 = tmpbuf + w * bpp * y;
- uae_u8 *p2 = dptr + pitch * y;
- if (memcmp (p1, p2, w * bpp))
- different = 1;
- }
- IDirectDrawSurface_Unlock (dxdata.cursorsurface1, NULL);
- if (!different) {
- P96TRACE_SPR ((L"sprite was same as previously\n"));
- ret = 1;
- goto end;
- }
- }
- break;
- }
- cursorok = FALSE;
- }
-
cursorwidth = w;
cursorheight = h;
- desc.dwSize = sizeof (desc);
- while (FAILED((ddrval = IDirectDrawSurface7_Lock (dxdata.cursorsurface1, NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL)))) {
- if (ddrval == DDERR_SURFACELOST) {
- ddrval = IDirectDrawSurface7_Restore (dxdata.cursorsurface1);
- if (FAILED(ddrval)) {
- write_log (L"sprite surface failed to restore: %s\n", DXError (ddrval));
- goto end;
- }
- }
+ uae_u8 *dptr = NULL;
+ DWORD pitch;
+ D3DLOCKED_RECT locked;
+ if (SUCCEEDED (cursorsurfaced3d->LockRect (0, &locked, NULL, 0))) {
+ dptr = (uae_u8*)locked.pBits;
+ pitch = locked.Pitch;
}
- dptr = (uae_u8*)desc.lpSurface;
- pitch = desc.lPitch;
- for (y = 0; y < h; y++) {
- uae_u8 *p1 = tmpbuf + w * bpp * y;
- uae_u8 *p2 = dptr + pitch * y;
- memcpy (p2, p1, w * bpp);
+ if (dptr) {
+ for (y = 0; y < h; y++) {
+ uae_u8 *p1 = tmpbuf + w * bpp * y;
+ uae_u8 *p2 = dptr + pitch * y;
+ memcpy (p2, p1, w * bpp);
+ }
+ cursorsurfaced3d->UnlockRect (0);
}
- IDirectDrawSurface_Unlock (dxdata.cursorsurface1, NULL);
ret = 1;
- reloadcursor = 0;
cursorok = TRUE;
P96TRACE_SPR ((L"hardware sprite created\n"));
end:
{
uaecptr AmigaBoardInfo = m68k_areg (regs, 0);
/* NOTES: See BoardInfo struct definition in Picasso96 dev info */
-#ifdef UAEGFX_INTERNAL
if (!uaegfx_base)
return 0;
put_long (uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo);
boardinfo = AmigaBoardInfo;
-#endif
if (allocated_gfxmem && !picasso96_state.CardFound) {
/* Fill in MemoryBase, MemorySize */
put_long (AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_start);
{
int i;
+#ifdef NEWMODES2
+ return 0x40000000 | (w << 14) | h;
+#endif
for (i = 0; mi[i].width > 0; i++) {
if (w == mi[i].width && h == mi[i].height)
return 0x50001000 | (mi[i].id * 0x10000);
static int missmodes[] = { 320, 200, 320, 240, 320, 256, 640, 400, 640, 480, 640, 512, 800, 600, 1024, 768, 1280, 1024, -1 };
-#ifdef UAEGFX_INTERNAL
static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size);
-#endif
+
void picasso96_alloc (TrapContext *ctx)
{
int i, j, size, cnt;
#if 0
ShowSupportedResolutions ();
#endif
-#ifdef UAEGFX_INTERNAL
uaegfx_card_install (ctx, size);
init_alloc ();
-#else
- m68k_dreg (regs, 0) = size;
- m68k_dreg (regs, 1) = 65536 + 1;
- if ((picasso96_amem = CallLib (ctx, get_long (4), -0xC6))) { /* AllocMem */
- uaecptr rt;
- picasso96_amemend = picasso96_amem + size;
- write_log("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, cnt, size);
- /* put magic rtarea pointer to end of display ram */
- put_long (p96ram_start + allocated_gfxmem - 12, 'UAE_');
- rt = need_uae_boot_rom ();
- if (rt)
- rt += 0xff60;
- put_long (p96ram_start + allocated_gfxmem - 8, rt);
- put_long (p96ram_start + allocated_gfxmem - 4, '_UAE');
- }
-#endif
-
}
-#ifndef UAEGFX_INTERNAL
-static void uaegfxversion (uaecptr bi)
-{
- uaecptr addr = get_long (bi + 16); /* gbi_BoardName */
- int max = 1000;
- int ok = 0;
-
- uaegfxcard_old = 1;
-
- addr &= ~1;
- for (;;) {
- if (!valid_address (addr, 24) || bi == 0) {
- max = 0;
- break;
- }
- addr -= 2;
- if (get_word (addr) == 0x4afc)
- break;
- max--;
- if (max < 0)
- break;
- }
- if (max > 0) {
- uaecptr romtagp;
- romtagp = get_long (addr + 2);
- if (romtagp == addr) {
- uaecptr ver = get_long (addr + 18);
- if (valid_address (ver, 8)) {
- TCHAR *vers = my_strdup (get_real_address (ver));
- int version = get_byte (addr + 11);
- while (strlen (vers) > 0 && (vers[strlen (vers) - 1] == 10 || vers[strlen (vers) - 1] == 13))
- vers[strlen (vers) - 1] = 0;
-
- write_log (L"P96: v%d %08X %s\n", version, addr, vers);
- if (version == 1) {
- static int warned;
- if (!warned)
- gui_message("Buggy libs:picasso96/uaegfx.card detected.\nPlease replace it with official version.\n");
- warned = 1;
- }
- if (version >= 2)
- uaegfxcard_old = 0;
- xfree (vers);
- ok = 1;
- }
- }
- }
- if (!ok)
- write_log (L"P96: uaegfx.card not detected!?\n");
-}
-#endif
-
static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI);
static void inituaegfx (uaecptr ABI)
{
cursorvisible = 0;
cursorok = 0;
cursordeactivate = 0;
- reloadcursor = 0;
-
write_log (L"RTG mode mask: %x\n", currprefs.picasso96_modeflags);
put_word (ABI + PSSO_BoardInfo_BitsPerCannon, 8);
put_word (ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags);
flags = get_long (ABI + PSSO_BoardInfo_Flags);
flags &= 0xffff0000;
flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX;
-#ifndef UAEGFX_INTERNAL
- if (flags & BIF_HARDWARESPRITE) {
+ flags &= ~BIF_HARDWARESPRITE;
+ if (currprefs.gfx_api) {
hwsprite = 1;
- put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, 0);
- write_log (L"P96: uaegfx.card: hardware sprite support enabled\n");
+ flags |= BIF_HARDWARESPRITE;
+ write_log (L"P96: Hardware sprite support enabled\n");
} else {
hwsprite = 0;
- write_log (L"P96: uaegfx.card: no hardware sprite support\n");
- put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, currprefs.picasso96_modeflags);
+ write_log (L"P96: Hardware sprite support disabled\n");
}
- if (uaegfxcard_old && (flags & BIF_HARDWARESPRITE)) {
- flags &= ~BIF_HARDWARESPRITE;
- write_log (L"P96: uaegfx.card: old version (<2.0), forced hardware sprite disabled\n");
- }
- if (!(flags & BIF_BLITTER))
- write_log (L"P96: no blitter support, bogus uaegfx.card!?\n");
-#else
- hwsprite = 1;
- flags |= BIF_HARDWARESPRITE;
-#endif
if (flags & BIF_NOBLITTER)
write_log (L"P96: Blitter disabled in devs:monitors/uaegfx!\n");
put_word (ABI + PSSO_BoardInfo_MaxVerResolution + 4, hicolour.height);
put_word (ABI + PSSO_BoardInfo_MaxVerResolution + 6, truecolour.height);
put_word (ABI + PSSO_BoardInfo_MaxVerResolution + 8, alphacolour.height);
-#ifdef UAEGFX_INTERNAL
inituaegfxfuncs (uaegfx_rom, ABI);
-#endif
}
static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const TCHAR *name, int display, int *unkcnt)
uaecptr amem;
uaecptr AmigaBoardInfo = m68k_areg (regs, 0);
-#ifndef UAEGFX_INTERNAL
- uaegfxversion (AmigaBoardInfo);
-#endif
if (!picasso96_amem) {
write_log (L"P96: InitCard() but no resolution memory!\n");
return 0;
picasso96_state.CLUT[i].Blue = b;
clut += 3;
}
+ picasso_palette ();
return changed;
}
static uae_u32 REGPARAM2 picasso_SetColorArray (TrapContext *ctx)
static void init_picasso_screen (void)
{
- reloadcursor = 1;
if(set_panning_called) {
picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight;
}
if (p96vblank >= 300)
p96vblank = 300;
p96syncrate = maxvpos * vblank_hz / p96vblank;
- write_log (L"P96FREQ: %d*%d = %d / %d = %d\n", maxvpos, vblank_hz, maxvpos * vblank_hz, p96vblank, p96syncrate);
+ write_log (L"P96FREQ: %d*%d = %d / %d = %d\n", maxvpos, vblank_hz, maxvpos_nom * vblank_hz, p96vblank, p96syncrate);
}
/* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */
}
}
-static void flushpixels (void)
+static int flushpixels (void)
{
int i;
uae_u8 *src = p96ram_start + natmem_offset;
picasso_vidinfo.width, picasso_vidinfo.height);
#endif
if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end)
- return;
+ return 0;
if (flashscreen) {
full_refresh = 1;
if (full_refresh < 0) {
gwwcnt = (src_end - src_start) / gwwpagesize + 1;
full_refresh = 1;
- if (picasso_palette ()) {
- reloadcursor = 1;
- setspriteimage (boardinfo);
- }
for (i = 0; i < gwwcnt; i++)
gwwbuf[i] = src_start + i * gwwpagesize;
} else {
}
#endif
- if (dst == NULL) {
- if (DirectDraw_IsLocked () == FALSE) {
- if (!lock)
- dst = gfx_lock_picasso ();
- lock = 1;
- } else {
- dst = picasso96_state.HostAddress;
- }
- }
+ dst = gfx_lock_picasso ();
if (dst == NULL)
break;
+ lock = 1;
dst += picasso_vidinfo.offset;
if (doskip () && p96skipmode == 2)
break;
}
- if (currprefs.leds_on_screen & STATUSLINE_RTG) {
+ if (!currprefs.gfx_api && (currprefs.leds_on_screen & STATUSLINE_RTG)) {
if (dst == NULL) {
- if (DirectDraw_IsLocked () == FALSE) {
- if (!lock)
- dst = gfx_lock_picasso ();
- lock = 1;
- } else {
- dst = picasso96_state.HostAddress;
- }
+ dst = gfx_lock_picasso ();
+ lock = 1;
+ } else {
+ dst = picasso96_state.HostAddress;
}
if (dst) {
statusline (dst);
}
full_refresh = 0;
}
+ return lock;
}
static uae_u32 REGPARAM2 gfxmem_lgetx (uaecptr addr)
return onoff;
}
-#ifdef UAEGFX_INTERNAL
-
#define PUTABI(func) \
if (ABI) \
put_long (ABI + func, here ());
dw (RTS);
/* ResolvePixelClock
move.l D0,gmi_PixelClock(a1) ; pass the pixelclock through
- moveq #0,D0 ; index is 0
+ moveq #0,D0 ; index is 0
move.b #98,gmi_Numerator(a1) ; whatever
move.b #14,gmi_Denominator(a1) ; whatever
rts
}
#define UAEGFX_VERSION 3
-#define UAEGFX_REVISION 0
+#define UAEGFX_REVISION 3
static uae_u32 REGPARAM2 gfx_open (TrapContext *context)
{
put_long (p2 + 14, base + CARD_IRQFLAG);
put_long (p2 + 18, c);
- put_word (c, 0x4a11); c += 2; // tst.b (a1)
- put_word (c, 0x670e); c += 2; // beq.s label
- put_word (c, 0x4211); c += 2; // clr.b (a1)
- put_long (c, 0x22690004); c += 4; // move.l 4(a1),a1
- put_long (c, 0x2c780004); c += 4; // move.l 4.w,a6
- put_long (c, 0x4eaeff4c); c += 4; // jsr Cause(a6)
- put_word (c, 0x7000); c += 2; // label: moveq #0,d0
- put_word (c, RTS); // rts
+ put_word (c, 0x4a11); c += 2; // tst.b (a1)
+ put_word (c, 0x670e); c += 2; // beq.s label
+ put_word (c, 0x4211); c += 2; // clr.b (a1)
+ put_long (c, 0x22690004); c += 4; // move.l 4(a1),a1
+ put_long (c, 0x2c780004); c += 4; // move.l 4.w,a6
+ put_long (c, 0x4eaeff4c); c += 4; // jsr Cause(a6)
+ put_word (c, 0x7000); c += 2; // label: moveq #0,d0
+ put_word (c, RTS); // rts
m68k_areg (regs, 1) = p1;
- m68k_dreg (regs, 0) = 5; /* VERTB */
- CallLib (ctx, get_long (4), -168); /* AddIntServer */
+ m68k_dreg (regs, 0) = 5; /* VERTB */
+ CallLib (ctx, get_long (4), -168); /* AddIntServer */
m68k_areg (regs, 1) = p2;
- m68k_dreg (regs, 0) = 3; /* PORTS */
- CallLib (ctx, get_long (4), -168); /* AddIntServer */
+ m68k_dreg (regs, 0) = 3; /* PORTS */
+ CallLib (ctx, get_long (4), -168); /* AddIntServer */
}
static void *picasso_copy (void *data)
write_log (L"uaegfx.card %d.%d init @%08X\n", UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);
return uaegfx_base;
}
-#endif
-
-#ifndef UAEGFX_INTERNAL
-uae_u32 picasso_demux (uae_u32 arg, TrapContext *context)
-{
- switch (arg)
- {
- case 16: return picasso_FindCard (context);
- case 17: return picasso_FillRect (context);
- case 18: return picasso_SetSwitch (context);
- case 19: return picasso_SetColorArray (context);
- case 20: return picasso_SetDAC (context);
- case 21: return picasso_SetGC (context);
- case 22: return picasso_SetPanning (context);
- case 23: return picasso_CalculateBytesPerRow (context);
- case 24: return picasso_BlitPlanar2Chunky (context);
- case 25: return picasso_BlitRect (context);
- case 26: return picasso_SetDisplay (context);
- case 27: return picasso_BlitTemplate (context);
- case 28: return picasso_BlitRectNoMaskComplete (context);
- case 29: return picasso_InitCard (context);
- case 30: return picasso_BlitPattern (context);
- case 31: return picasso_InvertRect (context);
- case 32: return picasso_BlitPlanar2Direct (context);
- /* case 34: return picasso_WaitVerticalSync (); handled in asm-code */
- case 35: return allocated_gfxmem ? 1 : 0;
- case 36: return picasso_SetSprite (context);
- case 37: return picasso_SetSpritePosition (context);
- case 38: return picasso_SetSpriteImage (context);
- case 39: return picasso_SetSpriteColor (context);
- }
- return 0;
-}
-#endif
void restore_p96_finish (void)
{
return dstbak;
}
-
#endif
extern struct picasso96_state_struct picasso96_state;
extern uae_u16 picasso96_pixel_format;
-extern void DX_SetPalette (int start, int count);
extern void picasso_enablescreen (int on);
extern void picasso_refresh (void);
extern void picasso_handle_vsync (void);
extern void init_hz_p96 (void);
extern void picasso_handle_hsync (void);
-extern int picasso_palette (void);
extern void picasso_reset (void);
extern int picasso_setwincursor (void);
+extern int picasso_palette (void);
/* This structure describes the UAE-side framebuffer for the Picasso
* screen. */
extern uae_u8 *gfx_lock_picasso (void);
extern void gfx_unlock_picasso (void);
extern void picasso_clip_mouse (int *, int *);
-extern void picasso_putcursor (int,int,int,int);
-extern void picasso_clearcursor (void);
extern int createwindowscursor (uaecptr src, int w, int h, int hiressprite, int doubledsprite, int chipset);
extern int p96refresh_active;
#define IDC_MINIMIZED_PRI 1636
#define IDC_FILTERAUTOSCALE 1636
#define IDC_VOLUME_BOOTPRI_TEXT 1637
-#define IDC_FILTERAUTOSCALE2 1637
#define IDC_FILTEROVERLAY 1637
#define IDC_VOLUME_BOOTPRI 1638
#define IDC_KBLED1 1639
#define IDC_CPU_FREQUENCY 1791
#define IDC_RTG_SCALE_ASPECTRATIO 1792
#define IDC_ASSOCIATE_ON 1792
+#define IDC_DD_SURFACETYPE2 1792
+#define IDC_DXMODE 1792
#define IDC_RTG_VBLANKRATE 1793
#define IDC_DF0WPTEXTQ 1793
#define IDC_DF1WPTEXTQ 1794
-#define IDC_FILTERD3D 1795
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
#undef APSTUDIO_READONLY_SYMBOLS\r
\r
/////////////////////////////////////////////////////////////////////////////\r
-// English (Neutral) resources\r
+// English resources\r
\r
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
-#ifdef _WIN32\r
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL\r
#pragma code_page(1252)\r
-#endif //_WIN32\r
\r
/////////////////////////////////////////////////////////////////////////////\r
//\r
// Accelerator\r
//\r
\r
-IDR_DBGACCEL ACCELERATORS \r
+IDR_DBGACCEL ACCELERATORS\r
BEGIN\r
VK_F1, ID_DBG_PAGE1, VIRTKEY, NOINVERT\r
VK_F2, ID_DBG_PAGE2, VIRTKEY, NOINVERT\r
GROUPBOX "Miscellaneous Options",IDC_STATIC,8,2,290,136\r
CONTROL "Untrap = middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,19,110,10\r
CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,109,10\r
- CONTROL "Native On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,80,109,10\r
+ CONTROL "Native On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,80,109,10\r
CONTROL "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,56,109,10\r
CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,110,10\r
GROUPBOX "Keyboard LEDs",IDC_STATIC,7,140,85,94\r
CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,95,111,10\r
CONTROL "Faster RTG [] Enables less accurate custom chipset emulation mode when Picasso96 is enabled.",IDC_FASTERRTG,\r
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,108,100,10\r
- CONTROL "RTG On-screen LEDs",IDC_SHOWLEDSRTG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,93,109,10\r
+ CONTROL "RTG On-screen LEDs",IDC_SHOWLEDSRTG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,93,109,10\r
+ LTEXT "Graphics API:",IDC_STATIC,136,49,62,10,SS_CENTERIMAGE\r
+ COMBOBOX IDC_DXMODE,138,62,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
END\r
\r
IDD_HARDFILE DIALOGEX 0, 0, 299, 249\r
CONTROL "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,168,85,10\r
COMBOBOX IDC_FILTERAUTOSCALE,132,36,83,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
COMBOBOX IDC_FILTERASPECT2,14,180,73,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
- CONTROL "Direct3D",IDC_FILTERD3D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,38,63,10\r
COMBOBOX IDC_FILTEROVERLAY,20,36,103,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
END\r
\r
//\r
\r
VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 2,0,2,0\r
- PRODUCTVERSION 2,0,2,0\r
+ FILEVERSION 2,1,0,0\r
+ PRODUCTVERSION 2,1,0,0\r
FILEFLAGSMASK 0x3fL\r
#ifdef _DEBUG\r
FILEFLAGS 0x1L\r
BLOCK "040904b0"\r
BEGIN\r
VALUE "FileDescription", "WinUAE"\r
- VALUE "FileVersion", "2.0.2"\r
+ VALUE "FileVersion", "2.1.0.0"\r
VALUE "InternalName", "WinUAE"\r
VALUE "LegalCopyright", "© 1996-2010 under the GNU Public License (GPL)"\r
VALUE "OriginalFilename", "WinUAE.exe"\r
VALUE "ProductName", "WinUAE"\r
- VALUE "ProductVersion", "2.0.2"\r
+ VALUE "ProductVersion", "2.1.0.0"\r
END\r
END\r
BLOCK "VarFileInfo"\r
// Menu\r
//\r
\r
-IDM_SYSTRAY MENU \r
+IDM_SYSTRAY MENU\r
BEGIN\r
POPUP "Menu"\r
BEGIN\r
END\r
END\r
\r
-IDM_DBGCONTEXTMENU MENU \r
+IDM_DBGCONTEXTMENU MENU\r
BEGIN\r
POPUP "Inactive"\r
BEGIN\r
//\r
\r
#ifdef APSTUDIO_INVOKED\r
-GUIDELINES DESIGNINFO \r
+GUIDELINES DESIGNINFO\r
BEGIN\r
+ IDD_MISC1, DIALOG\r
+ BEGIN\r
+ END\r
+\r
IDD_FILTER, DIALOG\r
BEGIN\r
BOTTOMMARGIN, 237\r
// String Table\r
//\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_KICKSTART "ROM"\r
IDS_DISK "Disk swapper"\r
IDS_FILTER "Filter"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_MISC2 "Pri. & Extensions"\r
IDS_PATHS "Paths"\r
IDS_EXPANSION "Expansions"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_EXTTEXT "Floppy disk image files"\r
IDS_EXTACTUAL "ADF"\r
IDS_EIGHTH "eighth "\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_NINTH "ninth "\r
IDS_TENTH "tenth "\r
IDS_VOLUME "Volume"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_SELECTFILESYSROOT "Please select the root directory of the file system..."\r
IDS_DEFAULTMIDIOUT "Default MIDI-Out Device"\r
IDS_MIDIOVERFLOW "Sysexbuffer overflow. Should not happen. Please report this to\nberndroesch1@compuserve.de"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_PATH "Path"\r
IDS_RW "R/W"\r
IDS_INVALIDCOMPORT "The serial port you have in this configuration is not valid on this machine.\n"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_HFDSIZE "Size"\r
IDS_DEVICE "Device"\r
IDS_DEFAULT_WINUAE "WinUAE default (old)"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_SOUND_STEREO2 "Cloned Stereo (4 Channels)"\r
IDS_INPUT_CUSTOMEVENT "<Custom event>"\r
IDS_NETDISCONNECTED "Cable disconnected"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_UNSUPPORTEDPIXELFORMAT \r
"Error: unsupported pixel format. Please use a different screen mode.\n"\r
IDS_ERRORTITLE "WinUAE message"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_INP "WinUAE Input Recording"\r
IDS_RESTOREINP "Playback a WinUAE input recording"\r
IDS_SOUND_FILTER_EMULATED "Emulated (A500)"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_SOUND_FILTER_EMULATED_E "Emulated (A1200)"\r
IDS_INPUT_COMPATIBILITY "Compatibility mode"\r
"the desktop is running in an unknown color mode."\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_UNSUPPORTEDSCREENMODE_2 \r
"the desktop is running in 8-bit color depth, which WinUAE can't use in windowed mode."\r
IDS_TREEVIEW_ABOUT "About"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_NOHARDDRIVES "No hard disks detected that were either empty or RDB-partitioned."\r
IDS_DEFAULT_HOST "Default Configuration"\r
IDS_FLOPPYTYPE35DDESCOM "3.5"" ESCOM"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_NUMSG_NEEDEXT2 "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again."\r
IDS_NUMSG_NOROMKEY "Could not find system ROM key file."\r
IDS_NUMSG_KSROMREADERROR "Error while reading system ROM."\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_NUMSG_NOEXTROM "No extended ROM found."\r
IDS_NUMSG_MODRIP_NOTFOUND "No music modules or packed data found."\r
IDS_ROMSCANEND "Scan of ROMs finished"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_ROM_AVAILABLE "available"\r
IDS_ROM_UNAVAILABLE "unavailable"\r
IDS_SB_CUSTOMEVENT "Enter custom event string.."\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_QS_MODELS "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration"\r
IDS_QS_MODEL_A500 "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)."\r
IDS_QS_MODEL_CDTV "CDTV\nThe CDTV was the first model with a built-in CD-ROM drive. Looking like a black CD player, it featured a configuration equivalent to that of an A500 with 1 MB RAM and an ECS chipset.\nFloppy drive and 64KB SRAM card expanded CDTV\n"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_QS_MODEL_UAE "High-end expanded configuration"\r
IDS_QS_MODEL_ARCADIA "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and Mastertronic. It is based on an A500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel."\r
IDS_QS_MODEL_A4000T "A4000T (test)\nA4000T"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_FLOPPYTYPE35DDPC "3.5"" DD (PC)"\r
IDS_FLOPPYTYPE35HDPC "3.5"" HD (PC)"\r
IDS_PRINTER_ASCII "ASCII-Only"\r
END\r
\r
-STRINGTABLE \r
+STRINGTABLE\r
BEGIN\r
IDS_PRINTER_EPSON9 "Epson Matrix Printer Emulation, 9pin"\r
IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"\r
IDS_CD "CD image files"\r
END\r
\r
-#endif // English (Neutral) resources\r
+#endif // English resources\r
/////////////////////////////////////////////////////////////////////////////\r
\r
\r
/////////////////////////////////////////////////////////////////////////////\r
-// Finnish resources\r
+// Finnish (Finland) resources\r
\r
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FIN)\r
-#ifdef _WIN32\r
LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT\r
#pragma code_page(1252)\r
-#endif //_WIN32\r
\r
#ifdef APSTUDIO_INVOKED\r
/////////////////////////////////////////////////////////////////////////////\r
\r
#endif // APSTUDIO_INVOKED\r
\r
-#endif // Finnish resources\r
+#endif // Finnish (Finland) resources\r
/////////////////////////////////////////////////////////////////////////////\r
\r
\r
if (num != 0)
return 0;
_tcscpy (changed_prefs.cdimagefile, name);
+ config_changed = 1;
return 1;
}
updatewinfsmode (p);
hwndset = 0;
+ config_changed = 1;
}
static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM lParam,
warpmode ((lParam & RP_TURBO_CPU) ? 1 : 0);
if (wParam & RP_TURBO_FLOPPY)
changed_prefs.floppy_speed = (lParam & RP_TURBO_FLOPPY) ? 0 : 100;
+ config_changed = 1;
}
return TRUE;
case RPIPCHM_PAUSE:
rp_turbo (currprefs.turbo_emulation);
for (i = 0; i <= 4; i++)
rp_update_leds (i, 0, 0);
+ config_changed = 1;
}
static void rp_device_change (int dev, int num, const TCHAR *name)
lines += 1.0;
hpos = maxhpos_short;
}
- lines += maxvpos;
+ lines += maxvpos_nom;
scaled_sample_evtime_orig = hpos * lines * freq * CYCLE_UNIT / (float)sdp->obtainedfreq;
scaled_sample_evtime = scaled_sample_evtime_orig;
{
set_volume_sound_device (sdp, volume, mute);
setvolume_ahi (volume);
+ config_changed = 1;
}
static void recalc_offsets (struct sound_data *sd)
if (!currprefs.produce_sound)
return 0;
+ config_changed = 1;
/* Always interpret buffer size as number of samples, not as actual
buffer size. Of course, since 8192 is the default, we'll have to
scale that to a sane value (assuming that otherwise 16 bits and
void close_sound (void)
{
+ config_changed = 1;
gui_data.sndbuf = 0;
gui_data.sndbuf_status = 3;
if (! have_sound)
else
sdp->mute = newmute;
set_volume (currprefs.sound_volume, sdp->mute);
+ config_changed = 1;
}
void sound_volume (int dir)
currprefs.sound_volume = 100;
changed_prefs.sound_volume = currprefs.sound_volume;
set_volume (currprefs.sound_volume, sdp->mute);
+ config_changed = 1;
}
void master_sound_volume (int dir)
{
if (vol > 65535)
vol = 65535;
set_master_volume (vol, mute);
+ config_changed = 1;
}
rm -rf release
rm -rf fullrelease
rm -rf ipch
+rm -rf x64
cd ..
cd singlefilehelper
{
// iso-8859-15,iso-8859-1,windows-1252,default ansi
static UINT pages[] = { 28605, 28591, 1252, 0 };
- int i;
+ int i, minac, maxac;
+ UINT ac;
for (i = 0; fscodepage = pages[i]; i++) {
if (MultiByteToWideChar (fscodepage, 0, " ", 1, NULL, 0))
break;
}
- write_log (L"Filesystem charset (ACP=%u,FSCP=%u):\n", GetACP (), fscodepage);
+ ac = GetACP ();
+ if (ac == 1251) // cyrillic -> always use 1251
+ fscodepage = 1251;
+ write_log (L"Filesystem charset (ACP=%u,FSCP=%u):\n", ac, fscodepage);
+ minac = 0x7f;
+ maxac = 0x9f;
for (i = 0; i < 256; i++) {
TCHAR dst1[2], dst2[2];
char src[2];
write_log (L" %02X: %04X ", i, dst1[0]);
if ((i & 3) == 3)
write_log (L"\n");
- if (i < 32 || (i >= 0x7f && i <= 0x9f))
+ if (i < 32 || (i >= minac && i <= maxac))
aufstable[i] = dst1[0];
else
aufstable[i] = dst2[0];
int in_sizemove;
int manual_painting_needed;
-int manual_palette_refresh_needed;
+
int win_x_diff, win_y_diff;
int toggle_sound;
inputdevice_acquire (TRUE);
if (isfullscreen() > 0 && !gui_active)
setmouseactive (1);
- manual_palette_refresh_needed = 1;
#ifdef LOGITECHLCD
if (!minimized)
lcd_priority (1);
dx_check ();
break;
- case WM_PALETTECHANGED:
- if ((HWND)wParam != hWnd)
- manual_palette_refresh_needed = 1;
- return 0;
-
case WM_KEYDOWN:
if (dinput_wmkey ((uae_u32)lParam))
inputdevice_add_inputcode (AKS_ENTERGUI, 1);
if (manual_painting_needed)
updatedisplayarea ();
EndPaint (hWnd, &ps);
- if (manual_palette_refresh_needed) {
- WIN32GFX_SetPalette ();
-#ifdef PICASSO96
- DX_SetPalette (0, 256);
-#endif
- }
- manual_palette_refresh_needed = 0;
recursive--;
}
}
if (isfullscreen () == 0) {
changed_prefs.gfx_size_win.x = amigawin_rect.left;
changed_prefs.gfx_size_win.y = amigawin_rect.top;
+ config_changed = 1;
}
}
notice_screen_contents_lost ();
changed_prefs.gfx_size_win.width = width - window_extra_width;
changed_prefs.gfx_size_win.height = height - window_extra_height;
}
+ config_changed = 1;
}
if (hStatusWnd)
SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
return 1;
}
if (!_tcscmp (arg, L"-ddsoftwarecolorkey")) {
- extern int ddsoftwarecolorkey;
- ddsoftwarecolorkey = 1;
+ // obsolete
return 1;
}
if (!_tcscmp (arg, L"-nod3d9ex")) {
newname = xmalloc (TCHAR, _tcslen (name) + 1 + 10);
if (!newname)
return NULL;
- for (round = 0; round < 4; round++) {
+ for (round = 0; round < 6; round++) {
TCHAR *s;
_tcscpy (newname, name);
#ifdef CPU_64_BIT
break;
case 1:
p = _tcschr (newname, '.');
- _tcscpy (p, L"_64");
+ _tcscpy (p, L"_x64");
_tcscat (p, _tcschr (name, '.'));
break;
case 2:
+ p = _tcschr (newname, '.');
+ _tcscpy (p, L"x64");
+ _tcscat (p, _tcschr (name, '.'));
+ break;
+ case 3:
+ p = _tcschr (newname, '.');
+ _tcscpy (p, L"_64");
+ _tcscat (p, _tcschr (name, '.'));
+ break;
+ case 4:
p = _tcschr (newname, '.');
_tcscpy (p, L"64");
_tcscat (p, _tcschr (name, '.'));
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"11"
-#define WINUAEDATE MAKEBD(2010, 2, 13)
+#define WINUAEBETA L"12"
+#define WINUAEDATE MAKEBD(2010, 2, 20)
#define WINUAEEXTRA L""
#define WINUAEREV L""
--- /dev/null
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#ifdef GFXFILTER
+
+#include "options.h"
+#include "custom.h"
+#include "xwin.h"
+#include "dxwrap.h"
+#include "win32.h"
+#include "win32gfx.h"
+#include "gfxfilter.h"
+#include "dxwrap.h"
+#include "statusline.h"
+#include "drawing.h"
+#include "direct3d.h"
+
+#include <float.h>
+
+struct uae_filter uaefilters[] =
+{
+ { UAE_FILTER_NULL, 0, 1, L"Null filter", L"null", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
+
+ { UAE_FILTER_SCALE2X, 0, 2, L"Scale2X", L"scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
+
+ { UAE_FILTER_HQ, 0, 2, L"hq2x/3x/4x", L"hqx", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 },
+
+ { UAE_FILTER_SUPEREAGLE, 0, 2, L"SuperEagle", L"supereagle", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+
+ { UAE_FILTER_SUPER2XSAI, 0, 2, L"Super2xSaI", L"super2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+
+ { UAE_FILTER_2XSAI, 0, 2, L"2xSaI", L"2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+
+ { UAE_FILTER_PAL, 1, 1, L"PAL", L"pal", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
+
+ { 0 }
+};
+
+static int filteroffsetx, filteroffsety, filterxmult = 1000, filterymult = 1000;
+static int dst_width, dst_height, amiga_width, amiga_height, amiga_depth, dst_depth, scale;
+static int temp_width, temp_height;
+uae_u8 *bufmem_ptr;
+static LPDIRECTDRAWSURFACE7 tempsurf;
+static uae_u8 *tempsurf2, *tempsurf3;
+static int cleartemp;
+static uae_u32 rc[256], gc[256], bc[256];
+static int deskw, deskh;
+static int d3d;
+
+void getfilteroffset (int *dx, int *dy, int *mx, int *my)
+{
+ *dx = filteroffsetx;
+ *dy = filteroffsety;
+ *mx = filterxmult;
+ *my = filterymult;
+}
+
+static void getinit (void)
+{
+ if (isfullscreen ()) {
+ struct MultiDisplay *md = getdisplay (&currprefs);
+
+ deskw = md->rect.right - md->rect.left;
+ deskh = md->rect.bottom - md->rect.top;
+ } else {
+ deskw = dst_width;
+ deskh = dst_height;
+ }
+}
+
+static int vblscale (int v)
+{
+ static int o;
+ int n;
+
+ n = (beamcon0 & 0x80) + maxvpos_nom;
+ if (n != o)
+ cleartemp = 1;
+ o = n;
+ if (beamcon0 & 0x80)
+ return v;
+ if (currprefs.ntscmode)
+ v = v * maxvpos_nom / MAXVPOS_NTSC;
+ else
+ v = v * maxvpos_nom / MAXVPOS_PAL;
+ return v;
+}
+static int vblscale2 (int v)
+{
+ static int o;
+ int n;
+
+ n = (beamcon0 & 0x80) + maxvpos_nom;
+ if (n != o)
+ cleartemp = 1;
+ o = n;
+ if (beamcon0 & 0x80)
+ return v;
+ v = v * maxvpos_nom / MAXVPOS_PAL;
+ return v;
+}
+
+uae_u8 *getfilterrect1 (RECT *sr, RECT *dr, int dst_depth, int aw, int ah, int scale, int temp_width, int temp_height, uae_u8 *dptr, int pitch)
+{
+ int aws, ahs;
+
+ aws = aw * scale;
+ ahs = ah * scale;
+
+ SetRect (sr, 0, 0, 0, 0);
+ dr->left = sr->left + (temp_width - aws) /2;
+ dr->top = sr->top + (temp_height - ahs) / 2;
+ dptr += dr->left * (dst_depth / 8);
+ dptr += dr->top * pitch;
+ return dptr;
+}
+
+static void sizeoffset (RECT *dr, RECT *zr, int w, int h)
+{
+ dr->right -= w;
+ dr->bottom -= h;
+ OffsetRect (zr, w / 2, h / 2);
+}
+
+void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height)
+{
+ float srcratio, dstratio;
+ int aws, ahs, ahs2;
+ int xs, ys;
+ float xmult, ymult;
+ int v;
+ int extraw, extrah;
+ int fpuv;
+
+ if (screen_is_picasso) {
+ getrtgfilterrect2 (sr, dr, zr, dst_width, dst_height);
+ return;
+ }
+
+ fpux_save (&fpuv);
+
+ getinit ();
+ ahs2 = vblscale (ah) * scale;
+ aws = aw * scale;
+ ahs = ah * scale;
+
+ extraw = -aws * currprefs.gfx_filter_horiz_zoom / 2000;
+ extrah = -ahs * currprefs.gfx_filter_vert_zoom / 2000;
+
+ SetRect (sr, 0, 0, dst_width, dst_height);
+ SetRect (zr, 0, 0, 0, 0);
+ dr->left = (temp_width - aws) /2;
+ dr->top = (temp_height - ahs) / 2;
+ dr->left -= (dst_width - aws) / 2;
+ dr->top -= (dst_height - ahs) / 2;
+ dr->right = dr->left + dst_width;
+ dr->bottom = dr->top + dst_height;
+
+ filteroffsetx = 0;
+ filteroffsety = 0;
+
+ xmult = currprefs.gfx_filter_horiz_zoom_mult;
+ ymult = currprefs.gfx_filter_vert_zoom_mult;
+
+ srcratio = 4.0 / 3.0;
+ if (currprefs.gfx_filter_aspect > 0) {
+ dstratio = (currprefs.gfx_filter_aspect >> 8) * 1.0 / (currprefs.gfx_filter_aspect & 0xff);
+ } else if (currprefs.gfx_filter_aspect < 0) {
+ if (isfullscreen () && deskw > 0 && deskh > 0)
+ dstratio = 1.0 * deskw / deskh;
+ else
+ dstratio = 1.0 * dst_width / dst_height;
+ } else {
+ dstratio = srcratio;
+ }
+
+ if (currprefs.gfx_filter_autoscale) {
+ int cw, ch, cx, cy, cv;
+ static int oxmult, oymult;
+
+ filterxmult = 1000 / scale;
+ filterymult = 1000 / scale;
+
+ cv = get_custom_limits (&cw, &ch, &cx, &cy);
+ if (cv) {
+ int diff;
+
+ if (currprefs.gfx_filter_autoscale == 2 && isfullscreen () == 0) {
+ int ww;
+ static int lastresize = 0;
+ static int lastdelay = 1;
+ static int ocw, och, ocx, ocy, lcw, lch, lcx, lcy;
+ int useold = 0;
+
+ lastresize--;
+ if (lastresize > 0) {
+ if (cw != lcw || ch != lch || cx != lcx || cy != lcy)
+ lastresize = 50;
+ useold = 1;
+ } else if (lastdelay == 0) {
+ lastdelay = 2;
+ useold = 1;
+ } else if (lastdelay > 0) {
+ lastdelay--;
+ useold = 1;
+ if (lastdelay == 0) {
+ lastdelay = -1;
+ useold = 0;
+ }
+ }
+
+ lcw = cw;
+ lch = ch;
+ lcx = cx;
+ lcy = cy;
+ if (useold) {
+ cw = ocw;
+ ch = och;
+ cx = ocx;
+ cy = ocy;
+ } else {
+ ocw = cw;
+ och = ch;
+ ocx = cx;
+ ocy = cy;
+ lastresize = 50;
+ lastdelay = 0;
+ }
+
+ SetRect (sr, 0, 0, cw * scale, ch * scale);
+ dr->left = (temp_width - aws) /2;
+ dr->top = (temp_height - ahs) / 2;
+ dr->right = dr->left + cw * scale;
+ dr->bottom = dr->top + ch * scale;
+ OffsetRect (zr, cx * scale, cy * scale);
+ ww = dr->right - dr->left;
+ changed_prefs.gfx_size_win.width = ww;
+ changed_prefs.gfx_size_win.height = dr->bottom - dr->top;
+ fixup_prefs_dimensions (&changed_prefs);
+ OffsetRect (zr, -(changed_prefs.gfx_size_win.width - ww + 1) / 2, 0);
+ filteroffsetx = -zr->left / scale;
+ filteroffsety = -zr->top / scale;
+ goto end;
+ }
+
+ dr->left = (temp_width - aws) /2;
+ dr->top = (temp_height - ahs) / 2;
+ dr->right = dr->left + dst_width * scale;
+ dr->bottom = dr->top + dst_height * scale;
+
+ OffsetRect (zr, cx * scale, cy * scale);
+
+ sizeoffset (dr, zr, extraw, extrah);
+
+ dr->right -= (dst_width - cw) * scale;
+ dr->bottom -= (dst_height - ch) * scale;
+
+ filteroffsetx = -zr->left / scale;
+ filteroffsety = -zr->top / scale;
+
+ if (currprefs.gfx_filter_keep_aspect || currprefs.gfx_filter_aspect != 0) {
+ int diffx = dr->right - dr->left;
+ int diffy = dr->bottom - dr->top;
+ float xmult = 1.0;
+ float ymult = 1.0;
+
+ if (currprefs.gfx_filter_keep_aspect) {
+ dstratio = dstratio * (aws * 1.0 / ahs2) / (cw * 1.0 / ch);
+ if (currprefs.ntscmode) {
+ dstratio = dstratio * 1.21;
+ if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
+ dstratio = dstratio * 0.93;
+ else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
+ dstratio = dstratio * 0.98;
+ } else {
+ if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
+ dstratio = dstratio * 0.95;
+ else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
+ dstratio = dstratio * 0.95;
+ }
+ }
+
+ if (srcratio > dstratio) {
+ ymult = ymult * srcratio / dstratio;
+ } else {
+ xmult = xmult * dstratio / srcratio;
+ }
+
+ diff = diffx - diffx * xmult;
+ sizeoffset (dr, zr, diff, 0);
+ filteroffsetx += diff / 2;
+
+ diff = diffy - diffy * ymult;
+ sizeoffset (dr, zr, 0, diff);
+ filteroffsety += diff / 2;
+ }
+
+ diff = dr->right - dr->left;
+ filterxmult = diff * 1000 / (dst_width * scale);
+ diff = dr->bottom - dr->top;
+ filterymult = diff * 1000 / (dst_height * scale);
+ goto end;
+ }
+ }
+
+ if (!currprefs.gfx_filter_horiz_zoom_mult && !currprefs.gfx_filter_vert_zoom_mult) {
+
+ sizeoffset (dr, zr, extraw, extrah);
+
+ if (currprefs.gfx_filter_keep_aspect) {
+ float xm, ym, m;
+
+ xm = 1.0 * aws / dst_width;
+ ym = 1.0 * ahs / dst_height;
+ if (xm < ym)
+ xm = ym;
+ else
+ ym = xm;
+ xmult = ymult = xm * 1000.0;
+
+ m = (aws * 1.0 / dst_width) / (ahs * 1.0 / dst_height);
+ dstratio = dstratio * m;
+ }
+
+ }
+
+ if (currprefs.ntscmode) {
+ if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
+ dstratio = dstratio * 0.93;
+ else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
+ dstratio = dstratio * 0.98;
+ } else {
+ if (currprefs.gfx_filter_keep_aspect == 2 && ispal ())
+ dstratio = dstratio * 0.95;
+ else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ())
+ dstratio = dstratio * 0.95;
+ }
+
+ if (srcratio > dstratio) {
+ ymult = ymult * srcratio / dstratio;
+ } else {
+ xmult = xmult * dstratio / srcratio;
+ }
+
+ if (xmult <= 0.01)
+ xmult = aws * 1000 / dst_width;
+ else
+ xmult = xmult + xmult * currprefs.gfx_filter_horiz_zoom / 2000;
+ if (ymult <= 0.01)
+ ymult = ahs * 1000 / dst_height;
+ else
+ ymult = ymult + ymult * currprefs.gfx_filter_vert_zoom / 2000;
+
+ if (!currprefs.gfx_filter_horiz_zoom_mult && !currprefs.gfx_filter_vert_zoom_mult) {
+ if (currprefs.ntscmode) {
+ int v = vblscale2 (ahs);
+ ymult /= 1.21;
+ OffsetRect (dr, 0, (v - ahs2) / 2);
+ }
+ }
+
+
+ ymult = vblscale (ymult);
+ OffsetRect (dr, 0, (ahs2 - ahs) / 2);
+
+ v = currprefs.gfx_filter_horiz_offset;
+ OffsetRect (zr, (int)(-v * aws / 1000.0), 0);
+ v = currprefs.gfx_filter_vert_offset;
+ OffsetRect (zr, 0, (int)(-v * ahs / 1000.0));
+
+ xs = dst_width - dst_width * xmult / 1000;
+ ys = dst_height - dst_height * ymult / 1000;
+ sizeoffset (dr, zr, xs, ys);
+
+ filterxmult = xmult;
+ filterymult = ymult;
+ filteroffsetx += (dst_width - aw * 1000 / filterxmult) / 2;
+ filteroffsety += (dst_height - ah * 1000 / filterymult) / 2;
+
+end:
+ fpux_restore (&fpuv);
+
+}
+
+uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth)
+{
+
+ *widthp = 0;
+ *heightp = 0;
+ *depth = amiga_depth;
+ if (usedfilter == NULL)
+ return NULL;
+ *widthp = gfxvidinfo.width;
+ *heightp = gfxvidinfo.height;
+ if (pitch)
+ *pitch = gfxvidinfo.rowbytes;
+ *depth = gfxvidinfo.pixbytes * 8;
+ return gfxvidinfo.bufmem;
+#if 0
+ RECT dr, sr, zr;
+ uae_u8 *p;
+ int w, h;
+ if (usedfilter->type == UAE_FILTER_DIRECT3D) {
+ return getfilterbuffer3d (widthp, heightp, pitch, depth);
+ } else {
+ getfilterrect2 (&dr, &sr, &zr, dst_width, dst_height, amiga_width, amiga_height, scale, temp_width, temp_height);
+ }
+ w = sr.right - sr.left;
+ h = sr.bottom - sr.top;
+ p = gfxvidinfo.bufmem;
+ if (pitch)
+ *pitch = gfxvidinfo.rowbytes;
+ p += (zr.top - (h / 2)) * gfxvidinfo.rowbytes + (zr.left - (w / 2)) * amiga_depth / 8;
+ *widthp = w;
+ *heightp = h;
+ return p;
+#endif
+}
+
+static void statusline (void)
+{
+ DDSURFACEDESC2 desc;
+ RECT sr, dr;
+ int y;
+ int lx, ly, sx;
+
+ if (!(currprefs.leds_on_screen & STATUSLINE_CHIPSET) || !tempsurf)
+ return;
+ lx = dst_width;
+ ly = dst_height;
+ sx = lx;
+ if (sx > dst_width)
+ sx = dst_width;
+ SetRect (&sr, 0, 0, sx, TD_TOTAL_HEIGHT);
+ SetRect (&dr, lx - sx, ly - TD_TOTAL_HEIGHT, lx, ly);
+ DirectDraw_BlitRect (tempsurf, &sr, NULL, &dr);
+ if (locksurface (tempsurf, &desc)) {
+ for (y = 0; y < TD_TOTAL_HEIGHT; y++) {
+ uae_u8 *buf = (uae_u8*)desc.lpSurface + y * desc.lPitch;
+ draw_status_line_single (buf, dst_depth / 8, y, sx, rc, gc, bc, NULL);
+ }
+ unlocksurface (tempsurf);
+ DirectDraw_BlitRect (NULL, &dr, tempsurf, &sr);
+ }
+}
+
+void S2X_configure (int rb, int gb, int bb, int rs, int gs, int bs)
+{
+ Init_2xSaI (rb, gb, bb, rs, gs, bs);
+ hq_init (rb, gb, bb, rs, gs, bs);
+ PAL_init ();
+ bufmem_ptr = 0;
+}
+
+void S2X_free (void)
+{
+ changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen & ~STATUSLINE_TARGET;
+
+ freesurface (tempsurf);
+ tempsurf = 0;
+ xfree (tempsurf2);
+ tempsurf2 = 0;
+ xfree (tempsurf3);
+ tempsurf3 = 0;
+ filteroffsetx = 0;
+ filteroffsety = 0;
+ filterxmult = 1000;
+ filterymult = 1000;
+}
+
+void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd)
+{
+ int flags = 0;
+ int res_shift;
+
+ S2X_free ();
+ d3d = currprefs.gfx_api;
+ changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET;
+
+ if (d3d)
+ dd = ad;
+
+ if (dd == 32)
+ alloc_colors_rgb (8, 8, 8, 16, 8, 0, 0, 0, 0, 0, rc, gc, bc);
+ else
+ alloc_colors_rgb (5, 6, 5, 11, 5, 0, 0, 0, 0, 0, rc, gc, bc);
+
+
+ if (!currprefs.gfx_filter || !usedfilter) {
+ usedfilter = &uaefilters[0];
+ mult = 1;
+ } else if (mult) {
+ flags = usedfilter->x[mult];
+ if ((ad == 16 && !(flags & UAE_FILTER_MODE_16)) || (ad == 32 && !(flags & UAE_FILTER_MODE_32))) {
+ usedfilter = &uaefilters[0];
+ mult = 1;
+ changed_prefs.gfx_filter = usedfilter->type;
+ }
+ }
+
+ res_shift = RES_MAX - currprefs.gfx_resolution;
+ if (currprefs.gfx_xcenter_size > 0 && (currprefs.gfx_xcenter_size >> res_shift) < aw)
+ aw = currprefs.gfx_xcenter_size >> res_shift;
+ res_shift = currprefs.gfx_linedbl ? 0 : 1;
+ if (currprefs.gfx_ycenter_size > 0 && (currprefs.gfx_ycenter_size >> res_shift) < ah)
+ ah = currprefs.gfx_ycenter_size >> res_shift;
+
+ dst_width = dw;
+ dst_height = dh;
+ dst_depth = dd;
+ amiga_width = aw;
+ amiga_height = ah;
+ amiga_depth = ad;
+ scale = mult;
+
+ if (d3d) {
+ temp_width = dst_width * mult;
+ temp_height = dst_height * mult;
+ } else {
+ temp_width = dst_width * 3;
+ if (temp_width > dxcaps.maxwidth)
+ temp_width = dxcaps.maxwidth;
+ temp_height = dst_height * 3;
+ if (temp_height > dxcaps.maxheight)
+ temp_height = dxcaps.maxheight;
+ if (temp_width < dst_width)
+ temp_width = dst_width;
+ if (temp_height < dst_height)
+ temp_height = dst_height;
+ }
+
+ if (usedfilter->type == UAE_FILTER_HQ) {
+ int w = amiga_width > dst_width ? amiga_width : dst_width;
+ int h = amiga_height > dst_height ? amiga_height : dst_height;
+ tempsurf2 = xmalloc (uae_u8, w * h * (amiga_depth / 8) * ((scale + 1) / 2));
+ tempsurf3 = xmalloc (uae_u8, w * h *(dst_depth / 8) * 4 * scale);
+ if (!d3d)
+ tempsurf = allocsystemsurface (temp_width, temp_height);
+ } else {
+ if (!d3d)
+ tempsurf = allocsurface (temp_width, temp_height);
+ }
+ if (!tempsurf && !d3d)
+ write_log (L"DDRAW: failed to create temp surface (%dx%d)\n", temp_width, temp_height);
+
+}
+
+void S2X_render (void)
+{
+ int aw, ah, aws, ahs;
+ uae_u8 *dptr, *enddptr, *sptr, *endsptr;
+ int ok = 0;
+ RECT sr, dr, zr;
+ DDSURFACEDESC2 desc;
+ int pitch;
+ uae_u8 *surfstart;
+
+ aw = amiga_width;
+ ah = amiga_height;
+ aws = aw * scale;
+ ahs = ah * scale;
+
+ if (ah < 16)
+ return;
+ if (aw < 16)
+ return;
+
+ sptr = gfxvidinfo.bufmem;
+ endsptr = gfxvidinfo.bufmemend;
+ bufmem_ptr = sptr;
+
+ if (d3d) {
+ surfstart = D3D_locktexture (&pitch);
+ if (surfstart == NULL)
+ return;
+ } else {
+ if (tempsurf == NULL)
+ return;
+ if (cleartemp) {
+ clearsurface (tempsurf);
+ cleartemp = 0;
+ }
+ if (!locksurface (tempsurf, &desc))
+ return;
+ pitch = desc.lPitch;
+ surfstart = (uae_u8*)desc.lpSurface;
+ }
+ dptr = surfstart;
+ enddptr = dptr + pitch * temp_height;
+ if (!d3d) {
+ dptr = getfilterrect1 (&sr, &dr, dst_depth, aw, ah, scale, temp_width, temp_height, dptr, pitch);
+ }
+
+ if (!dptr) /* weird things can happen */
+ goto end;
+ if (dptr < surfstart)
+ dptr = surfstart;
+
+ if (usedfilter->type == UAE_FILTER_SCALE2X) { /* 16+32/2X */
+
+ if (amiga_depth == 16 && dst_depth == 16) {
+ AdMame2x (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ } else if (amiga_depth == 32 && dst_depth == 32) {
+ AdMame2x32 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ }
+
+ } else if (usedfilter->type == UAE_FILTER_HQ) { /* 32/2X+3X+4X */
+
+#ifndef CPU_64_BIT
+
+ if (tempsurf2 && scale >= 2 && scale <= 4) {
+ /* Aaaaaaaarghhhghgh.. */
+ uae_u8 *sptr2 = tempsurf3;
+ uae_u8 *dptr2 = tempsurf2;
+ int i;
+ for (i = 0; i < ah; i++) {
+ int w = aw * (amiga_depth / 8);
+ memcpy (dptr2, sptr, w);
+ dptr2 += w;
+ sptr += gfxvidinfo.rowbytes;
+ }
+ if (amiga_depth == 16 && dst_depth == 32) {
+ if (scale == 2)
+ hq2x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
+ else if (scale == 3)
+ hq3x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
+ else if (scale == 4)
+ hq4x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
+ ok = 1;
+ } else if (amiga_depth == 16 && dst_depth == 16) {
+ if (scale == 2)
+ hq2x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
+ else if (scale == 3)
+ hq3x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
+ else if (scale == 4)
+ hq4x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
+ ok = 1;
+ }
+ for (i = 0; i < ah * scale; i++) {
+ int w = aw * scale * (dst_depth / 8);
+ if (dptr + w > enddptr)
+ break;
+ memcpy (dptr, sptr2, w);
+ sptr2 += w;
+ dptr += pitch;
+ }
+ }
+#endif
+
+ } else if (usedfilter->type == UAE_FILTER_SUPEREAGLE) { /* 16/32/2X */
+
+ if (scale == 2 && amiga_depth == 16) {
+ if (dst_depth == 16) {
+ SuperEagle_16 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ } else if (dst_depth == 32) {
+ SuperEagle_32 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ }
+ }
+
+ } else if (usedfilter->type == UAE_FILTER_SUPER2XSAI) { /* 16/32/2X */
+
+ if (scale == 2 && amiga_depth == 16) {
+ if (dst_depth == 16) {
+ Super2xSaI_16 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ } else if (dst_depth == 32) {
+ Super2xSaI_32 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ }
+ }
+
+ } else if (usedfilter->type == UAE_FILTER_2XSAI) { /* 16/32/2X */
+
+ if (scale == 2 && amiga_depth == 16) {
+ if (dst_depth == 16) {
+ _2xSaI_16 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ } else if (dst_depth == 32) {
+ _2xSaI_32 (sptr, gfxvidinfo.rowbytes, dptr, pitch, aw, ah);
+ ok = 1;
+ }
+ }
+
+ } else if (usedfilter->type == UAE_FILTER_PAL) { /* 16/32/1X */
+
+ if (amiga_depth == 32 && dst_depth == 32) {
+ PAL_1x1_32 ((uae_u32*)sptr, gfxvidinfo.rowbytes, (uae_u32*)dptr, pitch, aw, ah);
+ ok = 1;
+ } else if (amiga_depth == 16 && dst_depth == 16) {
+ PAL_1x1_16 ((uae_u16*)sptr, gfxvidinfo.rowbytes, (uae_u16*)dptr, pitch, aw, ah);
+ ok = 1;
+ }
+
+ } else { /* null */
+
+ if (amiga_depth == dst_depth) {
+ int y;
+ for (y = 0; y < ah; y++) {
+ memcpy (dptr, sptr, aw * dst_depth / 8);
+ sptr += gfxvidinfo.rowbytes;
+ dptr += pitch;
+ }
+ }
+ ok = 1;
+
+ }
+
+ if (ok == 0 && currprefs.gfx_filter) {
+ usedfilter = &uaefilters[0];
+ changed_prefs.gfx_filter = usedfilter->type;
+ }
+
+end:
+ if (d3d) {
+ D3D_unlocktexture ();
+ } else {
+ unlocksurface (tempsurf);
+
+ getfilterrect2 (&dr, &sr, &zr, dst_width, dst_height, aw, ah, scale, temp_width, temp_height);
+ //write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n", dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
+ OffsetRect (&sr, zr.left, zr.top);
+ if (sr.left >= 0 && sr.top >= 0 && sr.right < temp_width && sr.bottom < temp_height) {
+ if (sr.left < sr.right && sr.top < sr.bottom)
+ DirectDraw_BlitRect (NULL, &dr, tempsurf, &sr);
+ }
+ statusline ();
+ }
+}
+
+void S2X_refresh (void)
+{
+ clearsurface (NULL);
+ S2X_render ();
+}
+
+int S2X_getmult (void)
+{
+ int j, i;
+
+ if (!usedfilter)
+ return 1;
+ j = 0;
+ for (i = 1; i <= 4; i++) {
+ if (usedfilter->x[i])
+ j++;
+ }
+ i = currprefs.gfx_filter_filtermode;
+ if (i >= j)
+ i = 0;
+ j = 0;
+ while (i >= 0) {
+ while (!usedfilter->x[j])
+ j++;
+ if(i-- > 0)
+ j++;
+ }
+ return j;
+}
+
+#endif
int initdone;
int fullfill;
int vsync;
- LPPALETTEENTRY pal;
};
struct MultiDisplay Displays[MAX_DISPLAYS];
currentmode->pitch = DirectDraw_GetSurfacePitch ();
DirectDraw_SurfaceUnlock ();
}
- if (bits <= 8)
- DirectDraw_CreatePalette (currentmode->pal);
}
write_log (L"set_ddraw: %dx%d@%d-bytes\n", width, height, bits);
ct = 1 << colortype;
depth = 0;
if (ct & RGBMASK_8BIT)
- depth = 8;
+ return DDENUMRET_OK;
else if (ct & RGBMASK_15BIT)
depth = 15;
else if (ct & RGBMASK_16BIT)
depth = 16;
else if (ct & RGBMASK_24BIT)
- depth = 24;
+ return DDENUMRET_OK;
else if (ct & RGBMASK_32BIT)
depth = 32;
if (depth == 0)
}
idx2++;
}
- if (!found) {
+ if (!found && dm.dmBitsPerPel > 8) {
int freq = 0;
#if 0
write_log (L"EnumDisplaySettings(%dx%dx%d %dHz %08x)\n",
ret = 1;
if (currentmode->flags & DM_D3D) {
#ifdef D3D
- int v;
- v = D3D_needreset ();
- if (v > 0)
- WIN32GFX_DisplayChangeRequested ();
- if (v >= 0)
- return 0;
if (currentmode->flags & DM_SWSCALE) {
ret = 1;
} else {
+ ret = 0;
gfxvidinfo.bufmem = D3D_locktexture (&gfxvidinfo.rowbytes);
if (gfxvidinfo.bufmem) {
init_row_map ();
}
}
-uae_u8 *gfx_lock_picasso (void)
-{
- if (!DirectDraw_SurfaceLock ())
- return 0;
- picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
- return DirectDraw_GetSurfacePointer ();
-}
-
/* For the DX_Invalidate() and gfx_unlock_picasso() functions */
static int p96_double_buffer_firstx, p96_double_buffer_lastx;
static int p96_double_buffer_first, p96_double_buffer_last;
}
}
+void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height)
+{
+ SetRect (sr, 0, 0, currentmode->native_width, currentmode->native_height);
+ SetRect (dr, 0, 0, picasso96_state.Width, picasso96_state.Height);
+ SetRect (zr, 0, 0, 0, 0);
+
+ picasso_offset_x = 0;
+ picasso_offset_y = 0;
+ picasso_offset_mx = 1000;
+ picasso_offset_my = 1000;
+
+ if (!scalepicasso)
+ return;
+
+ int srcratio, dstratio;
+ int srcwidth, srcheight;
+ srcwidth = picasso96_state.Width;
+ srcheight = picasso96_state.Height;
+ if (currprefs.win32_rtgscaleaspectratio < 0) {
+ // automatic
+ srcratio = picasso96_state.Width * 256 / picasso96_state.Height;
+ dstratio = currentmode->native_width * 256 / currentmode->native_height;
+ } else if (currprefs.win32_rtgscaleaspectratio == 0) {
+ // none
+ srcratio = dstratio = 0;
+ } else {
+ // manual
+ dstratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff);
+ srcratio = srcwidth * 256 / srcheight;
+ }
+ if (srcratio == dstratio) {
+ SetRect (dr, 0, 0, srcwidth, srcheight);
+ } else if (srcratio > dstratio) {
+ int yy = picasso96_state.Height * srcratio / dstratio;
+ SetRect (dr, 0, 0, picasso96_state.Width, yy);
+ picasso_offset_y = (picasso96_state.Height - yy) / 2;
+ } else {
+ int xx = picasso96_state.Width * dstratio / srcratio;
+ SetRect (dr, 0, 0, xx, picasso96_state.Height);
+ picasso_offset_x = (picasso96_state.Width - xx) / 2;
+ }
+ OffsetRect (zr, picasso_offset_x, picasso_offset_y);
+ picasso_offset_mx = picasso96_state.Width * 1000 / (dr->right - dr->left);
+ picasso_offset_my = picasso96_state.Height * 1000 / (dr->bottom - dr->top);
+}
+
+uae_u8 *gfx_lock_picasso (void)
+{
+ if (currprefs.gfx_api) {
+ int pitch;
+ uae_u8 *p = D3D_locktexture (&pitch);
+ picasso_vidinfo.rowbytes = pitch;
+ return p;
+ } else {
+ if (!DirectDraw_SurfaceLock ())
+ return 0;
+ picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
+ return DirectDraw_GetSurfacePointer ();
+ }
+}
+
void gfx_unlock_picasso (void)
{
- DirectDraw_SurfaceUnlock ();
- if (p96_double_buffer_needs_flushing) {
- if (scalepicasso) {
- p96_double_buffer_firstx = 0;
- p96_double_buffer_lastx = picasso96_state.Width;
- p96_double_buffer_first = 0;
- p96_double_buffer_last = picasso96_state.Height;
+ if (currprefs.gfx_api) {
+ D3D_unlocktexture ();
+ } else {
+ DirectDraw_SurfaceUnlock ();
+ if (p96_double_buffer_needs_flushing) {
+ DX_Blit96 (p96_double_buffer_firstx, p96_double_buffer_first,
+ p96_double_buffer_lastx - p96_double_buffer_firstx + 1,
+ p96_double_buffer_last - p96_double_buffer_first + 1);
+ p96_double_buffer_needs_flushing = 0;
}
- picasso_putcursor (p96_double_buffer_firstx, p96_double_buffer_first,
- p96_double_buffer_lastx - p96_double_buffer_firstx + 1, p96_double_buffer_last - p96_double_buffer_first + 1);
- DX_Blit96 (p96_double_buffer_firstx, p96_double_buffer_first,
- p96_double_buffer_lastx - p96_double_buffer_firstx + 1,
- p96_double_buffer_last - p96_double_buffer_first + 1);
- picasso_clearcursor ();
- p96_double_buffer_needs_flushing = 0;
}
}
}
if (hAmigaWnd) {
addnotifications (hAmigaWnd, TRUE, FALSE);
-#ifdef OPENGL
- OGL_free ();
-#endif
#ifdef D3D
D3D_free ();
#endif
}
}
#endif
- if (!screen_is_picasso) {
- if (currprefs.gfx_api) {
- flags |= DM_D3D;
- if (flags & DM_DX_FULLSCREEN) {
- flags &= ~DM_DX_FULLSCREEN;
- flags |= DM_D3D_FULLSCREEN;
- }
- flags &= ~DM_DDRAW;
+ if (currprefs.gfx_api) {
+ flags |= DM_D3D;
+ if (flags & DM_DX_FULLSCREEN) {
+ flags &= ~DM_DX_FULLSCREEN;
+ flags |= DM_D3D_FULLSCREEN;
}
- }
+ flags &= ~DM_DDRAW;
+ }
currentmode->flags = flags;
if (flags & DM_SWSCALE)
currentmode->fullfill = 1;
- if (useoverlay && currentmode->current_depth > 16)
- currentmode->current_depth = 16;
if (flags & DM_W_FULLSCREEN) {
RECT rc = getdisplay (&currprefs)->rect;
currentmode->native_width = rc.right - rc.left;
#ifdef PICASSO96
}
#endif
- currentmode->current_depth = (currprefs.color_mode == 0 ? 8
- : currprefs.color_mode == 1 ? 15
- : currprefs.color_mode == 2 ? 16
- : currprefs.color_mode == 3 ? 8
- : currprefs.color_mode == 4 ? 8 : 32);
+ currentmode->current_depth = currprefs.color_mode == 1 ? 15
+ : currprefs.color_mode == 2 ? 16 : 32;
if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) {
int pbits = picasso96_state.BytesPerPixel * 8;
if (pbits == 24)
pbits = 32;
- if (pbits >= 8)
- currentmode->current_depth = pbits;
+ currentmode->current_depth = pbits;
}
- if (useoverlay && currentmode->current_depth > 16)
- currentmode->current_depth = 16;
currentmode->amiga_width = currentmode->current_width;
currentmode->amiga_height = currentmode->current_height;
{
int c = 0;
+ if (!config_changed)
+ return 0;
+
c |= currprefs.gfx_size_fs.width != changed_prefs.gfx_size_fs.width ? 16 : 0;
c |= currprefs.gfx_size_fs.height != changed_prefs.gfx_size_fs.height ? 16 : 0;
c |= ((currprefs.gfx_size_win.width + 7) & ~7) != ((changed_prefs.gfx_size_win.width + 7) & ~7) ? 16 : 0;
/* Color management */
static xcolnr xcol8[4096];
-static PALETTEENTRY colors256[256];
-static int ncols256 = 0;
static int red_bits, green_bits, blue_bits, alpha_bits;
static int red_shift, green_shift, blue_shift, alpha_shift;
static int x_red_shift, x_green_shift, x_blue_shift, x_alpha_shift;
static int alpha;
-static int get_color (int r, int g, int b, xcolnr * cnp)
-{
- if (ncols256 == 256)
- return 0;
- colors256[ncols256].peRed = r * 0x11;
- colors256[ncols256].peGreen = g * 0x11;
- colors256[ncols256].peBlue = b * 0x11;
- colors256[ncols256].peFlags = 0;
- *cnp = ncols256;
- ncols256++;
- return 1;
-}
-
void init_colors (void)
{
- if (ncols256 == 0) {
- alloc_colors256 (get_color);
- memcpy (xcol8, xcolors, sizeof xcol8);
- }
-
/* init colors */
- switch(currentmode->current_depth >> 3)
+ switch(currentmode->current_depth / 8)
{
case 1:
- memcpy (xcolors, xcol8, sizeof xcolors);
- DirectDraw_SetPaletteEntries (0, 256, colors256);
break;
case 2:
case 3:
alpha_shift = x_alpha_shift;
}
- if (currentmode->current_depth > 8) {
- if (!(currentmode->flags & (DM_OPENGL|DM_D3D))) {
- if (currentmode->current_depth != currentmode->native_depth) {
- if (currentmode->current_depth == 16) {
- red_bits = 5; green_bits = 6; blue_bits = 5;
- red_shift = 11; green_shift = 5; blue_shift = 0;
- } else {
- red_bits = green_bits = blue_bits = 8;
- red_shift = 16; green_shift = 8; blue_shift = 0;
- }
+ if (!(currentmode->flags & (DM_OPENGL|DM_D3D))) {
+ if (currentmode->current_depth != currentmode->native_depth) {
+ if (currentmode->current_depth == 16) {
+ red_bits = 5; green_bits = 6; blue_bits = 5;
+ red_shift = 11; green_shift = 5; blue_shift = 0;
+ } else {
+ red_bits = green_bits = blue_bits = 8;
+ red_shift = 16; green_shift = 8; blue_shift = 0;
}
}
- alloc_colors64k (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0);
- notice_new_xcolors ();
+ }
+ alloc_colors64k (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0);
+ notice_new_xcolors ();
#ifdef GFXFILTER
- S2X_configure (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift);
+ S2X_configure (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift);
#endif
#ifdef AVIOUTPUT
- AVIOutput_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
+ AVIOutput_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
#endif
- Screenshot_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
- }
+ Screenshot_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
}
#ifdef PICASSO96
-void DX_SetPalette_vsync (void)
-{
-}
int picasso_palette (void)
{
int b = picasso96_state.CLUT[i].Blue;
uae_u32 v = (doMask256 (r, red_bits, red_shift)
| doMask256 (g, green_bits, green_shift)
- | doMask256 (b, blue_bits, blue_shift));
+ | doMask256 (b, blue_bits, blue_shift))
+ | doMask256 (0xff, alpha_bits, alpha_shift);
if (v != picasso_vidinfo.clut[i]) {
picasso_vidinfo.clut[i] = v;
changed = 1;
}
}
- if (changed)
- DX_SetPalette (0,256);
return changed;
}
-void DX_SetPalette (int start, int count)
-{
- if (!screen_is_picasso)
- return;
- if (picasso_vidinfo.pixbytes != 1)
- return;
- if(currentmode->current_depth > 8)
- return;
- if (SUCCEEDED (DirectDraw_SetPalette (0)))
- DirectDraw_SetPaletteEntries (start, count, (LPPALETTEENTRY)&(picasso96_state.CLUT[start]));
-}
-
void DX_Invalidate (int x, int y, int width, int height)
{
int last, lastx;
{
close_windows ();
open_windows (1);
-#ifdef PICASSO96
- DX_SetPalette (0, 256);
-#endif
}
static int ifs (struct uae_prefs *p)
currprefs.gfx_avsync = changed_prefs.gfx_avsync;
currprefs.gfx_pvsync = changed_prefs.gfx_pvsync;
currprefs.gfx_refreshrate = changed_prefs.gfx_refreshrate;
+ config_changed = 1;
if (!quick)
return 1;
changed_prefs.gfx_refreshrate = hz;
write_log (L"refresh rate changed to %d, new screenmode %dx%d\n", hz, w, newh);
}
+ config_changed = 1;
reopen (1);
return 0;
}
{
int cnt, ret;
- if (picasso_on)
- currentmode->pal = (LPPALETTEENTRY) & picasso96_state.CLUT;
- else
- currentmode->pal = colors256;
-
cnt = 3;
for (;;) {
ret = set_ddraw_2 ();
if (colortype == RGBFB_NONE) {
fs_warning = IDS_UNSUPPORTEDSCREENMODE_1;
- } else if (colortype == RGBFB_CLUT && DirectDraw_GetCurrentDepth () != 8) {
+ } else if (colortype == RGBFB_CLUT) {
fs_warning = IDS_UNSUPPORTEDSCREENMODE_2;
} else if (currentmode->current_width > GetSystemMetrics(SM_CXVIRTUALSCREEN) ||
currentmode->current_height > GetSystemMetrics(SM_CYVIRTUALSCREEN)) {
}
#ifdef PICASSO96
- picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
- picasso_vidinfo.pixbytes = DirectDraw_GetBytesPerPixel ();
- picasso_vidinfo.rgbformat = DirectDraw_GetPixelFormat ();
+ picasso_vidinfo.rowbytes = 0;
+ picasso_vidinfo.pixbytes = currentmode->current_depth / 8;
+ picasso_vidinfo.rgbformat = 0;
picasso_vidinfo.extra_mem = 1;
picasso_vidinfo.height = currentmode->current_height;
picasso_vidinfo.width = currentmode->current_width;
gfxvidinfo.realbufmem = NULL;
gfxvidinfo.bufmem = NULL;
- if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE | DM_OPENGL))) {
+ if (!screen_is_picasso) {
+ if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE | DM_OPENGL))) {
- ;
+ ;
- } else if (currentmode->flags & DM_SWSCALE) {
+ } else if (currentmode->flags & DM_SWSCALE) {
- int w = currentmode->amiga_width * 2;
- int h = currentmode->amiga_height * 2;
- int size = (w * 2) * (h * 3) * gfxvidinfo.pixbytes;
- gfxvidinfo.realbufmem = xmalloc (uae_u8, size);
- memset (gfxvidinfo.realbufmem, 0, size);
- gfxvidinfo.bufmem = gfxvidinfo.realbufmem + (w + (w * 2) * h) * gfxvidinfo.pixbytes;
- gfxvidinfo.rowbytes = w * 2 * gfxvidinfo.pixbytes;
- gfxvidinfo.bufmemend = gfxvidinfo.realbufmem + size - gfxvidinfo.rowbytes;
+ int w = currentmode->amiga_width * 2;
+ int h = currentmode->amiga_height * 2;
+ int size = (w * 2) * (h * 3) * gfxvidinfo.pixbytes;
+ gfxvidinfo.realbufmem = xmalloc (uae_u8, size);
+ memset (gfxvidinfo.realbufmem, 0, size);
+ gfxvidinfo.bufmem = gfxvidinfo.realbufmem + (w + (w * 2) * h) * gfxvidinfo.pixbytes;
+ gfxvidinfo.rowbytes = w * 2 * gfxvidinfo.pixbytes;
+ gfxvidinfo.bufmemend = gfxvidinfo.realbufmem + size - gfxvidinfo.rowbytes;
- } else if (currentmode->flags & DM_D3D) {
+ } else if (currentmode->flags & DM_D3D) {
- int size = currentmode->amiga_width * currentmode->amiga_height * gfxvidinfo.pixbytes;
- gfxvidinfo.realbufmem = xmalloc (uae_u8, size);
- gfxvidinfo.bufmem = gfxvidinfo.realbufmem;
- gfxvidinfo.rowbytes = currentmode->amiga_width * gfxvidinfo.pixbytes;
- gfxvidinfo.bufmemend = gfxvidinfo.bufmem + size;
+ int size = currentmode->amiga_width * currentmode->amiga_height * gfxvidinfo.pixbytes;
+ gfxvidinfo.realbufmem = xmalloc (uae_u8, size);
+ gfxvidinfo.bufmem = gfxvidinfo.realbufmem;
+ gfxvidinfo.rowbytes = currentmode->amiga_width * gfxvidinfo.pixbytes;
+ gfxvidinfo.bufmemend = gfxvidinfo.bufmem + size;
+ }
+ init_row_map ();
+ init_colors ();
}
- init_row_map ();
- init_colors ();
#if defined (GFXFILTER)
S2X_free ();
- if ((currentmode->flags & DM_SWSCALE) && !WIN32GFX_IsPicassoScreen ()) {
+ if (currentmode->flags & DM_SWSCALE) {
S2X_init (currentmode->native_width, currentmode->native_height,
currentmode->amiga_width, currentmode->amiga_height,
mult, currentmode->current_depth, currentmode->native_depth);
}
-#if defined OPENGL
- if (currentmode->flags & DM_OPENGL) {
- const TCHAR *err = OGL_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
- currentmode->amiga_width, currentmode->amiga_height, currentmode->current_depth);
- if (err) {
- OGL_free ();
- if (err[0] != '*') {
- gui_message (err);
- changed_prefs.gfx_filter = currprefs.gfx_filter = 0;
- }
- currentmode->current_depth = currentmode->native_depth;
- gfxmode_reset ();
- ret = -1;
- goto oops;
- }
- }
-#endif
#ifdef D3D
if (currentmode->flags & DM_D3D) {
const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
#endif
#endif
screen_is_initialized = 1;
- WIN32GFX_SetPalette ();
-#ifdef PICASSO96
- DX_SetPalette (0, 256);
-#endif
picasso_refresh ();
if (isfullscreen () > 0)
return ret;
}
-
-void WIN32GFX_PaletteChange (void)
-{
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
- return;
- if (currentmode->current_depth > 8)
- return;
- DirectDraw_SetPalette (1); /* Remove current palette */
- DirectDraw_SetPalette (0); /* Set our real palette */
-}
-
-int WIN32GFX_ClearPalette (void)
-{
- if (currentmode->current_depth > 8)
- return 1;
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
- return 1;
- DirectDraw_SetPalette (1); /* Remove palette */
- return 1;
-}
-
-int WIN32GFX_SetPalette (void)
-{
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
- return 1;
- if (currentmode->current_depth > 8)
- return 1;
- DirectDraw_SetPalette (0); /* Set palette */
- return 1;
-}
void WIN32GFX_WindowMove (void)
{
}
displayGUID = &md->guid;
if (isfullscreen () == 0)
displayGUID = NULL;
+ config_changed = 1;
}
void toggle_fullscreen (void)
void WIN32GFX_ToggleFullScreen (void);
void WIN32GFX_DisablePicasso (void);
void WIN32GFX_EnablePicasso (void);
-void WIN32GFX_PaletteChange (void);
-int WIN32GFX_ClearPalette (void);
-int WIN32GFX_SetPalette (void);
void WIN32GFX_WindowMove (void);
void WIN32GFX_WindowSize (void);;
void DX_Invalidate (int x, int y, int width, int height);
scaleresource_setmaxsize (-1, -1);
if (w > 0 && h > 0)
scaleresource_setmaxsize (w, h);
- WIN32GFX_ClearPalette ();
manual_painting_needed++; /* So that WM_PAINT will refresh the display */
if (isfullscreen () > 0) {
savestate_state = STATE_DORESTORE;
}
manual_painting_needed--; /* So that WM_PAINT doesn't need to use custom refreshing */
- manual_palette_refresh_needed = 1;
resumepaused (9);
inputdevice_copyconfig (&changed_prefs, &currprefs);
inputdevice_config_change_test ();
AVIOutput_Begin ();
#endif
fpscounter_reset ();
- WIN32GFX_SetPalette ();
-#ifdef PICASSO96
- DX_SetPalette (0, 256);
-#endif
screenshot_free ();
write_disk_history ();
gui_active--;
ew (hDlg, IDC_STATE_CAPTURE, FALSE);
ew (hDlg, IDC_STATE_RATE, FALSE);
ew (hDlg, IDC_STATE_BUFFERSIZE, FALSE);
- ew (hDlg, IDC_LANGUAGE, FALSE);
} else {
#if !defined (SCSIEMU)
EnableWindow (GetDlgItem(hDlg, IDC_SCSIMODE), TRUE);
ew (hDlg, IDC_ASSOCIATELIST, !rp_isactive ());
ew (hDlg, IDC_ASSOCIATE_ON, !rp_isactive ());
ew (hDlg, IDC_ASSOCIATE_OFF, !rp_isactive ());
+ ew (hDlg, IDC_DD_SURFACETYPE, workprefs.gfx_api == 0);
}
static void misc_kbled (HWND hDlg, int v, int nv)
misc_scsi (hDlg);
misc_lang (hDlg);
+ SendDlgItemMessage (hDlg, IDC_DXMODE, CB_RESETCONTENT, 0, 0);
+ SendDlgItemMessage (hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)L"DirectDraw");
+ SendDlgItemMessage (hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)L"Direct3D");
+ SendDlgItemMessage (hDlg, IDC_DXMODE, CB_SETCURSEL, workprefs.gfx_api, 0);
+
SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"NonLocalVRAM");
SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"DefaultRAM *");
misc_setlang(v);
}
break;
+ case IDC_DXMODE:
+ v = SendDlgItemMessage (hDlg, IDC_DXMODE, CB_GETCURSEL, 0, 0L);
+ if (v != CB_ERR)
+ workprefs.gfx_api = v;
+ break;
case IDC_DD_SURFACETYPE:
v = SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR) {
static void enable_for_cpudlg (HWND hDlg)
{
- BOOL enable = FALSE;
+ BOOL enable = FALSE, jitenable = FALSE;
BOOL cpu_based_enable = FALSE;
BOOL fpu;
cpu_based_enable = workprefs.cpu_model >= 68020 &&
workprefs.address_space_24 == 0;
- enable = cpu_based_enable && workprefs.cachesize;
+ jitenable = cpu_based_enable;
#ifndef JIT
- enable = FALSE;
+ jitenable = FALSE;
#endif
+ enable = jitenable && workprefs.cachesize;
ew (hDlg, IDC_TRUST0, enable);
ew (hDlg, IDC_TRUST1, enable);
ew (hDlg, IDC_NOFLAGS, enable);
ew (hDlg, IDC_CS_CACHE_TEXT, enable);
ew (hDlg, IDC_CACHE, enable);
- ew (hDlg, IDC_JITENABLE, cpu_based_enable && enable);
+ ew (hDlg, IDC_JITENABLE, jitenable);
ew (hDlg, IDC_COMPATIBLE, !workprefs.cpu_cycle_exact && !workprefs.cachesize);
ew (hDlg, IDC_COMPATIBLE_FPU, workprefs.fpu_model > 0);
#if 0
ew (hDlg, IDC_FILTERKEEPASPECT, v);
ew (hDlg, IDC_FILTERASPECT, v);
ew (hDlg, IDC_FILTERASPECT2, v && workprefs.gfx_filter_keep_aspect);
- ew (hDlg, IDC_FILTEROVERLAY, workprefs.gfx_api && !workprefs.gfx_filtershader[0]);
+ ew (hDlg, IDC_FILTEROVERLAY, workprefs.gfx_api);
ew (hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0);
ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0);
(workprefs.gfx_filter_aspect == 16 * 256 + 10) ? 6 : 0, 0);
CheckDlgButton (hDlg, IDC_FILTERKEEPASPECT, workprefs.gfx_filter_keep_aspect);
- CheckDlgButton (hDlg, IDC_FILTERD3D, workprefs.gfx_api);
SendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_SETCURSEL,
workprefs.gfx_filter_keep_aspect, 0);
j++;
i++;
}
- if (D3D_canshaders () && workprefs.gfx_api) {
+ if (workprefs.gfx_api && D3D_canshaders ()) {
HANDLE h;
WIN32_FIND_DATA wfd;
TCHAR tmp[MAX_DPATH];
- _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\*.fx", start_path_exe, WIN32_PLUGINDIR);
+ _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\*.fx", start_path_data, WIN32_PLUGINDIR);
h = FindFirstFile (tmp, &wfd);
while (h != INVALID_HANDLE_VALUE) {
- TCHAR tmp2[100];
- _stprintf (tmp2, L"D3D: %s", wfd.cFileName);
- tmp2[_tcslen (tmp2) - 3] = 0;
- SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)tmp2);
- if (workprefs.gfx_api && !_tcscmp (workprefs.gfx_filtershader, wfd.cFileName))
- fltnum = j;
- j++;
+ if (_tcsicmp (wfd.cFileName, L"winuae.fx") && _tcsicmp (wfd.cFileName, L"winuae_old.fx")) {
+ TCHAR tmp2[100];
+ _stprintf (tmp2, L"D3D: %s", wfd.cFileName);
+ tmp2[_tcslen (tmp2) - 3] = 0;
+ SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)tmp2);
+ if (workprefs.gfx_api && !_tcscmp (workprefs.gfx_filtershader, wfd.cFileName))
+ fltnum = j;
+ j++;
+ }
if (!FindNextFile (h, &wfd)) {
FindClose (h);
h = INVALID_HANDLE_VALUE;
}
}
- _stprintf (tmp, L"%s%soverlays\\*.*", start_path_exe, WIN32_PLUGINDIR);
+ }
+ if (workprefs.gfx_api && D3D_goodenough ()) {
+ HANDLE h;
+ WIN32_FIND_DATA wfd;
+ TCHAR tmp[MAX_DPATH];
+ _stprintf (tmp, L"%s%soverlays\\*.*", start_path_data, WIN32_PLUGINDIR);
h = FindFirstFile (tmp, &wfd);
i = 0; j = 1;
while (h != INVALID_HANDLE_VALUE) {
filter_preset (hDlg, wParam);
recursive++;
break;
- case IDC_FILTERD3D:
- workprefs.gfx_api = IsDlgButtonChecked (hDlg, IDC_FILTERD3D) ? 1 : 0;
- enable_for_hw3ddlg (hDlg);
- values_to_hw3ddlg (hDlg);
- break;
case IDC_FILTERKEEPASPECT:
{
if (IsDlgButtonChecked (hDlg, IDC_FILTERKEEPASPECT))
}
}
DragFinish (hd);
+ config_changed = 1;
return ret;
}
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include,..\tun"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO"
+ PreprocessorDefinitions="WINVER=0x0500;_DEBUG;WIN32_IE=0x0700;WIN32;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO"
GeneratePreprocessedFile="0"
KeepComments="false"
ExceptionHandling="0"
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include,..\tun"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO"
+ PreprocessorDefinitions="WINVER=0x0500;_DEBUG;WIN32_IE=0x0700;WIN32;WIN64;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include"
- PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include"
- PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
>
</File>
<File
- RelativePath="..\resources\configfile.ico"
+ RelativePath=".\configfile.ico"
>
</File>
<File
- RelativePath=".\configfile.ico"
+ RelativePath="..\resources\configfile.ico"
>
</File>
<File
>
</File>
<File
- RelativePath="..\resources\expansion.ico"
+ RelativePath=".\expansion.ico"
>
</File>
<File
- RelativePath=".\expansion.ico"
+ RelativePath="..\resources\expansion.ico"
>
</File>
<File
- RelativePath="..\resources\file.ico"
+ RelativePath=".\file.ico"
>
</File>
<File
- RelativePath=".\file.ico"
+ RelativePath="..\resources\file.ico"
>
</File>
<File
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">d:\amiga\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
- <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</GenerateManifest>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">d:\amiga\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">d:\amiga\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
<IntDir Condition="'$(Configuration)|$(Platform)'=='FullRelease|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='FullRelease|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='FullRelease|Win32'">true</GenerateManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">d:\amiga\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">false</LinkIncremental>
- <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">false</GenerateManifest>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">true</GenerateManifest>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='FullRelease|x64'">winuae64</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">winuae64</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">winuae64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<EnablePREfast>false</EnablePREfast>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;libpng.lib;lglcd.lib;wpcap.lib;packet.lib;openal32.lib;wintab32.lib;portaudio_x86.lib;freetype.lib;vfw32.lib;wtsapi32.lib;enet.lib;prowizard.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9d.lib;winio.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;libpng.lib;lglcd.lib;wpcap.lib;packet.lib;openal32.lib;wintab32.lib;portaudio_x86.lib;freetype.lib;vfw32.lib;wtsapi32.lib;enet.lib;prowizard.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>d:\amiga\winuae.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<SubSystem>Windows</SubSystem>
<StackReserveSize>2621440</StackReserveSize>
<StackCommitSize>2621440</StackCommitSize>
- <LargeAddressAware>true</LargeAddressAware>
+ <LargeAddressAware>false</LargeAddressAware>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;..\tun;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WINVER=0x0500;_DEBUG;WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WINVER=0x0500;_DEBUG;WIN32_IE=0x0700;WIN32;WIN64;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeaderOutputFile>.\Debug64/winuae_msvc.pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
- <ObjectFileName>.\Debug/</ObjectFileName>
- <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+ <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)\winuae_msvc.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation>
+ <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName>
+ <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>.\Debug/winuae.pdb</ProgramDatabaseFile>
+ <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<StackReserveSize>2621440</StackReserveSize>
<StackCommitSize>2621440</StackCommitSize>
<SubSystem>Windows</SubSystem>
<StackReserveSize>2621440</StackReserveSize>
<StackCommitSize>2621440</StackCommitSize>
- <LargeAddressAware>true</LargeAddressAware>
+ <LargeAddressAware>false</LargeAddressAware>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>
<FixedBaseAddress>false</FixedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
+ <MinimumRequiredVersion>5</MinimumRequiredVersion>
</Link>
<Manifest>
<AdditionalManifestFiles>..\resources\winuae.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
- <PrecompiledHeaderOutputFile>.\Release/winuae_msvc.pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
- <ObjectFileName>.\Release/</ObjectFileName>
- <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+ <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)/winuae_msvc.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation>
+ <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName>
+ <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CallingConvention>StdCall</CallingConvention>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>.\Release/winuae.pdb</ProgramDatabaseFile>
+ <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<StackReserveSize>0</StackReserveSize>
<StackCommitSize>0</StackCommitSize>
<SubSystem>Windows</SubSystem>
<StackReserveSize>2621440</StackReserveSize>
<StackCommitSize>2621440</StackCommitSize>
- <LargeAddressAware>true</LargeAddressAware>
+ <LargeAddressAware>false</LargeAddressAware>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<FixedBaseAddress>false</FixedBaseAddress>
<DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
+ <MinimumRequiredVersion>5</MinimumRequiredVersion>
</Link>
<Manifest>
<AdditionalManifestFiles>..\resources\winuae9.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;CINTERFACE;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
- <PrecompiledHeaderOutputFile>.\FullRelease/winuae_msvc.pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\FullRelease/</AssemblerListingLocation>
- <ObjectFileName>.\FullRelease/</ObjectFileName>
- <ProgramDataBaseFileName>.\FullRelease/</ProgramDataBaseFileName>
+ <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)\winuae_msvc.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation>
+ <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName>
+ <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CallingConvention>StdCall</CallingConvention>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>.\FullRelease/winuae.pdb</ProgramDatabaseFile>
+ <ProgramDatabaseFile>$(Platform)\$(Configuration)\winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<StackReserveSize>0</StackReserveSize>
<StackCommitSize>0</StackCommitSize>
<ClCompile Include="..\sounddep\sound.cpp" />
<ClCompile Include="..\unicode.cpp" />
<ClCompile Include="..\win32.cpp" />
- <ClCompile Include="..\win32_scale2x.cpp" />
+ <ClCompile Include="..\win32_scaler.cpp" />
<ClCompile Include="..\win32_uaenet.cpp" />
<ClCompile Include="..\win32gfx.cpp" />
<ClCompile Include="..\win32gui.cpp" />
<ClCompile Include="..\win32.cpp">
<Filter>win32</Filter>
</ClCompile>
- <ClCompile Include="..\win32_scale2x.cpp">
- <Filter>win32</Filter>
- </ClCompile>
<ClCompile Include="..\win32_uaenet.cpp">
<Filter>win32</Filter>
</ClCompile>
<ClCompile Include="..\..\archivers\wrp\warp.cpp">
<Filter>decompressors\wrp</Filter>
</ClCompile>
+ <ClCompile Include="..\win32_scaler.cpp">
+ <Filter>win32</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\resources\35floppy.ico">
+- version bumped to 2.1.0
+- 1620b10 broke 68020 RTE "Throwaway frame" emulation (Quik The Thunder Rabbit CD32)
+- warp mode on the fly change fixed
+- only check for configuration file changes (current vs changed) when needed, not
+ every frame (some on the fly changes may be missed now, report if found)
+- b12 "no scaling" in directdraw was wrong, scaling isn't going to be removed.
+- blurry D3D RTG hardware mouse cursor fixed
+
+Beta 12:
+
+- VPOSW/VHPOSW "fake" 60Hz support rewrite, ugly hacks removed, this also
+ fixes possible odd/even field mismatch when program initializes interlace
+ by writing to VPOSW (only clearing or setting LOF-bit, not attempting to
+ do "fake 60Hz)
+- JIT checkbox fixed (broke during 64-bit compilation fixes)
+- Prowizard PM20 fix (Asle)
+
+Big Direct3D change:
+
+- more gfx subsystem unification. Direct3D is now fully shader based.
+ Overlay and scanlines are done with pixel shaders, also overlay is not scaled anymore.
+ Overlay and pixel shader filters are now compatible.
+ PS 2.0 capable display card required. (PS 1.0 should also work)
+ Scanlines and overlays can't be used simultaneously. (Easy to do with shaders but why?)
+ Horiz and vert positioning works without filter enabled.
+ Point/bilinear setting works now when shader filter is enabled.
+ Direct3D and Null filter: wastes only CPU power, do not use. (will be fixed later)
+ Currently included winuae.fx/winuae_old.fx must be in same directory as winuae or in shaderfilters
+ directory (later it will be built-in. winuae_old.fx = PS1.x compatible shader)
+ If you have problems: include graphics card model, Windows version, winuaebootlog.txt and winuaelog.txt.
+- RTG D3D changes: full Direct3D mode support, hardware sprite is D3DSprite.
+ DirectDraw still supported but only in basic mode (no hardware cursor, no scaling etc..)
+ Direct3D is so much simpler and easier (automatic scaling, transparency, clipping)
+ Currently D3D scanlines and overlays are also applied to D3D RTG screens which may not be what you want...
+
+- NOTE: some older cards or drivers seem to have random problems that come and go between restarts, configuration
+ changes etc.. Report Windows version, card name and driver version when this happens. (when this happens there
+ are no error messages in the log and only on screen leds are visible, it is some other problem if error was logged)
+
+- removed paletted (256 color) mode support completely (no functional changes because native modes haven't supported
+ it for ages and RTG modes have used 16/32-bit modes and transparent color space remapping since 1.6)
+- Direct3D selection moved to misc panel (D3D isn't filter specific anymore)
+
Beta 11:
- hpos "offset" was accidentally changed (DFF006 = 0000 is possible)
-/* 20091113 - fixed patternlist generation and cleaned a bit */
/* testPM2() */
Save_Rip ( "Promizer 2.0 module", Promizer_20 );
if ( Save_Status == GOOD )
- PW_i += (OutputSize - 2); /* 1 should do but call it "just to be sure" :) */
+ PW_i += 2; /* 1 should do but call it "just to be sure" :) */
}
* update 20 mar 2003 (it's war time again .. brrrr)
* - removed all open() funcs.
* - optimized more than quite a bit (src 4kb shorter !)
+ *
+ * update 20091113
+ * - fixed patternlist generation and cleaned a bit
+ *
+ * update 20100212-20100216
+ * - fixed endless loop bug (used PW_i instead of i ...)
+ * - correct conversion when there's unused patterns stored .. they are kept ;)
*/
#define ON 0
{
//Uchar c1=0x00;
short Ref_Max=0;
- long Pats_Address[128];
+ long Pats_Address[128],Pats_Address_infile[128];
Uchar NOP=0x00; /* number of pattern */
Uchar *ReferenceTable;
Uchar *Pattern;
- //long i=0,j=0,k=0,m=0;
+ long i=0,j;
long Total_Sample_Size=0;
long PatDataSize=0l;
//long SDAV=0l;
/*info = fopen ( "info", "w+b");*/
BZERO ( Pats_Address , 128*4 );
+ BZERO ( Pats_Address_infile , 128*4 );
Whatever = (Uchar *) malloc (1085);
BZERO (Whatever, 1085);
/* bypass replaycode routine */
Where += SAMPLE_DESC;
- for ( PW_i=0 ; PW_i<31 ; PW_i++ )
+ for ( i=0 ; i<31 ; i++ )
{
- Whatever[PW_i*30+42] = in_data[Where];
- Whatever[PW_i*30+43] = in_data[Where+1];
- Total_Sample_Size += (((Whatever[PW_i*30+42]*256)+Whatever[PW_i*30+43])*2);
- Whatever[PW_i*30+44] = in_data[Where+2]/2;
- Whatever[PW_i*30+45] = in_data[Where+3];
- Whatever[PW_i*30+46] = in_data[Where+4];
- Whatever[PW_i*30+47] = in_data[Where+5];
- Whatever[PW_i*30+48] = in_data[Where+6];
- Whatever[PW_i*30+49] = in_data[Where+7];
- if ( (Whatever[PW_i*30+48] == 0x00) && (Whatever[PW_i*30+49] == 0x00) )Whatever[PW_i*30+49] = 0x01;
+ Whatever[i*30+42] = in_data[Where];
+ Whatever[i*30+43] = in_data[Where+1];
+ Total_Sample_Size += (((Whatever[i*30+42]*256)+Whatever[i*30+43])*2);
+ Whatever[i*30+44] = in_data[Where+2]/2;
+ Whatever[i*30+45] = in_data[Where+3];
+ Whatever[i*30+46] = in_data[Where+4];
+ Whatever[i*30+47] = in_data[Where+5];
+ Whatever[i*30+48] = in_data[Where+6];
+ Whatever[i*30+49] = in_data[Where+7];
+ if ( (Whatever[i*30+48] == 0x00) && (Whatever[i*30+49] == 0x00) )Whatever[i*30+49] = 0x01;
Where += 8;
}
Whatever[951] = 0x7f;
/* read pattern addys */
- for ( PW_i=0 ; PW_i<NOP ; PW_i++ )
+ for ( i=0 ; i<NOP ; i++ )
{
- Pats_Address[PW_i] = (in_data[Where]*256)+in_data[Where+1] + AFTER_REPLAY_CODE + 4;
+ Pats_Address[i] = (in_data[Where]*256)+in_data[Where+1];
Where += 2;
- //printf ( "[%3ld] : %ld\n", PW_i, Pats_Address[PW_i] );
+ //printf ( "[%3ld] : %ld\n", i, Pats_Address[i] );
}
/* write pattern table */
- PW_k = PW_l = 0;
- for (PW_j=0; PW_j<NOP ; PW_j++)
- {
- PW_m = 0x7fffffff; /* min */
+ /* doesn't work if there are unused patterns */
+/* PW_k = PW_l = 0;*/
+/* for (PW_j=0; PW_j<NOP ; PW_j++)*/
+/* {*/
+/* PW_m = 0x7fffffff; *//* min */
/*search for min */
- for (PW_i=0; PW_i<NOP ; PW_i++)
- if ((Pats_Address[PW_i]<PW_m) && (Pats_Address[PW_i]>PW_k))
- PW_m = Pats_Address[PW_i];
+/* for (i=0; i<NOP ; i++)
+ if ((Pats_Address[i]<PW_m) && (Pats_Address[i]>PW_k))
+ PW_m = Pats_Address[i];*/
/* if PW_k == PW_m then an already ref was found */
- if (PW_k == PW_m)
- continue;
+/* if (PW_k == PW_m)
+ continue;*/
/* PW_m is the next minimum */
- PW_k = PW_m;
- for (PW_i=0; PW_i<NOP ; PW_i++)
- if (Pats_Address[PW_i] == PW_k)
- Whatever[952+PW_i] = (unsigned char)PW_l;
+/* PW_k = PW_m;
+ for (i=0; i<NOP ; i++)
+ if (Pats_Address[i] == PW_k)
+ Whatever[952+i] = (unsigned char)PW_l;
PW_l++;
- }
+ }*/
/* PW_l is now the number of pattern saved (+1) */
- PW_l -= 1;
+ /* but I'll retrieve the official one ... */
/* write tag */
Whatever[1080] = 'M';
Whatever[1082] = 'K';
Whatever[1083] = '.';
- fwrite ( Whatever, 1, 1084, out );
+/* fwrite ( Whatever, 1, 1084, out );*/
/* a little pre-calc code ... no other way to deal with these unknown pattern data sizes ! :( */
/* so, first, we get the pattern data size .. */
Where = PW_Start_Address + AFTER_REPLAY_CODE + PW_j;
Ref_Max += 1; /* coz 1st value is 0 ! */
- PW_i = Ref_Max * 4; /* coz each block is 4 bytes long */
- ReferenceTable = (Uchar *) malloc ( PW_i );
- BZERO ( ReferenceTable, PW_i );
- for ( PW_j=0 ; PW_j<PW_i ; PW_j++) ReferenceTable[PW_j] = in_data[Where+PW_j];
+ i = Ref_Max * 4; /* coz each block is 4 bytes long */
+ ReferenceTable = (Uchar *) malloc ( i );
+ BZERO ( ReferenceTable, i );
+ for ( PW_j=0 ; PW_j<i ; PW_j++) ReferenceTable[PW_j] = in_data[Where+PW_j];
/* go back to pattern data starting address */
Where = PW_Start_Address + PATTERN_DATA;
PW_k=0; /* current note number */
Pattern = (Uchar *) malloc (65536);
BZERO (Pattern, 65536);
- PW_i=0;
+ i=0;
+ PW_l = 1; /* nbr of patterns stored */
+ Pats_Address_infile[0] = 0;
for ( PW_j=0 ; PW_j<PatDataSize ; PW_j+=2 )
{
+ if ( ((i%1024) == 0) && (PW_j>0) )
+ {
+ /*printf ("-%lx-",PW_j);*/
+ Pats_Address_infile[PW_l] = PW_j;
+ PW_l++;
+ }
PW_m = ((WholePatternData[PW_j]*256)+WholePatternData[PW_j+1])*4;
Smp = ReferenceTable[PW_m];
Smp = Smp >> 2;
Note = ReferenceTable[PW_m+1];
- Pattern[PW_i] = (Smp&0xf0);
- Pattern[PW_i] |= poss[(Note/2)][0];
- Pattern[PW_i+1] = poss[(Note/2)][1];
- Pattern[PW_i+2] = ReferenceTable[PW_m+2];
- Pattern[PW_i+2] |= ((Smp<<4)&0xf0);
- Pattern[PW_i+3] = ReferenceTable[PW_m+3];
+ Pattern[i] = (Smp&0xf0);
+ Pattern[i] |= poss[(Note/2)][0];
+ Pattern[i+1] = poss[(Note/2)][1];
+ Pattern[i+2] = ReferenceTable[PW_m+2];
+ Pattern[i+2] |= ((Smp<<4)&0xf0);
+ Pattern[i+3] = ReferenceTable[PW_m+3];
/*fprintf ( info, "[%4ld][%ld][%ld] %2x %2x %2x %2x",i,k%4,j,Pattern[i],Pattern[i+1],Pattern[i+2],Pattern[i+3] );*/
- if ( ( (Pattern[PW_i+2] & 0x0f) == 0x0d ) ||
- ( (Pattern[PW_i+2] & 0x0f) == 0x0b ) )
+ if ( ( (Pattern[i+2] & 0x0f) == 0x0d ) ||
+ ( (Pattern[i+2] & 0x0f) == 0x0b ) )
{
/*fprintf ( info, " <- D or B detected" );*/
FLAG = ON;
{
/*fprintf ( info, "\n -> bypassing end of pattern" );*/
FLAG=OFF;
- while ( (PW_i%1024) != 0)
- PW_i ++;
- PW_i -= 4;
+ while ( (i%1024) != 0)
+ i ++;
+ i -= 4;
}
PW_k += 1;
- PW_i += 4;
+ i += 4;
/*fprintf ( info, "\n" );*/
}
+ /* let's update now the pattern list */
+ for (i=0; i<NOP; i++)
+ {
+ /*printf ("\n[%2ld][%lx]:",i,Pats_Address[i]);*/
+ for (j=0; j<PW_l; j++)
+ {
+ /*printf ("%lx-",Pats_Address_infile[j]);*/
+ if (Pats_Address_infile[j] == Pats_Address[i])
+ {
+ /*printf ("done");*/
+ Whatever[952+i] = j;
+ break;
+ }
+ }
+ }
+ fwrite ( Whatever, 1, 1084, out );
+
+
free ( ReferenceTable );
free ( WholePatternData );
/* get address of sample data .. and go there */
Where = PW_Start_Address + ADDRESS_SAMPLE_DATA;
- PW_i = (in_data[Where]*256*256*256)+(in_data[Where+1]*256*256)+(in_data[Where+2]*256)+in_data[Where+3];
- Where = PW_Start_Address + AFTER_REPLAY_CODE + PW_i;
+ i = (in_data[Where]*256*256*256)+(in_data[Where+1]*256*256)+(in_data[Where+2]*256)+in_data[Where+3];
+ Where = PW_Start_Address + AFTER_REPLAY_CODE + i;
/* read and save sample data */
void kickstart_fix_checksum (uae_u8 *mem, int size)
{
uae_u32 cksum = 0, prevck = 0;
- int i, ch = size == 524288 ? 0x7ffe8 : 0x3e;
+ int i, ch = size == 524288 ? 0x7ffe8 : (size == 262144 ? 0x3ffe8 : 0x3e);
mem[ch] = 0;
mem[ch + 1] = 0;
write_log (L"%s is not an AmigaStateFile\n", filename);
goto error;
}
+ config_changed = 1;
savestate_file = f;
restore_header (chunk);
xfree (chunk);