Revamped the UI setup layer, which also fixes the VC builds.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the CPU.
|
* Implementation of the CPU.
|
||||||
*
|
*
|
||||||
* Version: @(#)386.c 1.0.2 2018/03/09
|
* Version: @(#)386.c 1.0.3 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -93,6 +93,7 @@ uint32_t rmdat32;
|
|||||||
#define fetchdat rmdat32
|
#define fetchdat rmdat32
|
||||||
uint32_t backupregs[16];
|
uint32_t backupregs[16];
|
||||||
extern int oddeven;
|
extern int oddeven;
|
||||||
|
int timetolive = 0;
|
||||||
int inttype;
|
int inttype;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
245
src/cpu/808x.c
245
src/cpu/808x.c
@@ -18,7 +18,7 @@
|
|||||||
* 2 clocks - fetch opcode 1 2 clocks - execute
|
* 2 clocks - fetch opcode 1 2 clocks - execute
|
||||||
* 2 clocks - fetch opcode 2 etc
|
* 2 clocks - fetch opcode 2 etc
|
||||||
*
|
*
|
||||||
* Version: @(#)808x.c 1.0.3 2018/04/26
|
* Version: @(#)808x.c 1.0.4 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -64,112 +64,126 @@
|
|||||||
#include "../plat.h"
|
#include "../plat.h"
|
||||||
|
|
||||||
|
|
||||||
int xt_cpu_multi;
|
int xt_cpu_multi;
|
||||||
int nmi = 0;
|
int nmi = 0;
|
||||||
int nmi_auto_clear = 0;
|
int nmi_auto_clear = 0;
|
||||||
|
int nextcyc = 0;
|
||||||
|
int cycdiff;
|
||||||
|
int is8086 = 0;
|
||||||
|
int nopageerrors = 0;
|
||||||
|
uint16_t oldcs;
|
||||||
|
int oldcpl;
|
||||||
|
int tempc;
|
||||||
|
uint8_t opcode;
|
||||||
|
uint16_t pc2,
|
||||||
|
pc3;
|
||||||
|
int noint = 0;
|
||||||
|
int output = 0;
|
||||||
|
int ins = 0;
|
||||||
|
int fetchcycles = 0,
|
||||||
|
memcycs,
|
||||||
|
fetchclocks;
|
||||||
|
uint8_t prefetchqueue[6];
|
||||||
|
uint16_t prefetchpc;
|
||||||
|
int prefetchw = 0;
|
||||||
|
|
||||||
int nextcyc=0;
|
|
||||||
int cycdiff;
|
|
||||||
int is8086=0;
|
|
||||||
|
|
||||||
int memcycs;
|
|
||||||
int nopageerrors=0;
|
|
||||||
|
|
||||||
void FETCHCOMPLETE();
|
|
||||||
|
|
||||||
uint8_t readmembl(uint32_t addr);
|
|
||||||
void writemembl(uint32_t addr, uint8_t val);
|
|
||||||
uint16_t readmemwl(uint32_t seg, uint32_t addr);
|
|
||||||
void writememwl(uint32_t seg, uint32_t addr, uint16_t val);
|
|
||||||
uint32_t readmemll(uint32_t seg, uint32_t addr);
|
|
||||||
void writememll(uint32_t seg, uint32_t addr, uint32_t val);
|
|
||||||
|
|
||||||
#undef readmemb
|
#undef readmemb
|
||||||
|
uint8_t
|
||||||
|
readmemb(uint32_t a)
|
||||||
|
{
|
||||||
|
if (a != (cs + cpu_state.pc)) memcycs += 4;
|
||||||
|
|
||||||
|
if (readlookup2 == NULL)
|
||||||
|
return(readmembl(a));
|
||||||
|
|
||||||
|
if (readlookup2[(a) >> 12] == -1)
|
||||||
|
return(readmembl(a));
|
||||||
|
else
|
||||||
|
return(*(uint8_t *)(readlookup2[(a) >> 12] + (a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t
|
||||||
|
readmembf(uint32_t a)
|
||||||
|
{
|
||||||
|
if (readlookup2 == NULL)
|
||||||
|
return readmembl(a);
|
||||||
|
|
||||||
|
if (readlookup2[(a)>>12]==-1)
|
||||||
|
return readmembl(a);
|
||||||
|
else
|
||||||
|
return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef readmemw
|
#undef readmemw
|
||||||
uint8_t readmemb(uint32_t a)
|
uint16_t
|
||||||
|
readmemw(uint32_t s, uint16_t a)
|
||||||
{
|
{
|
||||||
if (a!=(cs+cpu_state.pc)) memcycs+=4;
|
if (a != (cs+cpu_state.pc))
|
||||||
if (readlookup2 == NULL) return readmembl(a);
|
memcycs += (8 >> is8086);
|
||||||
if (readlookup2[(a)>>12]==-1) return readmembl(a);
|
|
||||||
else return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t readmembf(uint32_t a)
|
if (readlookup2 == NULL)
|
||||||
{
|
return readmemwl(s, a);
|
||||||
if (readlookup2 == NULL) return readmembl(a);
|
|
||||||
if (readlookup2[(a)>>12]==-1) return readmembl(a);
|
|
||||||
else return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t readmemw(uint32_t s, uint16_t a)
|
if ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF))
|
||||||
{
|
return readmemwl(s,a);
|
||||||
if (a!=(cs+cpu_state.pc)) memcycs+=(8>>is8086);
|
else
|
||||||
if (readlookup2 == NULL) return readmemwl(s,a);
|
return *(uint16_t *)(readlookup2[(s + a) >> 12] + s + a);
|
||||||
if ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)) return readmemwl(s,a);
|
|
||||||
else return *(uint16_t *)(readlookup2[(s + a) >> 12] + s + a);
|
|
||||||
}
|
|
||||||
|
|
||||||
void refreshread() { /*pclog("Refreshread\n"); */FETCHCOMPLETE(); memcycs+=4; }
|
|
||||||
|
|
||||||
#undef fetchea
|
|
||||||
#define fetchea() { rmdat=FETCH(); \
|
|
||||||
cpu_reg=(rmdat>>3)&7; \
|
|
||||||
cpu_mod=(rmdat>>6)&3; \
|
|
||||||
cpu_rm=rmdat&7; \
|
|
||||||
if (cpu_mod!=3) fetcheal(); }
|
|
||||||
|
|
||||||
void writemembl(uint32_t addr, uint8_t val);
|
|
||||||
void writememb(uint32_t a, uint8_t v)
|
|
||||||
{
|
|
||||||
memcycs+=4;
|
|
||||||
if (writelookup2 == NULL) writemembl(a,v);
|
|
||||||
if (writelookup2[(a)>>12]==-1) writemembl(a,v);
|
|
||||||
else *(uint8_t *)(writelookup2[a >> 12] + a) = v;
|
|
||||||
}
|
|
||||||
void writememwl(uint32_t seg, uint32_t addr, uint16_t val);
|
|
||||||
void writememw(uint32_t s, uint32_t a, uint16_t v)
|
|
||||||
{
|
|
||||||
memcycs+=(8>>is8086);
|
|
||||||
if (writelookup2 == NULL) writememwl(s,a,v);
|
|
||||||
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememwl(s,a,v);
|
|
||||||
else *(uint16_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
|
||||||
}
|
|
||||||
void writememll(uint32_t seg, uint32_t addr, uint32_t val);
|
|
||||||
void writememl(uint32_t s, uint32_t a, uint32_t v)
|
|
||||||
{
|
|
||||||
if (writelookup2 == NULL) writememll(s,a,v);
|
|
||||||
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememll(s,a,v);
|
|
||||||
else *(uint32_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dumpregs(int);
|
void
|
||||||
uint16_t oldcs;
|
writememb(uint32_t a, uint8_t v)
|
||||||
int oldcpl;
|
{
|
||||||
|
memcycs += 4;
|
||||||
|
|
||||||
int tempc;
|
if (writelookup2 == NULL)
|
||||||
uint8_t opcode;
|
writemembl(a, v);
|
||||||
uint16_t pc2,pc3;
|
|
||||||
int noint=0;
|
|
||||||
|
|
||||||
int output=0;
|
if (writelookup2[(a)>>12]==-1)
|
||||||
|
writemembl(a,v);
|
||||||
|
else
|
||||||
|
*(uint8_t *)(writelookup2[a >> 12] + a) = v;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Also in mem.c */
|
|
||||||
int shadowbios=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int ins=0;
|
void
|
||||||
|
writememw(uint32_t s, uint32_t a, uint16_t v)
|
||||||
|
{
|
||||||
|
memcycs += (8 >> is8086);
|
||||||
|
|
||||||
int fetchcycles=0,memcycs,fetchclocks;
|
if (writelookup2 == NULL)
|
||||||
|
writememwl(s, a, v);
|
||||||
|
|
||||||
uint8_t prefetchqueue[6];
|
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)
|
||||||
uint16_t prefetchpc;
|
writememwl(s,a,v);
|
||||||
int prefetchw=0;
|
else
|
||||||
static __inline uint8_t FETCH()
|
*(uint16_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
writememl(uint32_t s, uint32_t a, uint32_t v)
|
||||||
|
{
|
||||||
|
if (writelookup2 == NULL)
|
||||||
|
writememll(s, a, v);
|
||||||
|
|
||||||
|
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)
|
||||||
|
writememll(s, a, v);
|
||||||
|
else
|
||||||
|
*(uint32_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static __inline uint8_t
|
||||||
|
FETCH(void)
|
||||||
{
|
{
|
||||||
uint8_t temp;
|
uint8_t temp;
|
||||||
/* temp=prefetchqueue[0];
|
|
||||||
|
#if 0
|
||||||
|
temp=prefetchqueue[0];
|
||||||
prefetchqueue[0]=prefetchqueue[1];
|
prefetchqueue[0]=prefetchqueue[1];
|
||||||
prefetchqueue[1]=prefetchqueue[2];
|
prefetchqueue[1]=prefetchqueue[2];
|
||||||
prefetchqueue[2]=prefetchqueue[3];
|
prefetchqueue[2]=prefetchqueue[3];
|
||||||
@@ -182,7 +196,8 @@ static __inline uint8_t FETCH()
|
|||||||
{
|
{
|
||||||
prefetchqueue[prefetchw++]=readmembf(cs+prefetchpc); prefetchpc++;
|
prefetchqueue[prefetchw++]=readmembf(cs+prefetchpc); prefetchpc++;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (prefetchw==0)
|
if (prefetchw==0)
|
||||||
{
|
{
|
||||||
@@ -213,7 +228,9 @@ static __inline uint8_t FETCH()
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void FETCHADD(int c)
|
|
||||||
|
static __inline void
|
||||||
|
FETCHADD(int c)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
if (c<0) return;
|
if (c<0) return;
|
||||||
@@ -239,7 +256,19 @@ static __inline void FETCHADD(int c)
|
|||||||
if (fetchcycles>16) fetchcycles=16;
|
if (fetchcycles>16) fetchcycles=16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FETCHCOMPLETE()
|
|
||||||
|
static __inline void
|
||||||
|
FETCHCLEAR(void)
|
||||||
|
{
|
||||||
|
prefetchpc=cpu_state.pc;
|
||||||
|
prefetchw=0;
|
||||||
|
memcycs=cycdiff-cycles;
|
||||||
|
fetchclocks=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FETCHCOMPLETE(void)
|
||||||
{
|
{
|
||||||
if (!(fetchcycles&3)) return;
|
if (!(fetchcycles&3)) return;
|
||||||
if (prefetchw>((is8086)?4:3)) return;
|
if (prefetchw>((is8086)?4:3)) return;
|
||||||
@@ -261,21 +290,35 @@ void FETCHCOMPLETE()
|
|||||||
fetchcycles+=(4-(fetchcycles&3));
|
fetchcycles+=(4-(fetchcycles&3));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void FETCHCLEAR()
|
|
||||||
|
void
|
||||||
|
refreshread(void)
|
||||||
{
|
{
|
||||||
prefetchpc=cpu_state.pc;
|
#if 0
|
||||||
prefetchw=0;
|
pclog("Refreshread\n");
|
||||||
memcycs=cycdiff-cycles;
|
#endif
|
||||||
fetchclocks=0;
|
FETCHCOMPLETE();
|
||||||
|
|
||||||
|
memcycs += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t getword()
|
|
||||||
|
static uint16_t
|
||||||
|
getword(void)
|
||||||
{
|
{
|
||||||
uint8_t temp=FETCH();
|
uint8_t temp=FETCH();
|
||||||
return temp|(FETCH()<<8);
|
return temp|(FETCH()<<8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef fetchea
|
||||||
|
#define fetchea() { rmdat=FETCH(); \
|
||||||
|
cpu_reg=(rmdat>>3)&7; \
|
||||||
|
cpu_mod=(rmdat>>6)&3; \
|
||||||
|
cpu_rm=rmdat&7; \
|
||||||
|
if (cpu_mod!=3) fetcheal(); }
|
||||||
|
|
||||||
|
|
||||||
/*EA calculation*/
|
/*EA calculation*/
|
||||||
|
|
||||||
/*R/M - bits 0-2 - R/M bits 3-5 - Reg bits 6-7 - mod
|
/*R/M - bits 0-2 - R/M bits 3-5 - Reg bits 6-7 - mod
|
||||||
@@ -513,10 +556,6 @@ void makeznptable()
|
|||||||
if (c&0x8000) znptable16[c]|=N_FLAG;
|
if (c&0x8000) znptable16[c]|=N_FLAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
/* Also in mem.c */
|
|
||||||
int timetolive=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern uint32_t oldcs2;
|
extern uint32_t oldcs2;
|
||||||
extern uint32_t oldpc2;
|
extern uint32_t oldpc2;
|
||||||
@@ -531,7 +570,7 @@ void dumpregs(int force)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Only dump when needed, and only once.. */
|
/* Only dump when needed, and only once.. */
|
||||||
if (indump || (!force && !dump_on_exit)) return;
|
if (!ram || indump || (!force && !dump_on_exit)) return;
|
||||||
|
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
indump = 1;
|
indump = 1;
|
||||||
|
|||||||
7
src/pc.c
7
src/pc.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main emulator module where most things are controlled.
|
* Main emulator module where most things are controlled.
|
||||||
*
|
*
|
||||||
* Version: @(#)pc.c 1.0.31 2018/04/30
|
* Version: @(#)pc.c 1.0.32 2018/05/01
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -310,6 +310,11 @@ pc_version(const char *platform)
|
|||||||
#endif
|
#endif
|
||||||
strcpy(emu_fullversion, emu_version);
|
strcpy(emu_fullversion, emu_version);
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
sprintf(temp, " [VC%d]", _MSC_VER);
|
||||||
|
strcat(emu_fullversion, temp);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD
|
#ifdef BUILD
|
||||||
sprintf(temp, " (Build %d", BUILD);
|
sprintf(temp, " (Build %d", BUILD);
|
||||||
strcat(emu_fullversion, temp);
|
strcat(emu_fullversion, temp);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define the various platform support functions.
|
* Define the various platform support functions.
|
||||||
*
|
*
|
||||||
* Version: @(#)plat.h 1.0.10 2018/04/30
|
* Version: @(#)plat.h 1.0.11 2018/05/03
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -127,6 +127,7 @@ extern int plat_setvid(int api);
|
|||||||
extern void plat_vidsize(int x, int y);
|
extern void plat_vidsize(int x, int y);
|
||||||
extern void plat_setfullscreen(int on);
|
extern void plat_setfullscreen(int on);
|
||||||
extern void plat_resize(int x, int y);
|
extern void plat_resize(int x, int y);
|
||||||
|
extern int plat_fdd_icon(int);
|
||||||
|
|
||||||
|
|
||||||
/* Resource management. */
|
/* Resource management. */
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* This code is called by the UI frontend modules, and, also,
|
* This code is called by the UI frontend modules, and, also,
|
||||||
* depends on those same modules for lower-level functions.
|
* depends on those same modules for lower-level functions.
|
||||||
*
|
*
|
||||||
* Version: @(#)ui_main.c 1.0.6 2018/04/30
|
* Version: @(#)ui_main.c 1.0.7 2018/04/30
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -243,7 +243,9 @@ ui_menu_toggle_video_item(int idm, int *val)
|
|||||||
void
|
void
|
||||||
ui_menu_reset_all(void)
|
ui_menu_reset_all(void)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_LOG_TOGGLES
|
||||||
int i;
|
int i;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DEV_BRANCH
|
#ifndef DEV_BRANCH
|
||||||
/* FIXME: until we fix these.. --FvK */
|
/* FIXME: until we fix these.. --FvK */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Common UI support functions for the Status Bar module.
|
* Common UI support functions for the Status Bar module.
|
||||||
*
|
*
|
||||||
* Version: @(#)ui_stbar.c 1.0.2 2018/04/29
|
* Version: @(#)ui_stbar.c 1.0.3 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -712,7 +712,7 @@ ui_sb_update(void)
|
|||||||
case SB_FLOPPY: /* Floppy */
|
case SB_FLOPPY: /* Floppy */
|
||||||
drive = sb_tags[part] & 0x0f;
|
drive = sb_tags[part] & 0x0f;
|
||||||
sb_flags[part] = (wcslen(floppyfns[drive]) == 0) ? 256 : 0;
|
sb_flags[part] = (wcslen(floppyfns[drive]) == 0) ? 256 : 0;
|
||||||
sb_icons[part] = sb_fdd_icon(fdd_get_type(drive)) | sb_flags[part];
|
sb_icons[part] = plat_fdd_icon(fdd_get_type(drive)) | sb_flags[part];
|
||||||
sb_menu_create(part);
|
sb_menu_create(part);
|
||||||
menu_floppy(part, drive);
|
menu_floppy(part, drive);
|
||||||
ui_sb_tip_update(sb_tags[part]);
|
ui_sb_tip_update(sb_tags[part]);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define application version and build info.
|
* Define application version and build info.
|
||||||
*
|
*
|
||||||
* Version: @(#)version.h 1.0.11 2018/04/29
|
* Version: @(#)version.h 1.0.12 2018/05/03
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
#define EMU_VER_MAJOR 0
|
#define EMU_VER_MAJOR 0
|
||||||
#define EMU_VER_MINOR 1
|
#define EMU_VER_MINOR 1
|
||||||
#define EMU_VER_REV 5
|
#define EMU_VER_REV 5
|
||||||
#define EMU_VER_PATCH 5
|
#define EMU_VER_PATCH 6
|
||||||
|
|
||||||
|
|
||||||
/* Standard C preprocessor macros. */
|
/* Standard C preprocessor macros. */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile for Windows systems using the MinGW32 environment.
|
# Makefile for Windows systems using the MinGW32 environment.
|
||||||
#
|
#
|
||||||
# Version: @(#)Makefile.mingw 1.0.35 2018/04/28
|
# Version: @(#)Makefile.mingw 1.0.37 2018/05/03
|
||||||
#
|
#
|
||||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
#
|
#
|
||||||
@@ -364,7 +364,7 @@ ifneq ($(WX), n)
|
|||||||
else
|
else
|
||||||
UIOBJ := win_ui.o \
|
UIOBJ := win_ui.o \
|
||||||
win_ddraw.o win_d3d.o \
|
win_ddraw.o win_d3d.o \
|
||||||
win_dialog.o win_about.o win_status.o win_stbar.o \
|
win_dialog.o win_about.o win_status.o \
|
||||||
win_settings.o win_devconf.o win_snd_gain.o \
|
win_settings.o win_devconf.o win_snd_gain.o \
|
||||||
win_new_floppy.o
|
win_new_floppy.o
|
||||||
endif
|
endif
|
||||||
@@ -670,7 +670,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: $(PROG).exe pcap_if.exe
|
all: $(PREBUILD) $(PROG).exe pcap_if.exe $(POSTBUILD)
|
||||||
|
|
||||||
|
|
||||||
VARCem.res: VARCem.rc VARCem.mpp
|
VARCem.res: VARCem.rc VARCem.mpp
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile for Windows using Visual Studio 2015.
|
# Makefile for Windows using Visual Studio 2015.
|
||||||
#
|
#
|
||||||
# Version: @(#)Makefile.VC 1.0.22 2018/04/29
|
# Version: @(#)Makefile.VC 1.0.24 2018/05/03
|
||||||
#
|
#
|
||||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
#
|
#
|
||||||
@@ -229,13 +229,14 @@ else
|
|||||||
ARCH := x86
|
ARCH := x86
|
||||||
endif
|
endif
|
||||||
PREPROC := cl -nologo -EP
|
PREPROC := cl -nologo -EP
|
||||||
|
MCPP := mcpp.exe
|
||||||
LINK := link -nologo
|
LINK := link -nologo
|
||||||
WINDRES := rc -nologo -r
|
WINDRES := rc -nologo -r
|
||||||
|
|
||||||
SYSINC := -Iwin/msvc/Include -Iwin/mingw/include
|
SYSINC := -Iwin/msvc/Include -Iwin/mingw/include
|
||||||
SYSLIB :=
|
SYSLIB :=
|
||||||
|
|
||||||
DEPS = -MMD -MF $*.d -c $<
|
DEPS = -MMD -MF $*.d
|
||||||
DEPFILE := win\.depends-msvc
|
DEPFILE := win\.depends-msvc
|
||||||
|
|
||||||
# Set up the correct toolchain flags.
|
# Set up the correct toolchain flags.
|
||||||
@@ -251,6 +252,8 @@ COPTS := -W3
|
|||||||
CXXOPTS := -EHsc
|
CXXOPTS := -EHsc
|
||||||
DOPTS :=
|
DOPTS :=
|
||||||
LOPTS := -LIBPATH:win\msvc\Lib\$(ARCH)
|
LOPTS := -LIBPATH:win\msvc\Lib\$(ARCH)
|
||||||
|
LOPTS_C := -SUBSYSTEM:CONSOLE,5.01
|
||||||
|
LOPTS_W := -SUBSYSTEM:WINDOWS,5.01
|
||||||
ifdef BUILD
|
ifdef BUILD
|
||||||
OPTS += -DBUILD=$(BUILD)
|
OPTS += -DBUILD=$(BUILD)
|
||||||
endif
|
endif
|
||||||
@@ -271,7 +274,8 @@ ifeq ($(OPTIM), y)
|
|||||||
DOPTS := -march=native
|
DOPTS := -march=native
|
||||||
endif
|
endif
|
||||||
ifeq ($(DEBUG), y)
|
ifeq ($(DEBUG), y)
|
||||||
DOPTS += -Gs -Zi -D_DEBUG
|
OPTS += -D_DEBUG
|
||||||
|
DOPTS += -MTd -Gs -Zi
|
||||||
ROPTS += -D_DEBUG
|
ROPTS += -D_DEBUG
|
||||||
LOPTS += -debug
|
LOPTS += -debug
|
||||||
AOPTIM :=
|
AOPTIM :=
|
||||||
@@ -279,7 +283,7 @@ ifeq ($(DEBUG), y)
|
|||||||
COPTIM := -Od
|
COPTIM := -Od
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
DOPTS := -Gs
|
DOPTS := -MT -Gs
|
||||||
ifndef COPTIM
|
ifndef COPTIM
|
||||||
COPTIM := -O2
|
COPTIM := -O2
|
||||||
endif
|
endif
|
||||||
@@ -311,6 +315,9 @@ LIBS := ddraw.lib dinput8.lib dxguid.lib d3d9.lib d3dx9.lib \
|
|||||||
comctl32.lib winmm.lib comdlg32.lib advapi32.lib \
|
comctl32.lib winmm.lib comdlg32.lib advapi32.lib \
|
||||||
gdi32.lib shell32.lib user32.lib kernel32.lib \
|
gdi32.lib shell32.lib user32.lib kernel32.lib \
|
||||||
wsock32.lib iphlpapi.lib psapi.lib
|
wsock32.lib iphlpapi.lib psapi.lib
|
||||||
|
ifeq ($(DEBUG), y)
|
||||||
|
LIBS += libcmtd.lib libvcruntimed.lib libucrtd.lib
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Optional modules.
|
# Optional modules.
|
||||||
@@ -332,7 +339,7 @@ ifneq ($(WX), n)
|
|||||||
else
|
else
|
||||||
UIOBJ := win_ui.obj \
|
UIOBJ := win_ui.obj \
|
||||||
win_ddraw.obj win_d3d.obj \
|
win_ddraw.obj win_d3d.obj \
|
||||||
win_dialog.obj win_about.obj win_status.obj win_stbar.obj \
|
win_dialog.obj win_about.obj win_status.obj \
|
||||||
win_settings.obj win_devconf.obj win_snd_gain.obj \
|
win_settings.obj win_devconf.obj win_snd_gain.obj \
|
||||||
win_new_floppy.obj
|
win_new_floppy.obj
|
||||||
endif
|
endif
|
||||||
@@ -494,7 +501,7 @@ DEVOBJ := bugger.obj \
|
|||||||
keyboard.obj \
|
keyboard.obj \
|
||||||
keyboard_xt.obj keyboard_at.obj \
|
keyboard_xt.obj keyboard_at.obj \
|
||||||
mouse.obj \
|
mouse.obj \
|
||||||
mouse_serial.obj mouse_ps2.obj mouse_bus.obj
|
mouse_serial.obj mouse_ps2.obj mouse_bus.obj \
|
||||||
joystick.obj \
|
joystick.obj \
|
||||||
js_standard.obj js_ch_fs_pro.obj \
|
js_standard.obj js_ch_fs_pro.obj \
|
||||||
js_sw_pad.obj js_tm_fcs.obj
|
js_sw_pad.obj js_tm_fcs.obj
|
||||||
@@ -608,32 +615,28 @@ endif
|
|||||||
# Build module rules.
|
# Build module rules.
|
||||||
ifeq ($(AUTODEP), y)
|
ifeq ($(AUTODEP), y)
|
||||||
%.obj: %.c
|
%.obj: %.c
|
||||||
# @echo $<
|
@$(CC) $(CFLAGS) -Fo$@ -c $<
|
||||||
@$(CC) $(CFLAGS) $(DEPS) -Fo$@ -c $<
|
@$(MCPP) $(OPTS) $(DEPS) $<
|
||||||
|
|
||||||
%.obj: %.cpp
|
%.obj: %.cpp
|
||||||
# @echo $<
|
@$(CPP) $(CXXFLAGS) -Fo$@ -c $<
|
||||||
@$(CPP) $(CXXFLAGS) $(DEPS) -Fo$@ -c $<
|
@$(MCPP) $(OPTS) $(DEPS) $<
|
||||||
else
|
else
|
||||||
%.obj: %.c
|
%.obj: %.c
|
||||||
# @echo $<
|
|
||||||
@$(CC) $(CFLAGS) -Fo$@ -c $<
|
@$(CC) $(CFLAGS) -Fo$@ -c $<
|
||||||
|
|
||||||
%.obj: %.cpp
|
%.obj: %.cpp
|
||||||
# @echo $<
|
|
||||||
@$(CPP) $(CXXFLAGS) -Fo$@ -c $<
|
@$(CPP) $(CXXFLAGS) -Fo$@ -c $<
|
||||||
|
|
||||||
%.d: %.c $(wildcard $*.d)
|
%.d: %.c $(wildcard $*.d)
|
||||||
# @echo $<
|
$(MCPP) $(OPTS) $(DEPS) $< >NUL
|
||||||
@$(CC) $(CFLAGS) $(DEPS) -E $< >NUL
|
|
||||||
|
|
||||||
%.d: %.cpp $(wildcard $*.d)
|
%.d: %.cpp $(wildcard $*.d)
|
||||||
# @echo $<
|
$(MCPP) $(OPTS) $(DEPS) $< >NUL
|
||||||
@$(CPP) $(CXXFLAGS) $(DEPS) -E $< >NUL
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: $(PROG).exe pcap_if.exe
|
all: $(PREBUILD) $(PROG).exe pcap_if.exe $(POSTBUILD)
|
||||||
|
|
||||||
|
|
||||||
VARCem.res: win/VARCem.rc win/VARCem.mpp
|
VARCem.res: win/VARCem.rc win/VARCem.mpp
|
||||||
@@ -645,7 +648,7 @@ VARCem.res: win/VARCem.rc win/VARCem.mpp
|
|||||||
|
|
||||||
$(PROG).exe: $(OBJ) VARCem.res
|
$(PROG).exe: $(OBJ) VARCem.res
|
||||||
@echo Linking $(PROG).exe ..
|
@echo Linking $(PROG).exe ..
|
||||||
@$(LINK) $(LDFLAGS) -OUT:$(PROG).exe \
|
@$(LINK) $(LDFLAGS) $(LOPTS_W) -OUT:$(PROG).exe \
|
||||||
$(OBJ) VARCem.res $(LIBS)
|
$(OBJ) VARCem.res $(LIBS)
|
||||||
|
|
||||||
pcap_if.res: pcap_if.rc
|
pcap_if.res: pcap_if.rc
|
||||||
@@ -654,11 +657,12 @@ pcap_if.res: pcap_if.rc
|
|||||||
|
|
||||||
pcap_if.exe: pcap_if.obj win_dynld.obj pcap_if.res
|
pcap_if.exe: pcap_if.obj win_dynld.obj pcap_if.res
|
||||||
@echo Linking pcap_if.exe ..
|
@echo Linking pcap_if.exe ..
|
||||||
@$(LINK) $(LDFLAGS) -OUT:pcap_if.exe \
|
@$(LINK) $(LDFLAGS) $(LOPTS_C) -OUT:pcap_if.exe \
|
||||||
pcap_if.obj win_dynld.obj pcap_if.res
|
pcap_if.obj win_dynld.obj pcap_if.res
|
||||||
|
|
||||||
hello.exe: hello.obj
|
hello.exe: hello.obj
|
||||||
$(LINK) $(LDFLAGS) -OUT:hello.exe hello.obj $(WXLIBS) $(LIBS)
|
$(LINK) $(LDFLAGS) $(LOPTS_C) -OUT:hello.exe \
|
||||||
|
hello.obj $(WXLIBS) $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Windows resource defines.
|
* Windows resource defines.
|
||||||
*
|
*
|
||||||
* Version: @(#)resource.h 1.0.13 2018/04/28
|
* Version: @(#)resource.h 1.0.14 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -243,9 +243,12 @@
|
|||||||
#define IDC_JOY2 1211
|
#define IDC_JOY2 1211
|
||||||
#define IDC_JOY3 1212
|
#define IDC_JOY3 1212
|
||||||
#define IDC_JOY4 1213
|
#define IDC_JOY4 1213
|
||||||
|
|
||||||
#define IDC_HDTYPE 1280
|
#define IDC_HDTYPE 1280
|
||||||
|
|
||||||
#define IDC_RENDER 1281
|
#define IDC_RENDER 1281
|
||||||
#define IDC_STATUS 1282
|
|
||||||
|
#define IDC_STATBAR 1282
|
||||||
|
|
||||||
|
|
||||||
/* HELP menu. */
|
/* HELP menu. */
|
||||||
|
|||||||
358
src/win/win.c
358
src/win/win.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Platform main support module for Windows.
|
* Platform main support module for Windows.
|
||||||
*
|
*
|
||||||
* Version: @(#)win.c 1.0.15 2018/04/27
|
* Version: @(#)win.c 1.0.16 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _WIN32_WINNT 0x0501
|
#define _WIN32_WINNT 0x0501
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# include <io.h> /* for _open_osfhandle() */
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -67,9 +70,6 @@
|
|||||||
# include "win_ddraw.h"
|
# include "win_ddraw.h"
|
||||||
# include "win_d3d.h"
|
# include "win_d3d.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
|
||||||
# include <io.h> /* for _open_osfhandle() */
|
|
||||||
#endif
|
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -79,14 +79,14 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
/* Platform Public data, specific. */
|
/* Platform Public data, specific. */
|
||||||
HINSTANCE hinstance; /* application instance */
|
HINSTANCE hInstance; /* application instance */
|
||||||
HANDLE ghMutex;
|
|
||||||
LCID lang_id; /* current language ID used */
|
LCID lang_id; /* current language ID used */
|
||||||
DWORD dwSubLangID;
|
DWORD dwSubLangID;
|
||||||
|
|
||||||
|
|
||||||
/* Local data. */
|
/* Local data. */
|
||||||
static HANDLE thMain;
|
static HANDLE hBlitMutex, /* video mutex */
|
||||||
|
thMain; /* main thread */
|
||||||
static rc_str_t *lpRCstr2048,
|
static rc_str_t *lpRCstr2048,
|
||||||
*lpRCstr4096,
|
*lpRCstr4096,
|
||||||
*lpRCstr4352,
|
*lpRCstr4352,
|
||||||
@@ -165,87 +165,34 @@ LoadCommonStrings(void)
|
|||||||
lpRCstr7168 = (rc_str_t *)malloc(STR_NUM_7168*sizeof(rc_str_t));
|
lpRCstr7168 = (rc_str_t *)malloc(STR_NUM_7168*sizeof(rc_str_t));
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_2048; i++)
|
for (i=0; i<STR_NUM_2048; i++)
|
||||||
LoadString(hinstance, 2048+i, lpRCstr2048[i].str, 512);
|
LoadString(hInstance, 2048+i, lpRCstr2048[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_4096; i++)
|
for (i=0; i<STR_NUM_4096; i++)
|
||||||
LoadString(hinstance, 4096+i, lpRCstr4096[i].str, 512);
|
LoadString(hInstance, 4096+i, lpRCstr4096[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_4352; i++)
|
for (i=0; i<STR_NUM_4352; i++)
|
||||||
LoadString(hinstance, 4352+i, lpRCstr4352[i].str, 512);
|
LoadString(hInstance, 4352+i, lpRCstr4352[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_4608; i++)
|
for (i=0; i<STR_NUM_4608; i++)
|
||||||
LoadString(hinstance, 4608+i, lpRCstr4608[i].str, 512);
|
LoadString(hInstance, 4608+i, lpRCstr4608[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_5120; i++)
|
for (i=0; i<STR_NUM_5120; i++)
|
||||||
LoadString(hinstance, 5120+i, lpRCstr5120[i].str, 512);
|
LoadString(hInstance, 5120+i, lpRCstr5120[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_5376; i++)
|
for (i=0; i<STR_NUM_5376; i++)
|
||||||
LoadString(hinstance, 5376+i, lpRCstr5376[i].str, 512);
|
LoadString(hInstance, 5376+i, lpRCstr5376[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_5632; i++)
|
for (i=0; i<STR_NUM_5632; i++)
|
||||||
LoadString(hinstance, 5632+i, lpRCstr5632[i].str, 512);
|
LoadString(hInstance, 5632+i, lpRCstr5632[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_5888; i++)
|
for (i=0; i<STR_NUM_5888; i++)
|
||||||
LoadString(hinstance, 5888+i, lpRCstr5888[i].str, 512);
|
LoadString(hInstance, 5888+i, lpRCstr5888[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_6144; i++)
|
for (i=0; i<STR_NUM_6144; i++)
|
||||||
LoadString(hinstance, 6144+i, lpRCstr6144[i].str, 512);
|
LoadString(hInstance, 6144+i, lpRCstr6144[i].str, 512);
|
||||||
|
|
||||||
for (i=0; i<STR_NUM_7168; i++)
|
for (i=0; i<STR_NUM_7168; i++)
|
||||||
LoadString(hinstance, 7168+i, lpRCstr7168[i].str, 512);
|
LoadString(hInstance, 7168+i, lpRCstr7168[i].str, 512);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Set (or re-set) the language for the application. */
|
|
||||||
void
|
|
||||||
set_language(int id)
|
|
||||||
{
|
|
||||||
LCID lcidNew = MAKELCID(id, dwSubLangID);
|
|
||||||
|
|
||||||
if (lang_id != lcidNew) {
|
|
||||||
/* Set our new language ID. */
|
|
||||||
lang_id = lcidNew;
|
|
||||||
|
|
||||||
SetThreadLocale(lang_id);
|
|
||||||
|
|
||||||
/* Load the strings table for this ID. */
|
|
||||||
LoadCommonStrings();
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Update the menus for this ID. */
|
|
||||||
MenuUpdate();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wchar_t *
|
|
||||||
plat_get_string(int i)
|
|
||||||
{
|
|
||||||
LPTSTR str;
|
|
||||||
|
|
||||||
if ((i >= 2048) && (i <= 3071))
|
|
||||||
str = lpRCstr2048[i-2048].str;
|
|
||||||
else if ((i >= 4096) && (i <= 4351))
|
|
||||||
str = lpRCstr4096[i-4096].str;
|
|
||||||
else if ((i >= 4352) && (i <= 4607))
|
|
||||||
str = lpRCstr4352[i-4352].str;
|
|
||||||
else if ((i >= 4608) && (i <= 5119))
|
|
||||||
str = lpRCstr4608[i-4608].str;
|
|
||||||
else if ((i >= 5120) && (i <= 5375))
|
|
||||||
str = lpRCstr5120[i-5120].str;
|
|
||||||
else if ((i >= 5376) && (i <= 5631))
|
|
||||||
str = lpRCstr5376[i-5376].str;
|
|
||||||
else if ((i >= 5632) && (i <= 5887))
|
|
||||||
str = lpRCstr5632[i-5632].str;
|
|
||||||
else if ((i >= 5888) && (i <= 6143))
|
|
||||||
str = lpRCstr5888[i-5888].str;
|
|
||||||
else if ((i >= 6144) && (i <= 7167))
|
|
||||||
str = lpRCstr6144[i-6144].str;
|
|
||||||
else
|
|
||||||
str = lpRCstr7168[i-7168].str;
|
|
||||||
|
|
||||||
return((wchar_t *)str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,6 +261,128 @@ ProcessCommandLine(wchar_t ***argw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Load an icon from the resources. */
|
||||||
|
HICON
|
||||||
|
LoadIconEx(PCTSTR name)
|
||||||
|
{
|
||||||
|
return((HICON)LoadImage(hInstance, name, IMAGE_ICON, 16, 16, LR_SHARED));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* For the Windows platform, this is the start of the application. */
|
||||||
|
int WINAPI
|
||||||
|
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
||||||
|
{
|
||||||
|
wchar_t **argw = NULL;
|
||||||
|
int argc, i;
|
||||||
|
|
||||||
|
/* Set this to the default value (windowed mode). */
|
||||||
|
vid_fullscreen = 0;
|
||||||
|
|
||||||
|
/* We need this later. */
|
||||||
|
hInstance = hInst;
|
||||||
|
|
||||||
|
/* Initialize the version data. CrashDump needs it early. */
|
||||||
|
pc_version("Windows");
|
||||||
|
|
||||||
|
#ifdef USE_CRASHDUMP
|
||||||
|
/* Enable crash dump services. */
|
||||||
|
InitCrashDump();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* First, set our (default) language. */
|
||||||
|
plat_set_language(0x0409);
|
||||||
|
|
||||||
|
/* Create console window. */
|
||||||
|
if (force_debug)
|
||||||
|
plat_console(1);
|
||||||
|
|
||||||
|
/* Process the command line for options. */
|
||||||
|
argc = ProcessCommandLine(&argw);
|
||||||
|
|
||||||
|
/* Pre-initialize the system, this loads the config file. */
|
||||||
|
if (! pc_init(argc, argw)) {
|
||||||
|
/* Detach from console. */
|
||||||
|
plat_console(0);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cleanup: we may no longer need the console. */
|
||||||
|
if (! force_debug)
|
||||||
|
plat_console(0);
|
||||||
|
|
||||||
|
/* Create a mutex for the video handler. */
|
||||||
|
hBlitMutex = CreateMutex(NULL, FALSE, MUTEX_NAME);
|
||||||
|
|
||||||
|
/* Handle our GUI. */
|
||||||
|
i = ui_init(nCmdShow);
|
||||||
|
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We do this here since there is platform-specific stuff
|
||||||
|
* going on here, and we do it in a function separate from
|
||||||
|
* main() so we can call it from the UI module as well.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
plat_start(void)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER qpc;
|
||||||
|
|
||||||
|
/* We have not stopped yet. */
|
||||||
|
quited = 0;
|
||||||
|
|
||||||
|
/* Initialize the high-precision timer. */
|
||||||
|
timeBeginPeriod(1);
|
||||||
|
QueryPerformanceFrequency(&qpc);
|
||||||
|
timer_freq = qpc.QuadPart;
|
||||||
|
pclog("Main timer precision: %llu\n", timer_freq);
|
||||||
|
|
||||||
|
/* Start the emulator, really. */
|
||||||
|
thMain = thread_create(pc_thread, &quited);
|
||||||
|
SetThreadPriority(thMain, THREAD_PRIORITY_HIGHEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Cleanly stop the emulator. */
|
||||||
|
void
|
||||||
|
plat_stop(void)
|
||||||
|
{
|
||||||
|
quited = 1;
|
||||||
|
|
||||||
|
plat_delay_ms(100);
|
||||||
|
|
||||||
|
pc_close(thMain);
|
||||||
|
|
||||||
|
thMain = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Set (or re-set) the language for the application. */
|
||||||
|
void
|
||||||
|
plat_set_language(int id)
|
||||||
|
{
|
||||||
|
LCID lcidNew = MAKELCID(id, dwSubLangID);
|
||||||
|
|
||||||
|
if (lang_id != lcidNew) {
|
||||||
|
/* Set our new language ID. */
|
||||||
|
lang_id = lcidNew;
|
||||||
|
|
||||||
|
SetThreadLocale(lang_id);
|
||||||
|
|
||||||
|
/* Load the strings table for this ID. */
|
||||||
|
LoadCommonStrings();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Update the menus for this ID. */
|
||||||
|
MenuUpdate();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_WX
|
#ifndef USE_WX
|
||||||
/* Create a console if we don't already have one. */
|
/* Create a console if we don't already have one. */
|
||||||
void
|
void
|
||||||
@@ -357,101 +426,80 @@ plat_console(int init)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* For the Windows platform, this is the start of the application. */
|
|
||||||
int WINAPI
|
|
||||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
|
||||||
{
|
|
||||||
wchar_t **argw = NULL;
|
|
||||||
int argc, i;
|
|
||||||
|
|
||||||
/* Set this to the default value (windowed mode). */
|
|
||||||
vid_fullscreen = 0;
|
|
||||||
|
|
||||||
/* We need this later. */
|
|
||||||
hinstance = hInst;
|
|
||||||
|
|
||||||
/* Initialize the version data. CrashDump needs it early. */
|
|
||||||
pc_version("Windows");
|
|
||||||
|
|
||||||
#ifdef USE_CRASHDUMP
|
|
||||||
/* Enable crash dump services. */
|
|
||||||
InitCrashDump();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First, set our (default) language. */
|
|
||||||
set_language(0x0409);
|
|
||||||
|
|
||||||
/* Create console window. */
|
|
||||||
if (force_debug)
|
|
||||||
plat_console(1);
|
|
||||||
|
|
||||||
/* Process the command line for options. */
|
|
||||||
argc = ProcessCommandLine(&argw);
|
|
||||||
|
|
||||||
/* Pre-initialize the system, this loads the config file. */
|
|
||||||
if (! pc_init(argc, argw)) {
|
|
||||||
/* Detach from console. */
|
|
||||||
plat_console(0);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cleanup: we may no longer need the console. */
|
|
||||||
if (! force_debug)
|
|
||||||
plat_console(0);
|
|
||||||
|
|
||||||
/* Handle our GUI. */
|
|
||||||
i = ui_init(nCmdShow);
|
|
||||||
|
|
||||||
return(i);
|
|
||||||
}
|
|
||||||
#endif /*USE_WX*/
|
#endif /*USE_WX*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Return icon number based on drive type. */
|
||||||
* We do this here since there is platform-specific stuff
|
int
|
||||||
* going on here, and we do it in a function separate from
|
plat_fdd_icon(int type)
|
||||||
* main() so we can call it from the UI module as well.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
do_start(void)
|
|
||||||
{
|
{
|
||||||
LARGE_INTEGER qpc;
|
int ret = 512;
|
||||||
|
|
||||||
/* We have not stopped yet. */
|
switch(type) {
|
||||||
quited = 0;
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
/* Initialize the high-precision timer. */
|
case 1:
|
||||||
timeBeginPeriod(1);
|
case 2:
|
||||||
QueryPerformanceFrequency(&qpc);
|
case 3:
|
||||||
timer_freq = qpc.QuadPart;
|
case 4:
|
||||||
pclog("Main timer precision: %llu\n", timer_freq);
|
case 5:
|
||||||
|
case 6:
|
||||||
|
ret = 128;
|
||||||
|
break;
|
||||||
|
|
||||||
/* Start the emulator, really. */
|
case 7:
|
||||||
thMain = thread_create(pc_thread, &quited);
|
case 8:
|
||||||
SetThreadPriority(thMain, THREAD_PRIORITY_HIGHEST);
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
ret = 144;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Cleanly stop the emulator. */
|
wchar_t *
|
||||||
void
|
plat_get_string(int i)
|
||||||
do_stop(void)
|
|
||||||
{
|
{
|
||||||
quited = 1;
|
LPTSTR str;
|
||||||
|
|
||||||
plat_delay_ms(100);
|
if ((i >= 2048) && (i <= 3071))
|
||||||
|
str = lpRCstr2048[i-2048].str;
|
||||||
|
else if ((i >= 4096) && (i <= 4351))
|
||||||
|
str = lpRCstr4096[i-4096].str;
|
||||||
|
else if ((i >= 4352) && (i <= 4607))
|
||||||
|
str = lpRCstr4352[i-4352].str;
|
||||||
|
else if ((i >= 4608) && (i <= 5119))
|
||||||
|
str = lpRCstr4608[i-4608].str;
|
||||||
|
else if ((i >= 5120) && (i <= 5375))
|
||||||
|
str = lpRCstr5120[i-5120].str;
|
||||||
|
else if ((i >= 5376) && (i <= 5631))
|
||||||
|
str = lpRCstr5376[i-5376].str;
|
||||||
|
else if ((i >= 5632) && (i <= 5887))
|
||||||
|
str = lpRCstr5632[i-5632].str;
|
||||||
|
else if ((i >= 5888) && (i <= 6143))
|
||||||
|
str = lpRCstr5888[i-5888].str;
|
||||||
|
else if ((i >= 6144) && (i <= 7167))
|
||||||
|
str = lpRCstr6144[i-6144].str;
|
||||||
|
else
|
||||||
|
str = lpRCstr7168[i-7168].str;
|
||||||
|
|
||||||
pc_close(thMain);
|
return((wchar_t *)str);
|
||||||
|
|
||||||
thMain = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
plat_get_exe_name(wchar_t *bufp, int size)
|
plat_get_exe_name(wchar_t *bufp, int size)
|
||||||
{
|
{
|
||||||
GetModuleFileName(hinstance, bufp, size);
|
GetModuleFileName(hInstance, bufp, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -676,9 +724,6 @@ plat_setvid(int api)
|
|||||||
|
|
||||||
/* Close the (old) API. */
|
/* Close the (old) API. */
|
||||||
vid_apis[0][vid_api].close();
|
vid_apis[0][vid_api].close();
|
||||||
//#ifdef USE_WX
|
|
||||||
// ui_check_menu_item(IDM_View_WX+vid_api, 0);
|
|
||||||
//#endif
|
|
||||||
vid_api = api;
|
vid_api = api;
|
||||||
|
|
||||||
#ifndef USE_WX
|
#ifndef USE_WX
|
||||||
@@ -690,11 +735,14 @@ plat_setvid(int api)
|
|||||||
|
|
||||||
/* Initialize the (new) API. */
|
/* Initialize the (new) API. */
|
||||||
#ifdef USE_WX
|
#ifdef USE_WX
|
||||||
// ui_check_menu_item(IDM_View_WX+vid_api, 1);
|
|
||||||
i = vid_apis[0][vid_api].init(NULL);
|
i = vid_apis[0][vid_api].init(NULL);
|
||||||
#else
|
#else
|
||||||
i = vid_apis[0][vid_api].init((void *)hwndRender);
|
i = vid_apis[0][vid_api].init((void *)hwndRender);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Update the menu item. */
|
||||||
|
menu_set_radio_item(IDM_RENDER_1, 4, vid_api);
|
||||||
|
|
||||||
endblit();
|
endblit();
|
||||||
if (! i) return(0);
|
if (! i) return(0);
|
||||||
|
|
||||||
@@ -763,8 +811,10 @@ plat_setfullscreen(int on)
|
|||||||
device_force_redraw();
|
device_force_redraw();
|
||||||
|
|
||||||
/* Finally, handle the host's mouse cursor. */
|
/* Finally, handle the host's mouse cursor. */
|
||||||
/* pclog("%s full screen, %s cursor\n", on ? "enter" : "leave", on ? "hide" : "show"); */
|
#if 0
|
||||||
show_cursor(vid_fullscreen ? 0 : -1);
|
pclog("%s full screen, %s cursor\n", on ? "enter" : "leave", on ? "hide" : "show");
|
||||||
|
#endif
|
||||||
|
ui_show_cursor(vid_fullscreen ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -822,12 +872,12 @@ take_screenshot(void)
|
|||||||
void /* plat_ */
|
void /* plat_ */
|
||||||
startblit(void)
|
startblit(void)
|
||||||
{
|
{
|
||||||
WaitForSingleObject(ghMutex, INFINITE);
|
WaitForSingleObject(hBlitMutex, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void /* plat_ */
|
void /* plat_ */
|
||||||
endblit(void)
|
endblit(void)
|
||||||
{
|
{
|
||||||
ReleaseMutex(ghMutex);
|
ReleaseMutex(hBlitMutex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Platform support defintions for Win32.
|
* Platform support defintions for Win32.
|
||||||
*
|
*
|
||||||
* Version: @(#)win.h 1.0.8 2018/04/29
|
* Version: @(#)win.h 1.0.10 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
#ifndef PLAT_WIN_H
|
#ifndef PLAT_WIN_H
|
||||||
# define PLAT_WIN_H
|
# define PLAT_WIN_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -48,80 +49,70 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
/* Class names and such. */
|
/* Class names and such. */
|
||||||
#define CLASS_NAME L"VARCem.MainWnd"
|
#define MUTEX_NAME L"VARCem.BlitMutex"
|
||||||
|
#define CLASS_NAME L"VARCem.MainWindow"
|
||||||
|
#define FS_CLASS_NAME L"VARCem.FullScreen"
|
||||||
#define MENU_NAME L"MainMenu"
|
#define MENU_NAME L"MainMenu"
|
||||||
#define ACCEL_NAME L"MainAccel"
|
|
||||||
#define SUB_CLASS_NAME L"VARCem.SubWnd"
|
|
||||||
#define SB_CLASS_NAME L"VARCem.StatusBar"
|
|
||||||
#define SB_MENU_NAME L"StatusBarMenu"
|
#define SB_MENU_NAME L"StatusBarMenu"
|
||||||
|
#define ACCEL_NAME L"MainAccel"
|
||||||
|
|
||||||
/* Application-specific window messages. */
|
/* Application-specific window messages. */
|
||||||
#define WM_RESETD3D WM_USER
|
#define WM_PAUSE WM_USER
|
||||||
#define WM_LEAVEFULLSCREEN WM_USER+1
|
#define WM_LEAVEFULLSCREEN WM_USER+1
|
||||||
#define WM_SAVESETTINGS 0x8888
|
#define WM_RESETD3D WM_USER+2
|
||||||
#define WM_SHOWSETTINGS 0x8889
|
#define WM_SAVESETTINGS WM_USER+3
|
||||||
#define WM_PAUSE 0x8890
|
#define WM_SHOWSETTINGS WM_USER+4
|
||||||
#define WM_SENDHWND 0x8891
|
|
||||||
|
|
||||||
|
|
||||||
extern HINSTANCE hinstance;
|
/* Status bar definitions. */
|
||||||
|
#define SB_HEIGHT 16 /* for 16x16 icons */
|
||||||
|
#define SB_PADDING 1 /* 1px of padding */
|
||||||
|
|
||||||
|
|
||||||
|
extern HINSTANCE hInstance;
|
||||||
|
extern HICON hIcon[512];
|
||||||
extern HWND hwndMain,
|
extern HWND hwndMain,
|
||||||
hwndRender;
|
hwndRender;
|
||||||
extern HANDLE ghMutex;
|
|
||||||
extern LCID lang_id;
|
extern LCID lang_id;
|
||||||
extern HICON hIcon[512];
|
|
||||||
|
|
||||||
extern int status_is_open;
|
extern int status_is_open;
|
||||||
|
|
||||||
extern DWORD filterindex;
|
extern DWORD filterindex;
|
||||||
|
|
||||||
|
|
||||||
|
/* Internal platform support functions. */
|
||||||
#ifdef USE_CRASHDUMP
|
#ifdef USE_CRASHDUMP
|
||||||
extern void InitCrashDump(void);
|
extern void InitCrashDump(void);
|
||||||
#endif
|
#endif
|
||||||
|
extern HICON LoadIconEx(PCTSTR name);
|
||||||
extern HICON LoadIconEx(PCTSTR pszIconName);
|
|
||||||
|
|
||||||
/* Emulator start/stop support functions. */
|
|
||||||
extern void do_start(void);
|
|
||||||
extern void do_stop(void);
|
|
||||||
|
|
||||||
/* Internal platform support functions. */
|
|
||||||
extern void set_language(int id);
|
|
||||||
extern int get_vidpause(void);
|
|
||||||
extern void show_cursor(int);
|
|
||||||
|
|
||||||
extern void keyboard_getkeymap(void);
|
extern void keyboard_getkeymap(void);
|
||||||
extern void keyboard_handle(LPARAM lParam, int infocus);
|
extern void keyboard_handle(LPARAM lParam, int infocus);
|
||||||
|
|
||||||
extern void win_mouse_init(void);
|
extern void win_mouse_init(void);
|
||||||
extern void win_mouse_close(void);
|
extern void win_mouse_close(void);
|
||||||
|
|
||||||
extern intptr_t fdd_type_to_icon(int type);
|
/* Internal dialog functions. */
|
||||||
|
|
||||||
#ifdef EMU_DEVICE_H
|
|
||||||
extern uint8_t deviceconfig_open(HWND hwnd, device_t *device);
|
|
||||||
#endif
|
|
||||||
extern uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
|
||||||
|
|
||||||
extern int getfile(HWND hwnd, char *f, char *fn);
|
|
||||||
extern int getsfile(HWND hwnd, char *f, char *fn);
|
|
||||||
|
|
||||||
extern void hard_disk_add_open(HWND hwnd, int is_existing);
|
|
||||||
extern int hard_disk_was_added(void);
|
|
||||||
|
|
||||||
/* Platform UI support functions. */
|
|
||||||
extern int ui_init(int nCmdShow);
|
|
||||||
|
|
||||||
/* Functions in win_stbar.c: */
|
|
||||||
extern HWND hwndSBAR;
|
|
||||||
extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus,
|
|
||||||
HINSTANCE hInst);
|
|
||||||
|
|
||||||
/* Functions in win_dialog.c: */
|
|
||||||
extern void dialog_center(HWND hdlg);
|
extern void dialog_center(HWND hdlg);
|
||||||
extern int dlg_file_ex(HWND hwnd, const wchar_t *filt,
|
extern int dlg_file_ex(HWND hwnd, const wchar_t *filt,
|
||||||
const wchar_t *ifn, wchar_t *fn, int save);
|
const wchar_t *ifn, wchar_t *fn, int save);
|
||||||
|
#ifdef EMU_DEVICE_H
|
||||||
|
extern uint8_t dlg_devconf(HWND hwnd, device_t *device);
|
||||||
|
#endif
|
||||||
|
extern uint8_t dlg_jsconf(HWND hwnd, int joy_nr, int type);
|
||||||
|
|
||||||
|
/* Platform support functions. */
|
||||||
|
extern void plat_set_language(int id);
|
||||||
|
extern int get_vidpause(void);
|
||||||
|
extern int fdd_type_icon(int type);
|
||||||
|
|
||||||
|
/* Emulator start/stop support functions. */
|
||||||
|
extern void plat_start(void);
|
||||||
|
extern void plat_stop(void);
|
||||||
|
|
||||||
|
/* Platform UI support functions. */
|
||||||
|
extern int ui_init(int nCmdShow);
|
||||||
|
extern void ui_menu_update(void);
|
||||||
|
extern void ui_show_cursor(int);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handle the About dialog.
|
* Handle the About dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_about.c 1.0.6 2018/04/27
|
* Version: @(#)win_about.c 1.0.7 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -90,7 +90,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
h = GetDlgItem(hdlg, IDC_ABOUT_ICON);
|
h = GetDlgItem(hdlg, IDC_ABOUT_ICON);
|
||||||
SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON,
|
SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON,
|
||||||
(LPARAM)LoadImage(hinstance,(PCTSTR)100,IMAGE_ICON,64,64,0));
|
(LPARAM)LoadImage(hInstance,(PCTSTR)100,IMAGE_ICON,64,64,0));
|
||||||
SendDlgItemMessage(hdlg, IDT_TITLE, WM_SETTEXT,
|
SendDlgItemMessage(hdlg, IDT_TITLE, WM_SETTEXT,
|
||||||
(WPARAM)NULL, (LPARAM)emu_title);
|
(WPARAM)NULL, (LPARAM)emu_title);
|
||||||
set_font_bold(hdlg, IDT_TITLE);
|
set_font_bold(hdlg, IDT_TITLE);
|
||||||
@@ -121,7 +121,7 @@ dlg_about(void)
|
|||||||
{
|
{
|
||||||
plat_pause(1);
|
plat_pause(1);
|
||||||
|
|
||||||
DialogBox(hinstance, (LPCTSTR)DLG_ABOUT, hwndMain, dlg_proc);
|
DialogBox(hInstance, (LPCTSTR)DLG_ABOUT, hwndMain, dlg_proc);
|
||||||
|
|
||||||
plat_pause(0);
|
plat_pause(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Rendering module for Microsoft Direct3D 9.
|
* Rendering module for Microsoft Direct3D 9.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_d3d.cpp 1.0.8 2018/04/25
|
* Version: @(#)win_d3d.cpp 1.0.9 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -479,9 +479,8 @@ d3d_init_fs(HWND h)
|
|||||||
|
|
||||||
/*FIXME: should be done once, in win.c */
|
/*FIXME: should be done once, in win.c */
|
||||||
_swprintf(title, L"%s v%s", TEXT(EMU_NAME), TEXT(EMU_VERSION));
|
_swprintf(title, L"%s v%s", TEXT(EMU_NAME), TEXT(EMU_VERSION));
|
||||||
d3d_device_window = CreateWindowEx (
|
d3d_device_window = CreateWindow(
|
||||||
0,
|
FS_CLASS_NAME,
|
||||||
SUB_CLASS_NAME,
|
|
||||||
title,
|
title,
|
||||||
WS_POPUP,
|
WS_POPUP,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* and builds a complete Win32 DIALOG resource block in a
|
* and builds a complete Win32 DIALOG resource block in a
|
||||||
* buffer in memory, and then passes that to the API handler.
|
* buffer in memory, and then passes that to the API handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_devconf.c 1.0.14 2018/04/29
|
* Version: @(#)win_devconf.c 1.0.15 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -447,7 +447,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
*/
|
*/
|
||||||
#define DLG_MAX_SIZE 16384
|
#define DLG_MAX_SIZE 16384
|
||||||
uint8_t
|
uint8_t
|
||||||
deviceconfig_open(HWND hwnd, device_t *device)
|
dlg_devconf(HWND hwnd, device_t *device)
|
||||||
{
|
{
|
||||||
char temp[128];
|
char temp[128];
|
||||||
const device_config_t *cfg = device->config;
|
const device_config_t *cfg = device->config;
|
||||||
@@ -703,7 +703,7 @@ deviceconfig_open(HWND hwnd, device_t *device)
|
|||||||
|
|
||||||
devconf_device = device;
|
devconf_device = device;
|
||||||
|
|
||||||
DialogBoxIndirect(hinstance, dlg, hwnd, dlg_proc);
|
DialogBoxIndirect(hInstance, dlg, hwnd, dlg_proc);
|
||||||
|
|
||||||
free(blk);
|
free(blk);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* NOTE: Hacks currently needed to compile with MSVC; DX needs to
|
* NOTE: Hacks currently needed to compile with MSVC; DX needs to
|
||||||
* be updated to 11 or 12 or so. --FvK
|
* be updated to 11 or 12 or so. --FvK
|
||||||
*
|
*
|
||||||
* Version: @(#)win_joystick.cpp 1.0.10 2018/04/26
|
* Version: @(#)win_joystick.cpp 1.0.11 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -180,7 +180,7 @@ joystick_init(void)
|
|||||||
|
|
||||||
joysticks_present = 0;
|
joysticks_present = 0;
|
||||||
|
|
||||||
if (FAILED(DirectInput8Create(hinstance,
|
if (FAILED(DirectInput8Create(hInstance,
|
||||||
DIRECTINPUT_VERSION, IID_IDirectInput8A,
|
DIRECTINPUT_VERSION, IID_IDirectInput8A,
|
||||||
(void **) &lpdi, NULL)))
|
(void **) &lpdi, NULL)))
|
||||||
fatal("joystick_init : DirectInputCreate failed\n");
|
fatal("joystick_init : DirectInputCreate failed\n");
|
||||||
@@ -615,7 +615,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
|
|||||||
|
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
dlg_jsconf(HWND hwnd, int joy_nr, int type)
|
||||||
{
|
{
|
||||||
uint16_t *data_block = (uint16_t *)malloc(16384);
|
uint16_t *data_block = (uint16_t *)malloc(16384);
|
||||||
uint16_t *data;
|
uint16_t *data;
|
||||||
@@ -831,7 +831,7 @@ joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
|||||||
|
|
||||||
dlg->cy = y + 20;
|
dlg->cy = y + 20;
|
||||||
|
|
||||||
DialogBoxIndirect(hinstance, dlg, hwnd, dlg_proc);
|
DialogBoxIndirect(hInstance, dlg, hwnd, dlg_proc);
|
||||||
|
|
||||||
free(data_block);
|
free(data_block);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Mouse interface to host device.
|
* Mouse interface to host device.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_mouse.cpp 1.0.4 2018/04/26
|
* Version: @(#)win_mouse.cpp 1.0.5 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -62,7 +62,7 @@ win_mouse_init(void)
|
|||||||
|
|
||||||
mouse_capture = 0;
|
mouse_capture = 0;
|
||||||
|
|
||||||
if (FAILED(DirectInput8Create(hinstance, DIRECTINPUT_VERSION,
|
if (FAILED(DirectInput8Create(hInstance, DIRECTINPUT_VERSION,
|
||||||
IID_IDirectInput8A, (void **) &lpdi, NULL)))
|
IID_IDirectInput8A, (void **) &lpdi, NULL)))
|
||||||
fatal("plat_mouse_init: DirectInputCreate failed\n");
|
fatal("plat_mouse_init: DirectInputCreate failed\n");
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the New Floppy Image dialog.
|
* Implementation of the New Floppy Image dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_new_floppy.c 1.0.11 2018/04/29
|
* Version: @(#)win_new_floppy.c 1.0.12 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -265,5 +265,5 @@ dlg_new_floppy(int idm, int tag)
|
|||||||
fdd_id = idm & 0x7f;
|
fdd_id = idm & 0x7f;
|
||||||
sb_part = tag;
|
sb_part = tag;
|
||||||
|
|
||||||
DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwndMain, dlg_proc);
|
DialogBox(hInstance, (LPCTSTR)DLG_NEW_FLOPPY, hwndMain, dlg_proc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings.c 1.0.26 2018/04/29
|
* Version: @(#)win_settings.c 1.0.27 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -167,7 +167,7 @@ settings_msgbox(int type, void *arg)
|
|||||||
|
|
||||||
/* This does the initial read of global variables into the temporary ones. */
|
/* This does the initial read of global variables into the temporary ones. */
|
||||||
static void
|
static void
|
||||||
dlg_init(void)
|
settings_init(void)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -451,61 +451,61 @@ show_child(HWND hwndParent, DWORD child_id)
|
|||||||
|
|
||||||
switch(child_id) {
|
switch(child_id) {
|
||||||
case PAGE_MACHINE:
|
case PAGE_MACHINE:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_MACHINE,
|
(LPCWSTR)DLG_CFG_MACHINE,
|
||||||
hwndParent, machine_proc);
|
hwndParent, machine_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_VIDEO:
|
case PAGE_VIDEO:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_VIDEO,
|
(LPCWSTR)DLG_CFG_VIDEO,
|
||||||
hwndParent, video_proc);
|
hwndParent, video_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_INPUT:
|
case PAGE_INPUT:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_INPUT,
|
(LPCWSTR)DLG_CFG_INPUT,
|
||||||
hwndParent, input_proc);
|
hwndParent, input_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_SOUND:
|
case PAGE_SOUND:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_SOUND,
|
(LPCWSTR)DLG_CFG_SOUND,
|
||||||
hwndParent, sound_proc);
|
hwndParent, sound_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_NETWORK:
|
case PAGE_NETWORK:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_NETWORK,
|
(LPCWSTR)DLG_CFG_NETWORK,
|
||||||
hwndParent, network_proc);
|
hwndParent, network_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_PORTS:
|
case PAGE_PORTS:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_PORTS,
|
(LPCWSTR)DLG_CFG_PORTS,
|
||||||
hwndParent, ports_proc);
|
hwndParent, ports_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_PERIPHERALS:
|
case PAGE_PERIPHERALS:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_PERIPHERALS,
|
(LPCWSTR)DLG_CFG_PERIPHERALS,
|
||||||
hwndParent, peripherals_proc);
|
hwndParent, peripherals_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_HARD_DISKS:
|
case PAGE_HARD_DISKS:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_DISK,
|
(LPCWSTR)DLG_CFG_DISK,
|
||||||
hwndParent, disk_proc);
|
hwndParent, disk_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_FLOPPY_DRIVES:
|
case PAGE_FLOPPY_DRIVES:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_FLOPPY,
|
(LPCWSTR)DLG_CFG_FLOPPY,
|
||||||
hwndParent, floppy_proc);
|
hwndParent, floppy_proc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAGE_OTHER_REMOVABLE_DEVICES:
|
case PAGE_OTHER_REMOVABLE_DEVICES:
|
||||||
hwndChildDialog = CreateDialog(hinstance,
|
hwndChildDialog = CreateDialog(hInstance,
|
||||||
(LPCWSTR)DLG_CFG_RMV_DEVICES,
|
(LPCWSTR)DLG_CFG_RMV_DEVICES,
|
||||||
hwndParent, rmv_devices_proc);
|
hwndParent, rmv_devices_proc);
|
||||||
break;
|
break;
|
||||||
@@ -531,7 +531,7 @@ image_list_init(HWND hwndList)
|
|||||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||||
|
|
||||||
for (i=0; i<10; i++) {
|
for (i=0; i<10; i++) {
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + (uintptr_t) i));
|
hiconItem = LoadIcon(hInstance, (LPCWSTR) (256 + (uintptr_t) i));
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
dialog_center(hdlg);
|
dialog_center(hdlg);
|
||||||
dlg_init();
|
settings_init();
|
||||||
|
|
||||||
disk_track_init();
|
disk_track_init();
|
||||||
cdrom_track_init();
|
cdrom_track_init();
|
||||||
@@ -674,7 +674,7 @@ dlg_settings(int ask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ask_sure = ask;
|
ask_sure = ask;
|
||||||
i = DialogBox(hinstance, (LPCWSTR)DLG_CONFIG, hwndMain, dlg_proc);
|
i = DialogBox(hInstance, (LPCWSTR)DLG_CONFIG, hwndMain, dlg_proc);
|
||||||
|
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_disk.h 1.0.6 2018/04/29
|
* Version: @(#)win_settings_disk.h 1.0.7 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -100,11 +100,11 @@ disk_image_list_init(HWND hwndList)
|
|||||||
GetSystemMetrics(SM_CYSMICON),
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)208);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)208);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)192);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)192);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
@@ -1452,7 +1452,7 @@ disk_add_open(HWND hwnd, int is_existing)
|
|||||||
|
|
||||||
hard_disk_added = 0;
|
hard_disk_added = 0;
|
||||||
|
|
||||||
DialogBox(hinstance, (LPCWSTR)DLG_CFG_DISK_ADD, hwnd, disk_add_proc);
|
DialogBox(hInstance, (LPCWSTR)DLG_CFG_DISK_ADD, hwnd, disk_add_proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_floppy.h 1.0.3 2018/04/29
|
* Version: @(#)win_settings_floppy.h 1.0.4 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -58,7 +58,7 @@ floppy_image_list_init(HWND hwndList)
|
|||||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||||
|
|
||||||
for (i = 0; i < 14; i++) {
|
for (i = 0; i < 14; i++) {
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)sb_fdd_icon(i));
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)plat_fdd_icon(i));
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_input.h 1.0.6 2018/04/29
|
* Version: @(#)win_settings_input.h 1.0.7 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -135,7 +135,7 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case IDC_CONFIGURE_MOUSE:
|
case IDC_CONFIGURE_MOUSE:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
|
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
|
||||||
temp_mouse = list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_mouse = list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)mouse_get_device(temp_mouse));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)mouse_get_device(temp_mouse));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_COMBO_JOYSTICK:
|
case IDC_COMBO_JOYSTICK:
|
||||||
@@ -155,25 +155,25 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case IDC_JOY1:
|
case IDC_JOY1:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
||||||
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
temp_deviceconfig |= joystickconfig_open(hdlg, 0, temp_joystick);
|
temp_deviceconfig |= dlg_jsconf(hdlg, 0, temp_joystick);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_JOY2:
|
case IDC_JOY2:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
||||||
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
temp_deviceconfig |= joystickconfig_open(hdlg, 1, temp_joystick);
|
temp_deviceconfig |= dlg_jsconf(hdlg, 1, temp_joystick);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_JOY3:
|
case IDC_JOY3:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
||||||
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
temp_deviceconfig |= joystickconfig_open(hdlg, 2, temp_joystick);
|
temp_deviceconfig |= dlg_jsconf(hdlg, 2, temp_joystick);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_JOY4:
|
case IDC_JOY4:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
||||||
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
temp_deviceconfig |= joystickconfig_open(hdlg, 3, temp_joystick);
|
temp_deviceconfig |= dlg_jsconf(hdlg, 3, temp_joystick);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_machine.h 1.0.4 2018/04/29
|
* Version: @(#)win_settings_machine.h 1.0.5 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -281,7 +281,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
|
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
|
||||||
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)machine_getdevice(temp_machine));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)machine_getdevice(temp_machine));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_network.h 1.0.4 2018/04/29
|
* Version: @(#)win_settings_network.h 1.0.5 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -184,7 +184,7 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
h = GetDlgItem(hdlg, IDC_COMBO_NET);
|
h = GetDlgItem(hdlg, IDC_COMBO_NET);
|
||||||
temp_net_card = list_to_nic[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_net_card = list_to_nic[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)network_card_getdevice(temp_net_card));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_periph.h 1.0.5 2018/04/29
|
* Version: @(#)win_settings_periph.h 1.0.6 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -212,14 +212,14 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
|
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
|
||||||
temp_scsi_card = list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_scsi_card = list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)scsi_card_getdevice(temp_scsi_card));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)scsi_card_getdevice(temp_scsi_card));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_CONFIGURE_HDC:
|
case IDC_CONFIGURE_HDC:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||||
temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]);
|
temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]);
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)hdc_get_device(temp_hdc_type));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)hdc_get_device(temp_hdc_type));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_COMBO_SCSI:
|
case IDC_COMBO_SCSI:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the "Removable Devices" dialog.
|
* Implementation of the "Removable Devices" dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_remov.h 1.0.4 2018/04/30
|
* Version: @(#)win_settings_remov.h 1.0.5 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -88,11 +88,11 @@ cdrom_image_list_init(HWND hwndList)
|
|||||||
GetSystemMetrics(SM_CYSMICON),
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)514);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)514);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)160);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)160);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
@@ -435,11 +435,11 @@ zip_image_list_init(HWND hwndList)
|
|||||||
GetSystemMetrics(SM_CYSMICON),
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
ILC_MASK | ILC_COLOR32, 1, 1);
|
ILC_MASK | ILC_COLOR32, 1, 1);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)515);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)515);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
hiconItem = LoadIcon(hinstance, (LPCWSTR)176);
|
hiconItem = LoadIcon(hInstance, (LPCWSTR)176);
|
||||||
ImageList_AddIcon(hSmall, hiconItem);
|
ImageList_AddIcon(hSmall, hiconItem);
|
||||||
DestroyIcon(hiconItem);
|
DestroyIcon(hiconItem);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_sound.h 1.0.6 2018/04/29
|
* Version: @(#)win_settings_sound.h 1.0.7 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -194,7 +194,7 @@ sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
|
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
|
||||||
temp_sound_card = list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_sound_card = list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)sound_card_getdevice(temp_sound_card));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)sound_card_getdevice(temp_sound_card));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_COMBO_MIDI:
|
case IDC_COMBO_MIDI:
|
||||||
@@ -219,7 +219,7 @@ sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
|
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
|
||||||
temp_midi_device = list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_midi_device = list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
|
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)midi_device_getdevice(temp_midi_device));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_CHECK_MPU401:
|
case IDC_CHECK_MPU401:
|
||||||
@@ -231,7 +231,7 @@ sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_CONFIGURE_MPU401:
|
case IDC_CONFIGURE_MPU401:
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&mpu401_device);
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)&mpu401_device);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings_video.h 1.0.3 2018/04/29
|
* Version: @(#)win_settings_video.h 1.0.4 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -159,14 +159,14 @@ video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_BUTTON_VOODOO:
|
case IDC_BUTTON_VOODOO:
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&voodoo_device);
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)&voodoo_device);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_CONFIGURE_VID:
|
case IDC_CONFIGURE_VID:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
||||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
|
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
|
||||||
wcstombs(tempA, temp, sizeof(temp));
|
wcstombs(tempA, temp, sizeof(temp));
|
||||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(tempA)));
|
temp_deviceconfig |= dlg_devconf(hdlg, (void *)video_card_getdevice(video_card_getid(tempA)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Sound Gain dialog.
|
* Implementation of the Sound Gain dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_snd_gain.c 1.0.4 2018/04/29
|
* Version: @(#)win_snd_gain.c 1.0.5 2018/05/01
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -65,6 +65,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
dialog_center(hdlg);
|
||||||
old_gain = sound_gain;
|
old_gain = sound_gain;
|
||||||
h = GetDlgItem(hdlg, IDC_SLIDER_GAIN);
|
h = GetDlgItem(hdlg, IDC_SLIDER_GAIN);
|
||||||
SendMessage(h, TBM_SETRANGE, (WPARAM)1, (LPARAM)MAKELONG(0, 9));
|
SendMessage(h, TBM_SETRANGE, (WPARAM)1, (LPARAM)MAKELONG(0, 9));
|
||||||
@@ -107,5 +108,5 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
void
|
void
|
||||||
dlg_sound_gain(void)
|
dlg_sound_gain(void)
|
||||||
{
|
{
|
||||||
DialogBox(hinstance, (LPCTSTR)DLG_SND_GAIN, hwndMain, dlg_proc);
|
DialogBox(hInstance, (LPCTSTR)DLG_SND_GAIN, hwndMain, dlg_proc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Status Window dialog.
|
* Implementation of the Status Window dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_status.c 1.0.4 2018/04/27
|
* Version: @(#)win_status.c 1.0.5 2018/05/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -144,7 +144,7 @@ dlg_status(void)
|
|||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
hwnd = CreateDialog(hinstance, (LPCSTR)DLG_STATUS, hwndMain, dlg_proc);
|
hwnd = CreateDialog(hInstance, (LPCSTR)DLG_STATUS, hwndMain, dlg_proc);
|
||||||
|
|
||||||
ShowWindow(hwnd, SW_SHOW);
|
ShowWindow(hwnd, SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,337 +0,0 @@
|
|||||||
/*
|
|
||||||
* VARCem Virtual ARchaeological Computer EMulator.
|
|
||||||
* An emulator of (mostly) x86-based PC systems and devices,
|
|
||||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
|
||||||
* spanning the era between 1981 and 1995.
|
|
||||||
*
|
|
||||||
* This file is part of the VARCem Project.
|
|
||||||
*
|
|
||||||
* Implementation of the Status Bar module.
|
|
||||||
*
|
|
||||||
* Version: @(#)win_stbar.c 1.0.13 2018/04/29
|
|
||||||
*
|
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
|
||||||
*
|
|
||||||
* Copyright 2017,2018 Fred N. van Kempen.
|
|
||||||
* Copyright 2016-2018 Miran Grca.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the:
|
|
||||||
*
|
|
||||||
* Free Software Foundation, Inc.
|
|
||||||
* 59 Temple Place - Suite 330
|
|
||||||
* Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
|
||||||
#define UNICODE
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
#include <commctrl.h>
|
|
||||||
#include <commdlg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include "../emu.h"
|
|
||||||
#include "../ui/ui.h"
|
|
||||||
#include "../plat.h"
|
|
||||||
#include "win.h"
|
|
||||||
|
|
||||||
#ifndef GWL_WNDPROC
|
|
||||||
#define GWL_WNDPROC GWLP_WNDPROC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define SBAR_HEIGHT 17 /* for 16x16 icons */
|
|
||||||
|
|
||||||
|
|
||||||
HWND hwndSBAR;
|
|
||||||
|
|
||||||
|
|
||||||
static LONG_PTR OriginalProcedure;
|
|
||||||
static HMENU menuSBAR;
|
|
||||||
static HMENU *sb_menu;
|
|
||||||
static int sb_nparts;
|
|
||||||
|
|
||||||
|
|
||||||
static VOID APIENTRY
|
|
||||||
PopupMenu(HWND hwnd, POINT pt, int part)
|
|
||||||
{
|
|
||||||
if (part >= (sb_nparts - 1)) return;
|
|
||||||
|
|
||||||
pt.x = part * SB_ICON_WIDTH; /* justify to the left */
|
|
||||||
pt.y = 0; /* justify to the top */
|
|
||||||
|
|
||||||
ClientToScreen(hwnd, (LPPOINT)&pt);
|
|
||||||
|
|
||||||
TrackPopupMenu(sb_menu[part],
|
|
||||||
TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON,
|
|
||||||
pt.x, pt.y, 0, hwndSBAR, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle messages for the Status Bar window. */
|
|
||||||
#ifdef __amd64__
|
|
||||||
static LRESULT CALLBACK
|
|
||||||
#else
|
|
||||||
static BOOL CALLBACK
|
|
||||||
#endif
|
|
||||||
dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
RECT r;
|
|
||||||
POINT pt;
|
|
||||||
int idm, tag;
|
|
||||||
|
|
||||||
switch (message) {
|
|
||||||
case WM_COMMAND:
|
|
||||||
idm = LOWORD(wParam) & 0xff00; /* low 8 bits */
|
|
||||||
tag = LOWORD(wParam) & 0x00ff; /* high 8 bits */
|
|
||||||
ui_sb_menu_command(idm, tag);
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
GetClientRect(hwnd, (LPRECT)&r);
|
|
||||||
pt.x = GET_X_LPARAM(lParam);
|
|
||||||
pt.y = GET_Y_LPARAM(lParam);
|
|
||||||
if (PtInRect((LPRECT)&r, pt))
|
|
||||||
PopupMenu(hwnd, pt, (pt.x / SB_ICON_WIDTH));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
|
||||||
GetClientRect(hwnd, (LPRECT)&r);
|
|
||||||
pt.x = GET_X_LPARAM(lParam);
|
|
||||||
pt.y = GET_Y_LPARAM(lParam);
|
|
||||||
tag = (pt.x / SB_ICON_WIDTH);
|
|
||||||
if (PtInRect((LPRECT)&r, pt))
|
|
||||||
ui_sb_click(tag);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return(CallWindowProc((WNDPROC)OriginalProcedure,
|
|
||||||
hwnd, message, wParam, lParam));
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Create and set up the Status Bar window. */
|
|
||||||
void
|
|
||||||
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
|
||||||
{
|
|
||||||
intptr_t i;
|
|
||||||
int dw, dh;
|
|
||||||
RECT r;
|
|
||||||
|
|
||||||
/* Load our icons into the cache for faster access. */
|
|
||||||
for (i = 128; i < 130; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 144; i < 146; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 160; i < 162; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 176; i < 178; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 192; i < 194; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 208; i < 210; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 224; i < 226; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 259; i < 260; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 384; i < 386; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 400; i < 402; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 416; i < 418; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 432; i < 434; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
for (i = 448; i < 450; i++)
|
|
||||||
hIcon[i] = LoadIconEx((PCTSTR)i);
|
|
||||||
|
|
||||||
GetWindowRect(hwndParent, &r);
|
|
||||||
dw = r.right - r.left;
|
|
||||||
dh = r.bottom - r.top;
|
|
||||||
|
|
||||||
/* Load the Common Controls DLL if needed. */
|
|
||||||
InitCommonControls();
|
|
||||||
|
|
||||||
/* Create the window, and make sure it's using the STATUS class. */
|
|
||||||
hwndSBAR = CreateWindowEx(0,
|
|
||||||
STATUSCLASSNAME,
|
|
||||||
(LPCTSTR)NULL,
|
|
||||||
SBARS_SIZEGRIP|WS_CHILD|WS_VISIBLE|SBT_TOOLTIPS,
|
|
||||||
0, dh-SBAR_HEIGHT, dw, SBAR_HEIGHT,
|
|
||||||
hwndParent,
|
|
||||||
(HMENU)idStatus, hInst, NULL);
|
|
||||||
|
|
||||||
/* Replace the original procedure with ours. */
|
|
||||||
OriginalProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC);
|
|
||||||
SetWindowLongPtr(hwndSBAR, GWL_WNDPROC, (LONG_PTR)&dlg_proc);
|
|
||||||
|
|
||||||
SendMessage(hwndSBAR, SB_SETMINHEIGHT, (WPARAM)SBAR_HEIGHT, (LPARAM)0);
|
|
||||||
|
|
||||||
/* Align the window with the parent (main) window. */
|
|
||||||
GetWindowRect(hwndSBAR, &r);
|
|
||||||
SetWindowPos(hwndSBAR,
|
|
||||||
HWND_TOPMOST,
|
|
||||||
r.left, r.top, r.right-r.left, r.bottom-r.top,
|
|
||||||
SWP_SHOWWINDOW);
|
|
||||||
|
|
||||||
/* Load the dummu menu for this window. */
|
|
||||||
menuSBAR = LoadMenu(hInst, SB_MENU_NAME);
|
|
||||||
|
|
||||||
/* Clear the menus, just in case.. */
|
|
||||||
sb_nparts = 0;
|
|
||||||
sb_menu = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Also used by win_settings.c */
|
|
||||||
int
|
|
||||||
sb_fdd_icon(int type)
|
|
||||||
{
|
|
||||||
int ret = 512;
|
|
||||||
|
|
||||||
switch(type) {
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
ret = 128;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 12:
|
|
||||||
case 13:
|
|
||||||
ret = 144;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_setup(int parts, const int *widths)
|
|
||||||
{
|
|
||||||
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)parts, (LPARAM)widths);
|
|
||||||
|
|
||||||
if (sb_menu != NULL)
|
|
||||||
sb_menu_destroy();
|
|
||||||
|
|
||||||
sb_menu = (HMENU *)malloc(parts * sizeof(HMENU));
|
|
||||||
memset(sb_menu, 0x00, parts * sizeof(HMENU));
|
|
||||||
|
|
||||||
sb_nparts = parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_menu_destroy(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!sb_nparts || (sb_menu == NULL)) return;
|
|
||||||
|
|
||||||
for (i = 0; i < sb_nparts; i++) {
|
|
||||||
if (sb_menu[i] != NULL)
|
|
||||||
DestroyMenu(sb_menu[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(sb_menu);
|
|
||||||
|
|
||||||
sb_menu = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Create a menu for a status bar part. */
|
|
||||||
void
|
|
||||||
sb_menu_create(int part)
|
|
||||||
{
|
|
||||||
HMENU h;
|
|
||||||
|
|
||||||
h = CreatePopupMenu();
|
|
||||||
|
|
||||||
sb_menu[part] = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Add an item to a (status bar) menu. */
|
|
||||||
void
|
|
||||||
sb_menu_add_item(int part, int idm, const wchar_t *str)
|
|
||||||
{
|
|
||||||
if (idm >= 0)
|
|
||||||
AppendMenu(sb_menu[part], MF_STRING, idm, str);
|
|
||||||
else
|
|
||||||
AppendMenu(sb_menu[part], MF_SEPARATOR, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_menu_enable_item(int part, int idm, int val)
|
|
||||||
{
|
|
||||||
EnableMenuItem(sb_menu[part], idm,
|
|
||||||
val ? MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_menu_set_item(int part, int idm, int val)
|
|
||||||
{
|
|
||||||
CheckMenuItem(sb_menu[part], idm, val ? MF_CHECKED : MF_UNCHECKED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_set_icon(int part, int icon)
|
|
||||||
{
|
|
||||||
HANDLE ptr;
|
|
||||||
|
|
||||||
if (icon == -1) ptr = NULL;
|
|
||||||
else ptr = hIcon[(intptr_t)icon];
|
|
||||||
|
|
||||||
SendMessage(hwndSBAR, SB_SETICON, part, (LPARAM)ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_set_text(int part, const wchar_t *str)
|
|
||||||
{
|
|
||||||
SendMessage(hwndSBAR, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM)str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sb_set_tooltip(int part, const wchar_t *str)
|
|
||||||
{
|
|
||||||
SendMessage(hwndSBAR, SB_SETTIPTEXT, part, (LPARAM)str);
|
|
||||||
}
|
|
||||||
593
src/win/win_ui.c
593
src/win/win_ui.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implement the user Interface module.
|
* Implement the user Interface module.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_ui.c 1.0.16 2018/04/29
|
* Version: @(#)win_ui.c 1.0.18 2018/05/03
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -38,7 +38,9 @@
|
|||||||
*/
|
*/
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <commdlg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -58,13 +60,17 @@
|
|||||||
#include "win_d3d.h"
|
#include "win_d3d.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GWL_WNDPROC
|
||||||
|
# define GWL_WNDPROC GWLP_WNDPROC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define TIMER_1SEC 1 /* ID of the one-second timer */
|
#define TIMER_1SEC 1 /* ID of the one-second timer */
|
||||||
|
|
||||||
|
|
||||||
/* Platform Public data, specific. */
|
/* Platform Public data, specific. */
|
||||||
HWND hwndMain, /* application main window */
|
HWND hwndMain = NULL, /* application main window */
|
||||||
hwndRender; /* machine render window */
|
hwndRender = NULL; /* machine render window */
|
||||||
HMENU menuMain; /* application main menu */
|
|
||||||
HICON hIcon[512]; /* icon data loaded from resources */
|
HICON hIcon[512]; /* icon data loaded from resources */
|
||||||
RECT oldclip; /* mouse rect */
|
RECT oldclip; /* mouse rect */
|
||||||
int infocus = 1;
|
int infocus = 1;
|
||||||
@@ -74,33 +80,156 @@ int infocus = 1;
|
|||||||
static wchar_t wTitle[512];
|
static wchar_t wTitle[512];
|
||||||
static RAWINPUTDEVICE device;
|
static RAWINPUTDEVICE device;
|
||||||
static HHOOK hKeyboardHook;
|
static HHOOK hKeyboardHook;
|
||||||
|
static LONG_PTR OriginalProcedure;
|
||||||
|
static HWND hwndSBAR = NULL; /* application status bar */
|
||||||
|
static HMENU menuMain = NULL, /* application menu bar */
|
||||||
|
menuSBAR = NULL, /* status bar menu bar */
|
||||||
|
*sb_menu = NULL;
|
||||||
|
static int sb_nparts;
|
||||||
static int hook_enabled = 0;
|
static int hook_enabled = 0;
|
||||||
static int save_window_pos = 0;
|
static int save_window_pos = 0;
|
||||||
|
static int cruft_x = 0,
|
||||||
|
cruft_y = 0,
|
||||||
|
cruft_sb = 0;
|
||||||
|
|
||||||
|
|
||||||
HICON
|
static VOID APIENTRY
|
||||||
LoadIconEx(PCTSTR pszIconName)
|
PopupMenu(HWND hwnd, POINT pt, int part)
|
||||||
{
|
{
|
||||||
return((HICON)LoadImage(hinstance, pszIconName, IMAGE_ICON,
|
if (part >= (sb_nparts - 1)) return;
|
||||||
16, 16, LR_SHARED));
|
|
||||||
|
pt.x = part * SB_ICON_WIDTH; /* justify to the left */
|
||||||
|
pt.y = 1; /* justify to the top */
|
||||||
|
|
||||||
|
ClientToScreen(hwnd, (LPPOINT)&pt);
|
||||||
|
|
||||||
|
TrackPopupMenu(sb_menu[part],
|
||||||
|
TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON,
|
||||||
|
pt.x, pt.y, 0, hwndSBAR, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
/* Handle messages for the Status Bar window. */
|
||||||
static void
|
#ifdef __amd64__
|
||||||
menu_update(void)
|
static LRESULT CALLBACK
|
||||||
{
|
#else
|
||||||
menuMain = LoadMenu(hinstance, L"MainMenu"));
|
static BOOL CALLBACK
|
||||||
|
|
||||||
menuSBAR = LoadMenu(hinstance, L"StatusBarMenu");
|
|
||||||
|
|
||||||
initmenu();
|
|
||||||
|
|
||||||
SetMenu(memnuMain, menu);
|
|
||||||
|
|
||||||
win_title_update = 1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
sb_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
POINT pt;
|
||||||
|
int idm, tag;
|
||||||
|
|
||||||
|
switch (message) {
|
||||||
|
case WM_COMMAND:
|
||||||
|
idm = LOWORD(wParam) & 0xff00; /* low 8 bits */
|
||||||
|
tag = LOWORD(wParam) & 0x00ff; /* high 8 bits */
|
||||||
|
ui_sb_menu_command(idm, tag);
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
GetClientRect(hwnd, (LPRECT)&r);
|
||||||
|
pt.x = GET_X_LPARAM(lParam);
|
||||||
|
pt.y = GET_Y_LPARAM(lParam);
|
||||||
|
if (PtInRect((LPRECT)&r, pt))
|
||||||
|
PopupMenu(hwnd, pt, (pt.x / SB_ICON_WIDTH));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
GetClientRect(hwnd, (LPRECT)&r);
|
||||||
|
pt.x = GET_X_LPARAM(lParam);
|
||||||
|
pt.y = GET_Y_LPARAM(lParam);
|
||||||
|
tag = (pt.x / SB_ICON_WIDTH);
|
||||||
|
if (PtInRect((LPRECT)&r, pt))
|
||||||
|
ui_sb_click(tag);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return(CallWindowProc((WNDPROC)OriginalProcedure,
|
||||||
|
hwnd, message, wParam, lParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create and set up the Status Bar window. */
|
||||||
|
void
|
||||||
|
StatusBarCreate(uintptr_t id)
|
||||||
|
{
|
||||||
|
int borders[3];
|
||||||
|
intptr_t i;
|
||||||
|
int dw, dh;
|
||||||
|
RECT r;
|
||||||
|
|
||||||
|
/* Load our icons into the cache for faster access. */
|
||||||
|
for (i = 128; i < 130; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 144; i < 146; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 160; i < 162; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 176; i < 178; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 192; i < 194; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 208; i < 210; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 224; i < 226; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 259; i < 260; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 384; i < 386; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 400; i < 402; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 416; i < 418; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 432; i < 434; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
for (i = 448; i < 450; i++)
|
||||||
|
hIcon[i] = LoadIconEx((PCTSTR)i);
|
||||||
|
|
||||||
|
GetWindowRect(hwndMain, &r);
|
||||||
|
dw = r.right - r.left;
|
||||||
|
dh = r.bottom - r.top;
|
||||||
|
|
||||||
|
/* Load the Common Controls DLL if needed. */
|
||||||
|
InitCommonControls();
|
||||||
|
|
||||||
|
/* Create the window, and make sure it's using the STATUS class. */
|
||||||
|
hwndSBAR = CreateWindow(STATUSCLASSNAME,
|
||||||
|
NULL,
|
||||||
|
SBARS_SIZEGRIP|WS_CHILD|WS_VISIBLE|SBT_TOOLTIPS,
|
||||||
|
0, dh,
|
||||||
|
dw, SB_HEIGHT,
|
||||||
|
hwndMain,
|
||||||
|
(HMENU)id,
|
||||||
|
hInstance,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Retrieve the width of the border the status bar got. */
|
||||||
|
memset(borders, 0x00, sizeof(borders));
|
||||||
|
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM)borders);
|
||||||
|
if (borders[1] == 0)
|
||||||
|
borders[1] = 2;
|
||||||
|
cruft_sb = SB_HEIGHT + (2 * borders[1]) + (2 * SB_PADDING);
|
||||||
|
|
||||||
|
/* Replace the original procedure with ours. */
|
||||||
|
OriginalProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC);
|
||||||
|
SetWindowLongPtr(hwndSBAR, GWL_WNDPROC, (LONG_PTR)sb_dlg_proc);
|
||||||
|
|
||||||
|
SendMessage(hwndSBAR, SB_SETMINHEIGHT, (WPARAM)SB_HEIGHT, (LPARAM)0);
|
||||||
|
|
||||||
|
/* Load the dummy menu for this window. */
|
||||||
|
menuSBAR = LoadMenu(hInstance, SB_MENU_NAME);
|
||||||
|
|
||||||
|
/* Clear the menus, just in case.. */
|
||||||
|
sb_nparts = 0;
|
||||||
|
sb_menu = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
@@ -139,9 +268,9 @@ LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
DWORD flags;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
int sb_borders[3];
|
int x, y;
|
||||||
int temp_x, temp_y;
|
|
||||||
int idm;
|
int idm;
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
@@ -164,34 +293,37 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_RESIZE:
|
case IDM_RESIZE:
|
||||||
GetWindowRect(hwnd, &rect);
|
/* Set up for resizing if configured. */
|
||||||
if (vid_resize)
|
flags = WS_OVERLAPPEDWINDOW;
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW) | WS_VISIBLE);
|
if (! vid_resize)
|
||||||
else
|
flags &= ~(WS_SIZEBOX | WS_THICKFRAME |
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
|
WS_MAXIMIZEBOX);
|
||||||
|
SetWindowLongPtr(hwnd, GWL_STYLE, flags);
|
||||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
|
||||||
|
|
||||||
/* Main Window. */
|
/* Main Window. */
|
||||||
|
GetWindowRect(hwnd, &rect);
|
||||||
MoveWindow(hwnd, rect.left, rect.top,
|
MoveWindow(hwnd, rect.left, rect.top,
|
||||||
unscaled_size_x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
|
unscaled_size_x + cruft_x,
|
||||||
unscaled_size_y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
|
unscaled_size_y + cruft_y + cruft_sb,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Render window. */
|
/* Render window. */
|
||||||
MoveWindow(hwndRender, 0, 0, unscaled_size_x, unscaled_size_y, TRUE);
|
MoveWindow(hwndRender, 0, 0,
|
||||||
GetWindowRect(hwndRender, &rect);
|
unscaled_size_x,
|
||||||
|
unscaled_size_y,
|
||||||
|
TRUE);
|
||||||
|
|
||||||
/* Status bar. */
|
/* Status bar. */
|
||||||
|
GetWindowRect(hwndRender, &rect);
|
||||||
MoveWindow(hwndSBAR,
|
MoveWindow(hwndSBAR,
|
||||||
0, rect.bottom + GetSystemMetrics(SM_CYEDGE),
|
|
||||||
unscaled_size_x, 17, TRUE);
|
|
||||||
|
|
||||||
if (mouse_capture) {
|
if (mouse_capture) {
|
||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
|
|
||||||
ClipCursor(&rect);
|
ClipCursor(&rect);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_REMEMBER:
|
case IDM_REMEMBER:
|
||||||
@@ -245,34 +377,38 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
/* Note: this is the *client area* size!! */
|
||||||
|
x = (lParam & 0xffff);
|
||||||
|
y = (lParam >> 16);
|
||||||
|
if (cruft_x == 0) {
|
||||||
|
/* Determine the window cruft. */
|
||||||
|
cruft_x = (scrnsz_x - x);
|
||||||
|
cruft_y = (scrnsz_y - y);
|
||||||
|
|
||||||
temp_x = (lParam & 0xFFFF);
|
/* Update window size with cruft. */
|
||||||
temp_y = (lParam >> 16) - (21 + sb_borders[1]);
|
x += cruft_x;
|
||||||
if (temp_x < 1)
|
y += (cruft_y + cruft_sb);
|
||||||
temp_x = 1;
|
}
|
||||||
if (temp_y < 1)
|
y -= cruft_sb;
|
||||||
temp_y = 1;
|
|
||||||
|
|
||||||
if ((temp_x != scrnsz_x) || (temp_y != scrnsz_y))
|
/* Request a re-size if needed. */
|
||||||
doresize = 1;
|
if ((x != scrnsz_x) || (y != scrnsz_y)) doresize = 1;
|
||||||
|
|
||||||
scrnsz_x = temp_x;
|
/* Set the new panel size. */
|
||||||
scrnsz_y = temp_y;
|
scrnsz_x = x;
|
||||||
|
scrnsz_y = y;
|
||||||
|
|
||||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
/* Update the render window. */
|
||||||
|
if (hwndRender != NULL)
|
||||||
|
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||||
|
|
||||||
GetWindowRect(hwndRender, &rect);
|
/* Update the Status bar. */
|
||||||
|
MoveWindow(hwndSBAR, 0, scrnsz_y, scrnsz_x, cruft_sb, TRUE);
|
||||||
/* Status bar. */
|
|
||||||
MoveWindow(hwndSBAR,
|
|
||||||
0, rect.bottom + GetSystemMetrics(SM_CYEDGE),
|
|
||||||
scrnsz_x, 17, TRUE);
|
|
||||||
|
|
||||||
|
/* Update the renderer if needed. */
|
||||||
plat_vidsize(scrnsz_x, scrnsz_y);
|
plat_vidsize(scrnsz_x, scrnsz_y);
|
||||||
|
|
||||||
MoveWindow(hwndSBAR, 0, scrnsz_y + 6, scrnsz_x, 17, TRUE);
|
/* Re-clip the mouse area if needed. */
|
||||||
|
|
||||||
if (mouse_capture) {
|
if (mouse_capture) {
|
||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
|
|
||||||
@@ -280,7 +416,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window_remember) {
|
if (window_remember) {
|
||||||
GetWindowRect(hwnd, &rect);
|
GetWindowRect(hwndMain, &rect);
|
||||||
|
|
||||||
window_x = rect.left;
|
window_x = rect.left;
|
||||||
window_y = rect.top;
|
window_y = rect.top;
|
||||||
window_w = rect.right - rect.left;
|
window_w = rect.right - rect.left;
|
||||||
@@ -292,13 +429,16 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
/* If window is not resizable, then tell the main thread to
|
/*
|
||||||
resize it, as sometimes, moves can mess up the window size. */
|
* If window is not resizable, then tell the main thread * to resize it, as sometimes, moves can mess up the window
|
||||||
if (!vid_resize)
|
* size.
|
||||||
|
*/
|
||||||
|
if (! vid_resize)
|
||||||
doresize = 1;
|
doresize = 1;
|
||||||
|
|
||||||
if (window_remember) {
|
if (window_remember) {
|
||||||
GetWindowRect(hwnd, &rect);
|
GetWindowRect(hwndMain, &rect);
|
||||||
|
|
||||||
window_x = rect.left;
|
window_x = rect.left;
|
||||||
window_y = rect.top;
|
window_y = rect.top;
|
||||||
window_w = rect.right - rect.left;
|
window_w = rect.right - rect.left;
|
||||||
@@ -308,9 +448,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
if (wParam == TIMER_1SEC) {
|
if (wParam == TIMER_1SEC)
|
||||||
pc_onesec();
|
pc_onesec();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_RESETD3D:
|
case WM_RESETD3D:
|
||||||
@@ -323,7 +462,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_LEAVEFULLSCREEN:
|
case WM_LEAVEFULLSCREEN:
|
||||||
/* pclog("leave full screen on window message\n"); */
|
#if 0
|
||||||
|
pclog("leave full screen on window message\n");
|
||||||
|
#endif
|
||||||
plat_setfullscreen(0);
|
plat_setfullscreen(0);
|
||||||
config_save();
|
config_save();
|
||||||
break;
|
break;
|
||||||
@@ -366,10 +507,11 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return(DefWindowProc(hwnd, message, wParam, lParam));
|
return(DefWindowProc(hwnd, message, wParam, lParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Dummy window procedure, used by D3D when in full-screen mode. */
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
@@ -383,8 +525,8 @@ ui_init(int nCmdShow)
|
|||||||
WCHAR title[200];
|
WCHAR title[200];
|
||||||
WNDCLASSEX wincl; /* buffer for main window's class */
|
WNDCLASSEX wincl; /* buffer for main window's class */
|
||||||
MSG messages; /* received-messages buffer */
|
MSG messages; /* received-messages buffer */
|
||||||
HWND hwnd = 0; /* handle for our window */
|
|
||||||
HACCEL haccel; /* handle to accelerator table */
|
HACCEL haccel; /* handle to accelerator table */
|
||||||
|
DWORD flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -395,10 +537,7 @@ ui_init(int nCmdShow)
|
|||||||
if (settings_only) {
|
if (settings_only) {
|
||||||
if (! pc_init_modules()) {
|
if (! pc_init_modules()) {
|
||||||
/* Dang, no ROMs found at all! */
|
/* Dang, no ROMs found at all! */
|
||||||
MessageBox(hwnd,
|
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2056);
|
||||||
plat_get_string(IDS_2056),
|
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(6);
|
return(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,13 +547,13 @@ ui_init(int nCmdShow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create our main window's class and register it. */
|
/* Create our main window's class and register it. */
|
||||||
wincl.hInstance = hinstance;
|
wincl.hInstance = hInstance;
|
||||||
wincl.lpszClassName = CLASS_NAME;
|
wincl.lpszClassName = CLASS_NAME;
|
||||||
wincl.lpfnWndProc = MainWindowProcedure;
|
wincl.lpfnWndProc = MainWindowProcedure;
|
||||||
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
||||||
wincl.cbSize = sizeof(WNDCLASSEX);
|
wincl.cbSize = sizeof(WNDCLASSEX);
|
||||||
wincl.hIcon = LoadIcon(hinstance, (LPCTSTR)100);
|
wincl.hIcon = LoadIcon(hInstance, (LPCTSTR)100);
|
||||||
wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR)100);
|
wincl.hIconSm = LoadIcon(hInstance, (LPCTSTR)100);
|
||||||
wincl.hCursor = NULL;
|
wincl.hCursor = NULL;
|
||||||
wincl.lpszMenuName = NULL;
|
wincl.lpszMenuName = NULL;
|
||||||
wincl.cbClsExtra = 0;
|
wincl.cbClsExtra = 0;
|
||||||
@@ -422,90 +561,78 @@ ui_init(int nCmdShow)
|
|||||||
wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0));
|
wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0));
|
||||||
if (! RegisterClassEx(&wincl))
|
if (! RegisterClassEx(&wincl))
|
||||||
return(2);
|
return(2);
|
||||||
wincl.lpszClassName = SUB_CLASS_NAME;
|
|
||||||
|
/* Register a class for the Fullscreen renderer window. */
|
||||||
|
wincl.lpszClassName = FS_CLASS_NAME;
|
||||||
wincl.lpfnWndProc = SubWindowProcedure;
|
wincl.lpfnWndProc = SubWindowProcedure;
|
||||||
if (! RegisterClassEx(&wincl))
|
if (! RegisterClassEx(&wincl))
|
||||||
return(2);
|
return(2);
|
||||||
|
|
||||||
/* Load the Window Menu(s) from the resources. */
|
/* Load the Window Menu(s) from the resources. */
|
||||||
menuMain = LoadMenu(hinstance, MENU_NAME);
|
menuMain = LoadMenu(hInstance, MENU_NAME);
|
||||||
|
|
||||||
/* Now create our main window. */
|
/* Set up main window for resizing if configured. */
|
||||||
|
flags = WS_OVERLAPPEDWINDOW;
|
||||||
|
if (! vid_resize)
|
||||||
|
flags &= ~(WS_SIZEBOX | WS_THICKFRAME | WS_MAXIMIZEBOX);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create our main window.
|
||||||
|
*
|
||||||
|
* We want our (initial) render panel to be a certain
|
||||||
|
* size (default 640x480), and we have no idea what
|
||||||
|
* our window decorations are, size-wise.
|
||||||
|
*
|
||||||
|
* Rather than depending on the GetSYstemMetrics API
|
||||||
|
* calls (which return incorrect data of Vista+), the
|
||||||
|
* simplest trick is to just set the desired window
|
||||||
|
* size, and create the window. The first WM_SIZE
|
||||||
|
* message will indicate the client size left after
|
||||||
|
* creating all the decorations, and the difference
|
||||||
|
* is the decoration overhead ('cruft') we need to
|
||||||
|
* always keep in mind when changing the window size.
|
||||||
|
*/
|
||||||
wsprintf(title, L"%S", emu_version, sizeof_w(title));
|
wsprintf(title, L"%S", emu_version, sizeof_w(title));
|
||||||
hwnd = CreateWindowEx (
|
hwndMain = CreateWindow(
|
||||||
0, /* no extended possibilites */
|
CLASS_NAME, /* class name */
|
||||||
CLASS_NAME, /* class name */
|
title, /* Title Text */
|
||||||
title, /* Title Text */
|
flags, /* style flags */
|
||||||
(WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX) | DS_3DLOOK,
|
CW_USEDEFAULT, CW_USEDEFAULT, /* no preset position */
|
||||||
CW_USEDEFAULT, /* Windows decides the position */
|
scrnsz_x, scrnsz_y, /* window size in pixels */
|
||||||
CW_USEDEFAULT, /* where window ends up on the screen */
|
HWND_DESKTOP, /* child of desktop */
|
||||||
scrnsz_x+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* width */
|
menuMain, /* menu */
|
||||||
scrnsz_y+(GetSystemMetrics(SM_CYFIXEDFRAME)*2)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+1, /* and height in pixels */
|
hInstance, /* Program Instance handler */
|
||||||
HWND_DESKTOP, /* window is a child to desktop */
|
NULL); /* no Window Creation data */
|
||||||
menuMain, /* menu */
|
|
||||||
hinstance, /* Program Instance handler */
|
|
||||||
NULL); /* no Window Creation data */
|
|
||||||
hwndMain = hwnd;
|
|
||||||
|
|
||||||
ui_window_title(title);
|
ui_window_title(title);
|
||||||
|
|
||||||
/* Set up main window for resizing if configured. */
|
|
||||||
if (vid_resize)
|
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE,
|
|
||||||
(WS_OVERLAPPEDWINDOW));
|
|
||||||
else
|
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE,
|
|
||||||
(WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX));
|
|
||||||
|
|
||||||
/* Move to the last-saved position if needed. */
|
/* Move to the last-saved position if needed. */
|
||||||
if (window_remember)
|
if (window_remember)
|
||||||
MoveWindow(hwnd, window_x, window_y, window_w, window_h, TRUE);
|
MoveWindow(hwndMain, window_x, window_y, window_w, window_h, FALSE);
|
||||||
|
|
||||||
/* Reset all menus to their defaults. */
|
/* Reset all menus to their defaults. */
|
||||||
ui_menu_reset_all();
|
ui_menu_reset_all();
|
||||||
|
|
||||||
/* Make the window visible on the screen. */
|
|
||||||
ShowWindow(hwnd, nCmdShow);
|
|
||||||
|
|
||||||
/* Load the accelerator table */
|
/* Load the accelerator table */
|
||||||
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
haccel = LoadAccelerators(hInstance, ACCEL_NAME);
|
||||||
if (haccel == NULL) {
|
if (haccel == NULL) {
|
||||||
MessageBox(hwndMain,
|
ui_msgbox(MBX_CONFIG, (wchar_t *)IDS_2153);
|
||||||
plat_get_string(IDS_2153),
|
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(3);
|
return(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the input (keyboard, mouse, game) module. */
|
/* Make the window visible on the screen. */
|
||||||
device.usUsagePage = 0x01;
|
ShowWindow(hwndMain, nCmdShow);
|
||||||
device.usUsage = 0x06;
|
|
||||||
device.dwFlags = RIDEV_NOHOTKEYS;
|
|
||||||
device.hwndTarget = hwnd;
|
|
||||||
if (! RegisterRawInputDevices(&device, 1, sizeof(device))) {
|
|
||||||
MessageBox(hwndMain,
|
|
||||||
plat_get_string(IDS_2154),
|
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(4);
|
|
||||||
}
|
|
||||||
keyboard_getkeymap();
|
|
||||||
|
|
||||||
/* Initialize the mouse module. */
|
|
||||||
win_mouse_init();
|
|
||||||
|
|
||||||
/* Create the status bar window. */
|
|
||||||
StatusBarCreate(hwndMain, IDC_STATUS, hinstance);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Before we can create the Render window, we first have
|
|
||||||
* to prepare some other things that it depends on.
|
|
||||||
*/
|
|
||||||
ghMutex = CreateMutex(NULL, FALSE, L"VARCem.BlitMutex");
|
|
||||||
|
|
||||||
/* Create the Machine Rendering window. */
|
/* Create the Machine Rendering window. */
|
||||||
hwndRender = CreateWindow(L"STATIC", NULL, WS_CHILD|SS_BITMAP,
|
hwndRender = CreateWindow(L"STATIC",
|
||||||
0, 0, 1, 1, hwnd, NULL, hinstance, NULL);
|
NULL,
|
||||||
|
WS_CHILD|SS_BITMAP,
|
||||||
|
0, 0,
|
||||||
|
scrnsz_x, scrnsz_y,
|
||||||
|
hwndMain,
|
||||||
|
NULL,
|
||||||
|
hInstance,
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* That looks good, now continue setting up the machine. */
|
/* That looks good, now continue setting up the machine. */
|
||||||
switch (pc_init_modules()) {
|
switch (pc_init_modules()) {
|
||||||
@@ -531,10 +658,7 @@ ui_init(int nCmdShow)
|
|||||||
|
|
||||||
/* Initialize the configured Video API. */
|
/* Initialize the configured Video API. */
|
||||||
if (! plat_setvid(vid_api)) {
|
if (! plat_setvid(vid_api)) {
|
||||||
MessageBox(hwnd,
|
ui_msgbox(MBX_CONFIG, (wchar_t *)IDS_2095);
|
||||||
plat_get_string(IDS_2095),
|
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(5);
|
return(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,12 +667,25 @@ ui_init(int nCmdShow)
|
|||||||
plat_setfullscreen(1);
|
plat_setfullscreen(1);
|
||||||
|
|
||||||
/* Activate the render window, this will also set the screen size. */
|
/* Activate the render window, this will also set the screen size. */
|
||||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
if (hwndRender != NULL)
|
||||||
|
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||||
|
|
||||||
#if 0
|
/* Create the status bar window. */
|
||||||
/* Set up the current window size. */
|
StatusBarCreate(IDC_STATBAR);
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
|
||||||
#endif
|
/* Initialize the input (keyboard, mouse, game) module. */
|
||||||
|
device.usUsagePage = 0x01;
|
||||||
|
device.usUsage = 0x06;
|
||||||
|
device.dwFlags = RIDEV_NOHOTKEYS;
|
||||||
|
device.hwndTarget = hwndMain;
|
||||||
|
if (! RegisterRawInputDevices(&device, 1, sizeof(device))) {
|
||||||
|
ui_msgbox(MBX_CONFIG, (wchar_t *)IDS_2154);
|
||||||
|
return(4);
|
||||||
|
}
|
||||||
|
keyboard_getkeymap();
|
||||||
|
|
||||||
|
/* Initialize the mouse module. */
|
||||||
|
win_mouse_init();
|
||||||
|
|
||||||
/* Fire up the machine. */
|
/* Fire up the machine. */
|
||||||
pc_reset_hard();
|
pc_reset_hard();
|
||||||
@@ -562,7 +699,7 @@ ui_init(int nCmdShow)
|
|||||||
* real work, and we will hang in here, dealing with the
|
* real work, and we will hang in here, dealing with the
|
||||||
* UI until we're done.
|
* UI until we're done.
|
||||||
*/
|
*/
|
||||||
do_start();
|
plat_start();
|
||||||
|
|
||||||
/* Run the message loop. It will run until GetMessage() returns 0 */
|
/* Run the message loop. It will run until GetMessage() returns 0 */
|
||||||
while (! quited) {
|
while (! quited) {
|
||||||
@@ -578,7 +715,7 @@ ui_init(int nCmdShow)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! TranslateAccelerator(hwnd, haccel, &messages)) {
|
if (! TranslateAccelerator(hwndMain, haccel, &messages)) {
|
||||||
TranslateMessage(&messages);
|
TranslateMessage(&messages);
|
||||||
DispatchMessage(&messages);
|
DispatchMessage(&messages);
|
||||||
}
|
}
|
||||||
@@ -601,10 +738,10 @@ ui_init(int nCmdShow)
|
|||||||
plat_mouse_capture(0);
|
plat_mouse_capture(0);
|
||||||
|
|
||||||
/* Close down the emulator. */
|
/* Close down the emulator. */
|
||||||
do_stop();
|
plat_stop();
|
||||||
|
|
||||||
UnregisterClass(SUB_CLASS_NAME, hinstance);
|
UnregisterClass(CLASS_NAME, hInstance);
|
||||||
UnregisterClass(CLASS_NAME, hinstance);
|
UnregisterClass(FS_CLASS_NAME, hInstance);
|
||||||
|
|
||||||
win_mouse_close();
|
win_mouse_close();
|
||||||
|
|
||||||
@@ -612,6 +749,23 @@ ui_init(int nCmdShow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Re-load and reset all menus.
|
||||||
|
*
|
||||||
|
* We should have the language ID as a parameter.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ui_menu_update(void)
|
||||||
|
{
|
||||||
|
menuMain = LoadMenu(hInstance, MENU_NAME);
|
||||||
|
SetMenu(hwndMain, menuMain);
|
||||||
|
|
||||||
|
menuSBAR = LoadMenu(hInstance, SB_MENU_NAME);
|
||||||
|
ui_menu_reset_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Update the application's title bar. */
|
||||||
wchar_t *
|
wchar_t *
|
||||||
ui_window_title(wchar_t *s)
|
ui_window_title(wchar_t *s)
|
||||||
{
|
{
|
||||||
@@ -631,9 +785,9 @@ ui_window_title(wchar_t *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set host cursor visible or not. */
|
/* Set cursor visible or not. */
|
||||||
void
|
void
|
||||||
show_cursor(int val)
|
ui_show_cursor(int val)
|
||||||
{
|
{
|
||||||
static int vis = -1;
|
static int vis = -1;
|
||||||
|
|
||||||
@@ -683,7 +837,6 @@ menu_set_radio_item(int idm, int num, int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* We should have the language ID as a parameter. */
|
|
||||||
void
|
void
|
||||||
plat_pause(int p)
|
plat_pause(int p)
|
||||||
{
|
{
|
||||||
@@ -708,7 +861,7 @@ plat_pause(int p)
|
|||||||
|
|
||||||
dopause = p;
|
dopause = p;
|
||||||
|
|
||||||
/* Update the actual menu. */
|
/* Update the actual menu item. */
|
||||||
menu_set_item(IDM_PAUSE, dopause);
|
menu_set_item(IDM_PAUSE, dopause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,33 +870,17 @@ plat_pause(int p)
|
|||||||
void
|
void
|
||||||
plat_resize(int x, int y)
|
plat_resize(int x, int y)
|
||||||
{
|
{
|
||||||
int sb_borders[3];
|
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
#if 0
|
|
||||||
pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", vid_fullscreen, vid_api, x, y);
|
|
||||||
#endif
|
|
||||||
/* First, see if we should resize the UI window. */
|
/* First, see if we should resize the UI window. */
|
||||||
if (!vid_resize) {
|
if (vid_resize) return;
|
||||||
video_wait_for_blit();
|
|
||||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
|
|
||||||
GetWindowRect(hwndMain, &r);
|
|
||||||
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
|
|
||||||
|
|
||||||
GetWindowRect(hwndMain, &r);
|
video_wait_for_blit();
|
||||||
MoveWindow(hwndMain, r.left, r.top,
|
|
||||||
x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
|
|
||||||
y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
|
|
||||||
TRUE);
|
|
||||||
GetWindowRect(hwndMain, &r);
|
|
||||||
|
|
||||||
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
|
/* Re-position and re-size the main window. */
|
||||||
|
GetWindowRect(hwndMain, &r);
|
||||||
if (mouse_capture) {
|
MoveWindow(hwndMain, r.left, r.top,
|
||||||
GetWindowRect(hwndRender, &r);
|
x+cruft_x, y+cruft_y+cruft_sb, TRUE);
|
||||||
ClipCursor(&r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -760,15 +897,113 @@ plat_mouse_capture(int on)
|
|||||||
GetClipCursor(&oldclip);
|
GetClipCursor(&oldclip);
|
||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
ClipCursor(&rect);
|
ClipCursor(&rect);
|
||||||
/* pclog("mouse capture off, hide cursor\n"); */
|
|
||||||
show_cursor(0);
|
ui_show_cursor(0);
|
||||||
|
|
||||||
mouse_capture = 1;
|
mouse_capture = 1;
|
||||||
} else if (!on && mouse_capture) {
|
} else if (!on && mouse_capture) {
|
||||||
/* Disable the in-app mouse. */
|
/* Disable the in-app mouse. */
|
||||||
ClipCursor(&oldclip);
|
ClipCursor(&oldclip);
|
||||||
/* pclog("mouse capture on, show cursor\n"); */
|
|
||||||
show_cursor(-1);
|
ui_show_cursor(-1);
|
||||||
|
|
||||||
mouse_capture = 0;
|
mouse_capture = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_setup(int parts, const int *widths)
|
||||||
|
{
|
||||||
|
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)parts, (LPARAM)widths);
|
||||||
|
|
||||||
|
if (sb_menu != NULL)
|
||||||
|
sb_menu_destroy();
|
||||||
|
|
||||||
|
sb_menu = (HMENU *)malloc(parts * sizeof(HMENU));
|
||||||
|
memset(sb_menu, 0x00, parts * sizeof(HMENU));
|
||||||
|
|
||||||
|
sb_nparts = parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_menu_destroy(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!sb_nparts || (sb_menu == NULL)) return;
|
||||||
|
|
||||||
|
for (i = 0; i < sb_nparts; i++) {
|
||||||
|
if (sb_menu[i] != NULL)
|
||||||
|
DestroyMenu(sb_menu[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(sb_menu);
|
||||||
|
|
||||||
|
sb_menu = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a menu for a status bar part. */
|
||||||
|
void
|
||||||
|
sb_menu_create(int part)
|
||||||
|
{
|
||||||
|
HMENU h;
|
||||||
|
|
||||||
|
h = CreatePopupMenu();
|
||||||
|
|
||||||
|
sb_menu[part] = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add an item to a (status bar) menu. */
|
||||||
|
void
|
||||||
|
sb_menu_add_item(int part, int idm, const wchar_t *str)
|
||||||
|
{
|
||||||
|
if (idm >= 0)
|
||||||
|
AppendMenu(sb_menu[part], MF_STRING, idm, str);
|
||||||
|
else
|
||||||
|
AppendMenu(sb_menu[part], MF_SEPARATOR, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_menu_enable_item(int part, int idm, int val)
|
||||||
|
{
|
||||||
|
EnableMenuItem(sb_menu[part], idm,
|
||||||
|
val ? MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_menu_set_item(int part, int idm, int val)
|
||||||
|
{
|
||||||
|
CheckMenuItem(sb_menu[part], idm, val ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_set_icon(int part, int icon)
|
||||||
|
{
|
||||||
|
HANDLE ptr;
|
||||||
|
|
||||||
|
if (icon == -1) ptr = NULL;
|
||||||
|
else ptr = hIcon[(intptr_t)icon];
|
||||||
|
|
||||||
|
SendMessage(hwndSBAR, SB_SETICON, part, (LPARAM)ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_set_text(int part, const wchar_t *str)
|
||||||
|
{
|
||||||
|
SendMessage(hwndSBAR, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM)str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sb_set_tooltip(int part, const wchar_t *str)
|
||||||
|
{
|
||||||
|
SendMessage(hwndSBAR, SB_SETTIPTEXT, part, (LPARAM)str);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user