HV-Integer and crop for AtariST. Debug output for used status bits.
This commit is contained in:
62
menu.cpp
62
menu.cpp
@@ -418,7 +418,7 @@ void substrcpy(char *d, char *s, char idx)
|
||||
#define STD_SPACE_EXIT " SPACE to exit"
|
||||
#define STD_COMBO_EXIT " Ctrl+ESC to exit"
|
||||
|
||||
static unsigned char getIdx(char *opt)
|
||||
int getOptIdx(char *opt)
|
||||
{
|
||||
if ((opt[1] >= '0') && (opt[1] <= '9')) return opt[1] - '0';
|
||||
if ((opt[1] >= 'A') && (opt[1] <= 'V')) return opt[1] - 'A' + 10;
|
||||
@@ -427,8 +427,8 @@ static unsigned char getIdx(char *opt)
|
||||
|
||||
uint32_t getStatus(char *opt, uint32_t status)
|
||||
{
|
||||
char idx1 = getIdx(opt);
|
||||
char idx2 = getIdx(opt + 1);
|
||||
char idx1 = getOptIdx(opt);
|
||||
char idx2 = getOptIdx(opt + 1);
|
||||
uint32_t x = (status & (1 << idx1)) ? 1 : 0;
|
||||
|
||||
if (idx2>idx1) {
|
||||
@@ -441,8 +441,8 @@ uint32_t getStatus(char *opt, uint32_t status)
|
||||
|
||||
uint32_t setStatus(char *opt, uint32_t status, uint32_t value)
|
||||
{
|
||||
unsigned char idx1 = getIdx(opt);
|
||||
unsigned char idx2 = getIdx(opt + 1);
|
||||
unsigned char idx1 = getOptIdx(opt);
|
||||
unsigned char idx2 = getOptIdx(opt + 1);
|
||||
uint32_t x = 1;
|
||||
|
||||
if (idx2>idx1) x = ~(0xffffffff << (idx2 - idx1 + 1));
|
||||
@@ -453,8 +453,8 @@ uint32_t setStatus(char *opt, uint32_t status, uint32_t value)
|
||||
|
||||
uint32_t getStatusMask(char *opt)
|
||||
{
|
||||
char idx1 = getIdx(opt);
|
||||
char idx2 = getIdx(opt + 1);
|
||||
char idx1 = getOptIdx(opt);
|
||||
char idx2 = getOptIdx(opt + 1);
|
||||
uint32_t x = 1;
|
||||
|
||||
if (idx2 > idx1) x = ~(0xffffffff << (idx2 - idx1 + 1));
|
||||
@@ -1588,7 +1588,7 @@ void HandleUI(void)
|
||||
//Hide or Disable flag (small letter - opposite action)
|
||||
while ((p[0] == 'H' || p[0] == 'D' || p[0] == 'h' || p[0] == 'd') && strlen(p) > 2)
|
||||
{
|
||||
int flg = (hdmask & (1 << getIdx(p))) ? 1 : 0;
|
||||
int flg = (hdmask & (1 << getOptIdx(p))) ? 1 : 0;
|
||||
if (p[0] == 'H') h |= flg;
|
||||
if (p[0] == 'h') h |= (flg ^ 1);
|
||||
if (p[0] == 'D') d |= flg;
|
||||
@@ -1916,7 +1916,7 @@ void HandleUI(void)
|
||||
//Hide or Disable flag
|
||||
while ((p[0] == 'H' || p[0] == 'D' || p[0] == 'h' || p[0] == 'd') && strlen(p) > 2)
|
||||
{
|
||||
int flg = (hdmask & (1 << getIdx(p))) ? 1 : 0;
|
||||
int flg = (hdmask & (1 << getOptIdx(p))) ? 1 : 0;
|
||||
if (p[0] == 'H') h |= flg;
|
||||
if (p[0] == 'h') h |= (flg ^ 1);
|
||||
if (p[0] == 'D') d |= flg;
|
||||
@@ -2090,7 +2090,7 @@ void HandleUI(void)
|
||||
int ex = (p[0] == 't') || (p[0] == 'r');
|
||||
|
||||
// determine which status bit is affected
|
||||
uint32_t mask = 1 << getIdx(p);
|
||||
uint32_t mask = 1 << getOptIdx(p);
|
||||
if (mask == 1 && is_x86())
|
||||
{
|
||||
x86_init();
|
||||
@@ -3738,7 +3738,6 @@ void HandleUI(void)
|
||||
snprintf(s, 29, " Cart: %s", tos_get_cartridge_name());
|
||||
OsdWrite(m++, s, menusub == 2);
|
||||
|
||||
OsdWrite(m++);
|
||||
strcpy(s, " Memory: ");
|
||||
strcat(s, tos_mem[(tos_system_ctrl() >> 1) & 7]);
|
||||
OsdWrite(m++, s, menusub == 3);
|
||||
@@ -3778,20 +3777,24 @@ void HandleUI(void)
|
||||
OsdWrite(m++, s, menusub == 10);
|
||||
|
||||
strcpy(s, " Video Crop: ");
|
||||
if (tos_system_ctrl() & TOS_CONTROL_BORDER) strcat(s, "Visible");
|
||||
if (tos_system_ctrl() & TOS_CONTROL_BORDER) strcat(s, (tos_get_extctrl() & 0x400) ? "Visible 216p(5x)" : "Visible");
|
||||
else strcat(s, "Full");
|
||||
OsdWrite(m++, s, menusub == 11);
|
||||
|
||||
strcpy(s, " Scale: ");
|
||||
strcat(s, tos_scale[(tos_get_extctrl() >> 11) & 3]);
|
||||
OsdWrite(m++, s, menusub == 12);
|
||||
|
||||
strcpy(s, " Scanlines: ");
|
||||
strcat(s, tos_scanlines[(tos_system_ctrl() >> 20) & 3]);
|
||||
OsdWrite(m++, s, menusub == 12);
|
||||
OsdWrite(m++, s, menusub == 13);
|
||||
|
||||
strcpy(s, " YM-Audio: ");
|
||||
strcat(s, tos_stereo[(tos_system_ctrl() & TOS_CONTROL_STEREO) ? 1 : 0]);
|
||||
OsdWrite(m++, s, menusub == 13);
|
||||
OsdWrite(m++, s, menusub == 14);
|
||||
|
||||
for (; m < OsdGetSize() - 1; m++) OsdWrite(m);
|
||||
OsdWrite(15, STD_EXIT, menusub == 14);
|
||||
OsdWrite(15, STD_EXIT, menusub == 15);
|
||||
|
||||
parentstate = menustate;
|
||||
menustate = MENU_ST_SYSTEM2;
|
||||
@@ -3911,11 +3914,32 @@ void HandleUI(void)
|
||||
break;
|
||||
|
||||
case 11:
|
||||
tos_update_sysctrl(tos_system_ctrl() ^ TOS_CONTROL_BORDER);
|
||||
menustate = MENU_ST_SYSTEM1;
|
||||
{
|
||||
int mode = ((tos_system_ctrl() & TOS_CONTROL_BORDER) ? 1 : 0) | ((tos_get_extctrl() & 0x400) ? 2 : 0);
|
||||
if (minus)
|
||||
{
|
||||
mode = (mode == 0) ? 3 : (mode == 3) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = (mode == 0) ? 1 : (mode == 1) ? 3 : 0;
|
||||
}
|
||||
|
||||
tos_update_sysctrl((mode & 1) ? (tos_system_ctrl() | TOS_CONTROL_BORDER) : (tos_system_ctrl() & ~TOS_CONTROL_BORDER));
|
||||
tos_set_extctrl((mode & 2) ? (tos_get_extctrl() | 0x400) : (tos_get_extctrl() & ~0x400));
|
||||
menustate = MENU_ST_SYSTEM1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
{
|
||||
int mode = ((tos_get_extctrl() >> 11) + (minus ? -1 : 1)) & 3;
|
||||
tos_set_extctrl((tos_get_extctrl() & ~0x1800) | (mode << 11));
|
||||
menustate = MENU_ST_SYSTEM1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
{
|
||||
// next scanline state
|
||||
int scan = ((tos_system_ctrl() >> 20) + (minus ? -1 : 1)) & 3;
|
||||
@@ -3924,13 +3948,13 @@ void HandleUI(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case 14:
|
||||
tos_update_sysctrl(tos_system_ctrl() ^ TOS_CONTROL_STEREO);
|
||||
menustate = MENU_ST_SYSTEM1;
|
||||
break;
|
||||
|
||||
|
||||
case 14:
|
||||
case 15:
|
||||
menustate = MENU_ST_MAIN1;
|
||||
menusub = 4;
|
||||
if (need_reset)
|
||||
|
||||
2
menu.h
2
menu.h
@@ -14,7 +14,9 @@ void InfoMessage(const char *message, int timeout = 2000, const char *title = "M
|
||||
void Info(const char *message, int timeout = 2000, int width = 0, int height = 0, int frame = 0);
|
||||
void MenuHide();
|
||||
|
||||
int getOptIdx(char *opt);
|
||||
uint32_t getStatus(char *opt, uint32_t status);
|
||||
uint32_t getStatusMask(char *opt);
|
||||
void substrcpy(char *d, char *s, char idx);
|
||||
|
||||
void open_joystick_setup();
|
||||
|
||||
@@ -23,6 +23,7 @@ const char* tos_scanlines[] = { "Off","25%","50%","75%" };
|
||||
const char* tos_stereo[] = { "Mono","Stereo" };
|
||||
const char* tos_chipset[] = { "ST","STE","MegaSTE","STEroids" };
|
||||
const char* tos_chipset_short[] = { "ST","STe","MST","ST+" };
|
||||
const char* tos_scale[] = { "Normal", "V-Integer", "HV-Integer-", "HV-Integer+" };
|
||||
|
||||
typedef struct {
|
||||
unsigned long system_ctrl; // system control word
|
||||
|
||||
@@ -74,6 +74,7 @@ extern const char* tos_mem[];
|
||||
extern const char* tos_scanlines[];
|
||||
extern const char* tos_stereo[];
|
||||
extern const char* tos_chipset[];
|
||||
extern const char* tos_scale[];
|
||||
|
||||
const char* tos_get_cfg_string(int num);
|
||||
|
||||
|
||||
59
user_io.cpp
59
user_io.cpp
@@ -411,6 +411,9 @@ static const char mlink_speed_labels[12][32] = { "110", "300", "600", "1200", "2
|
||||
|
||||
static void parse_config()
|
||||
{
|
||||
uint64_t mask = 0;
|
||||
uint64_t overlap = 0;
|
||||
|
||||
int i = 0;
|
||||
char *p;
|
||||
|
||||
@@ -537,6 +540,36 @@ static void parse_config()
|
||||
while((p[0] == 'H' || p[0] == 'D' || p[0] == 'h' || p[0] == 'd') && strlen(p)>=2) p += 2;
|
||||
if (p[0] == 'P') p += 2;
|
||||
|
||||
if (p[0] == 'R' || p[0] == 'T')
|
||||
{
|
||||
uint64_t x = 1 << getOptIdx(p);
|
||||
overlap |= mask & x;
|
||||
mask |= x;
|
||||
}
|
||||
if (p[0] == 'r' || p[0] == 't')
|
||||
{
|
||||
uint64_t x = 1 << getOptIdx(p);
|
||||
x <<= 32;
|
||||
overlap |= mask & x;
|
||||
mask |= x;
|
||||
}
|
||||
if (p[0] == 'O')
|
||||
{
|
||||
char *opt = (p[1] == 'X') ? p + 1 : p;
|
||||
uint64_t x = getStatusMask(opt);
|
||||
x <<= getOptIdx(opt);
|
||||
overlap |= mask & x;
|
||||
mask |= x;
|
||||
}
|
||||
if (p[0] == 'o')
|
||||
{
|
||||
char *opt = (p[1] == 'X') ? p + 1 : p;
|
||||
uint64_t x = getStatusMask(opt);
|
||||
x <<= 32 + getOptIdx(opt);
|
||||
overlap |= mask & x;
|
||||
mask |= x;
|
||||
}
|
||||
|
||||
if (p[0] == 'J')
|
||||
{
|
||||
int n = 1;
|
||||
@@ -587,6 +620,32 @@ static void parse_config()
|
||||
i++;
|
||||
} while (p || i<3);
|
||||
|
||||
mask |= 1; // reset is always on bit 0
|
||||
printf("\n// Status Bit Map:\n");
|
||||
printf("// Upper Lower\n");
|
||||
printf("// 0 1 2 3 4 5 6 \n");
|
||||
printf("// 01234567890123456789012345678901 23456789012345678901234567890123\n");
|
||||
printf("// 0123456789ABCDEFGHIJKLMNOPQRSTUV 0123456789ABCDEFGHIJKLMNOPQRSTUV\n");
|
||||
char str[128];
|
||||
strcpy(str, "// ");
|
||||
for (int i = 0; i < 32; i++) strcat(str, (mask & (1ULL << i)) ? "X" : " ");
|
||||
strcat(str, " ");
|
||||
for (int i = 32; i < 64; i++) strcat(str, (mask & (1ULL << i)) ? "X" : " ");
|
||||
strcat(str, "\n");
|
||||
printf(str);
|
||||
|
||||
if (overlap)
|
||||
{
|
||||
strcpy(str, "// ");
|
||||
for (int i = 0; i < 32; i++) strcat(str, (overlap & (1ULL << i)) ? "^" : " ");
|
||||
strcat(str, " ");
|
||||
for (int i = 32; i < 64; i++) strcat(str, (overlap & (1ULL << i)) ? "^" : " ");
|
||||
strcat(str, "\n");
|
||||
printf(str);
|
||||
printf("// *Overlapped bits!* (can be intentional):\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
// legacy GBA versions
|
||||
if (is_gba() && !ss_base)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user