Get rid of src/drivers/common and src/drivers/win
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/****************************************************************/
|
||||
/* FCE Ultra */
|
||||
/* */
|
||||
/* This file contains code for parsing command-line */
|
||||
/* options. */
|
||||
/* */
|
||||
/****************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../fceu-types.h"
|
||||
#include "args.h"
|
||||
|
||||
void ParseEA(int x, int argc, char *argv[], ARGPSTRUCT *argsps) {
|
||||
int y = 0;
|
||||
|
||||
do {
|
||||
if (!argsps[y].name) {
|
||||
ParseEA(x, argc, argv, (ARGPSTRUCT*)argsps[y].var);
|
||||
y++;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[x], argsps[y].name)) { // A match.
|
||||
if (argsps[y].subs) {
|
||||
if ((x + 1) >= argc)
|
||||
break;
|
||||
if (argsps[y].substype & 0x2000) {
|
||||
((void (*)(char *))argsps[y].subs)(argv[x + 1]);
|
||||
} else if (argsps[y].substype & 0x8000) {
|
||||
*(int*)argsps[y].subs &= ~(argsps[y].substype & (~0x8000));
|
||||
*(int*)argsps[y].subs |= atoi(argv[x + 1]) ? (argsps[y].substype & (~0x8000)) : 0;
|
||||
} else
|
||||
switch (argsps[y].substype & (~0x4000)) {
|
||||
case 0: // Integer
|
||||
*(int*)argsps[y].subs = atoi(argv[x + 1]);
|
||||
break;
|
||||
case 2: // Double float
|
||||
*(double*)argsps[y].subs = atof(argv[x + 1]);
|
||||
break;
|
||||
case 1: // String
|
||||
if (argsps[y].substype & 0x4000) {
|
||||
if (*(char**)argsps[y].subs)
|
||||
free(*(char**)argsps[y].subs);
|
||||
if (!(*(char**)argsps[y].subs = (char*)malloc(strlen(argv[x + 1]) + 1)))
|
||||
break;
|
||||
}
|
||||
strcpy(*(char**)argsps[y].subs, argv[x + 1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (argsps[y].var)
|
||||
*argsps[y].var = 1;
|
||||
}
|
||||
y++;
|
||||
} while (argsps[y].var || argsps[y].subs);
|
||||
}
|
||||
|
||||
void ParseArguments(int argc, char *argv[], ARGPSTRUCT *argsps) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < argc; x++)
|
||||
ParseEA(x, argc, argv, argsps);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _DRIVERS_ARGH
|
||||
typedef struct {
|
||||
char *name;
|
||||
int *var;
|
||||
|
||||
void *subs;
|
||||
int substype;
|
||||
} ARGPSTRUCT;
|
||||
|
||||
void ParseArguments(int argc, char *argv[], ARGPSTRUCT * argsps);
|
||||
#define _DRIVERS_ARGH
|
||||
#endif
|
||||
@@ -1,467 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "../../driver.h"
|
||||
|
||||
static void GetString(char *s, int max) {
|
||||
int x;
|
||||
fgets(s, max, stdin);
|
||||
|
||||
for (x = 0; x < max; x++)
|
||||
if (s[x] == '\n') {
|
||||
s[x] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get unsigned 16-bit integer from stdin in hex. */
|
||||
static uint32 GetH16(unsigned int def) {
|
||||
char buf[32];
|
||||
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == '\n')
|
||||
return(def);
|
||||
if (buf[0] == '$')
|
||||
sscanf(buf + 1, "%04x", &def);
|
||||
else
|
||||
sscanf(buf, "%04x", &def);
|
||||
return def;
|
||||
}
|
||||
|
||||
/* Get unsigned 8-bit integer from stdin in decimal. */
|
||||
static uint8 Get8(unsigned int def) {
|
||||
char buf[32];
|
||||
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == '\n')
|
||||
return(def);
|
||||
sscanf(buf, "%u", &def);
|
||||
return def;
|
||||
}
|
||||
|
||||
static int GetI(int def) {
|
||||
char buf[32];
|
||||
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == '\n')
|
||||
return(def);
|
||||
sscanf(buf, "%d", &def);
|
||||
return def;
|
||||
}
|
||||
|
||||
static int GetYN(int def) {
|
||||
char buf[32];
|
||||
printf("(Y/N)[%s]: ", def ? "Y" : "N");
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == 'y' || buf[0] == 'Y')
|
||||
return(1);
|
||||
if (buf[0] == 'n' || buf[0] == 'N')
|
||||
return(0);
|
||||
return(def);
|
||||
}
|
||||
|
||||
/*
|
||||
** Begin list code.
|
||||
**
|
||||
*/
|
||||
static int listcount;
|
||||
static int listids[16];
|
||||
static int listsel;
|
||||
static int mordoe;
|
||||
|
||||
void BeginListShow(void) {
|
||||
listcount = 0;
|
||||
listsel = -1;
|
||||
mordoe = 0;
|
||||
}
|
||||
|
||||
/* Hmm =0 for in list choices, hmm=1 for end of list choices. */
|
||||
/* Return equals 0 to continue, -1 to stop, otherwise a number. */
|
||||
int ListChoice(int hmm) {
|
||||
char buf[32];
|
||||
|
||||
if (!hmm) {
|
||||
int num = 0;
|
||||
|
||||
tryagain:
|
||||
printf(" <'Enter' to continue, (S)top, or enter a number.> ");
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == 's' || buf[0] == 'S') return(-1);
|
||||
if (buf[0] == '\n') return(0);
|
||||
if (!sscanf(buf, "%d", &num))
|
||||
return(0);
|
||||
if (num < 1) goto tryagain;
|
||||
return(num);
|
||||
} else {
|
||||
int num = 0;
|
||||
|
||||
tryagain2:
|
||||
printf(" <'Enter' to make no selection or enter a number.> ");
|
||||
fgets(buf, 32, stdin);
|
||||
if (buf[0] == '\n') return(0);
|
||||
if (!sscanf(buf, "%d", &num))
|
||||
return(0);
|
||||
if (num < 1) goto tryagain2;
|
||||
return(num);
|
||||
}
|
||||
}
|
||||
|
||||
int EndListShow(void) {
|
||||
if (mordoe) {
|
||||
int r = ListChoice(1);
|
||||
if (r > 0 && r <= listcount)
|
||||
listsel = listids[r - 1];
|
||||
}
|
||||
return(listsel);
|
||||
}
|
||||
|
||||
/* Returns 0 to stop listing, 1 to continue. */
|
||||
int AddToList(char *text, uint32 id) {
|
||||
if (listcount == 16) {
|
||||
int t = ListChoice(0);
|
||||
mordoe = 0;
|
||||
if (t == -1) return(0); // Stop listing.
|
||||
else if (t > 0 && t < 17) {
|
||||
listsel = listids[t - 1];
|
||||
return(0);
|
||||
}
|
||||
listcount = 0;
|
||||
}
|
||||
mordoe = 1;
|
||||
listids[listcount] = id;
|
||||
printf("%2d) %s\n", listcount + 1, text);
|
||||
listcount++;
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
** End list code.
|
||||
**/
|
||||
|
||||
typedef struct MENU {
|
||||
char *text;
|
||||
void *action;
|
||||
int type; // 0 for menu, 1 for function.
|
||||
} MENU;
|
||||
|
||||
static void SetOC(void) {
|
||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||
}
|
||||
|
||||
static void UnhideEx(void) {
|
||||
FCEUI_CheatSearchShowExcluded();
|
||||
}
|
||||
|
||||
static void ToggleCheat(int num) {
|
||||
printf("Cheat %d %sabled.\n", 1 + num,
|
||||
FCEUI_ToggleCheat(num) ? "en" : "dis");
|
||||
}
|
||||
|
||||
static void ModifyCheat(int num) {
|
||||
char *name;
|
||||
char buf[256];
|
||||
uint32 A;
|
||||
uint8 V;
|
||||
int compare;
|
||||
int type;
|
||||
|
||||
int s;
|
||||
int t;
|
||||
|
||||
FCEUI_GetCheat(num, &name, &A, &V, &compare, &s, &type);
|
||||
|
||||
printf("Name [%s]: ", name);
|
||||
GetString(buf, 256);
|
||||
|
||||
/* This obviously doesn't allow for cheats with no names. Bah. Who wants
|
||||
nameless cheats anyway...
|
||||
*/
|
||||
|
||||
if (buf[0])
|
||||
name = buf; // Change name when FCEUI_SetCheat() is called.
|
||||
else
|
||||
name = 0; // Don't change name when FCEUI_SetCheat() is called.
|
||||
|
||||
printf("Address [$%04x]: ", (unsigned int)A);
|
||||
A = GetH16(A);
|
||||
|
||||
printf("Value [%03d]: ", (unsigned int)V);
|
||||
V = Get8(V);
|
||||
|
||||
printf("Compare [%3d]: ", compare);
|
||||
compare = GetI(compare);
|
||||
|
||||
printf("Type(0=Old Style, 1=Read Substitute) [%1d]: ", type);
|
||||
type = GetI(type) ? 1 : 0;
|
||||
|
||||
printf("Enable [%s]: ", s ? "Y" : "N");
|
||||
t = getchar();
|
||||
if (t == 'Y' || t == 'y') s = 1;
|
||||
else if (t == 'N' || t == 'n') s = 0;
|
||||
|
||||
FCEUI_SetCheat(num, name, A, V, compare, s, type);
|
||||
}
|
||||
|
||||
|
||||
static void AddCheatGGPAR(int which) {
|
||||
uint16 A;
|
||||
uint8 V;
|
||||
int C;
|
||||
int type;
|
||||
char name[256], code[256];
|
||||
|
||||
printf("Name: ");
|
||||
GetString(name, 256);
|
||||
|
||||
printf("Code: ");
|
||||
GetString(code, 256);
|
||||
|
||||
printf("Add cheat \"%s\" for code \"%s\"?", name, code);
|
||||
if (GetYN(0)) {
|
||||
if (which) {
|
||||
if (!FCEUI_DecodePAR(code, &A, &V, &C, &type)) {
|
||||
puts("Invalid Game Genie code.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!FCEUI_DecodeGG(code, &A, &V, &C)) {
|
||||
puts("Invalid Game Genie code.");
|
||||
return;
|
||||
}
|
||||
type = 1;
|
||||
}
|
||||
|
||||
if (FCEUI_AddCheat(name, A, V, C, type))
|
||||
puts("Cheat added.");
|
||||
else
|
||||
puts("Error adding cheat.");
|
||||
}
|
||||
}
|
||||
|
||||
static void AddCheatGG(void) {
|
||||
AddCheatGGPAR(0);
|
||||
}
|
||||
|
||||
static void AddCheatPAR(void) {
|
||||
AddCheatGGPAR(1);
|
||||
}
|
||||
|
||||
static void AddCheatParam(uint32 A, uint8 V) {
|
||||
char name[256];
|
||||
|
||||
printf("Name: ");
|
||||
GetString(name, 256);
|
||||
printf("Address [$%04x]: ", (unsigned int)A);
|
||||
A = GetH16(A);
|
||||
printf("Value [%03d]: ", (unsigned int)V);
|
||||
V = Get8(V);
|
||||
printf("Add cheat \"%s\" for address $%04x with value %03d?", name, (unsigned int)A, (unsigned int)V);
|
||||
if (GetYN(0)) {
|
||||
if (FCEUI_AddCheat(name, A, V, -1, 0))
|
||||
puts("Cheat added.");
|
||||
else
|
||||
puts("Error adding cheat.");
|
||||
}
|
||||
}
|
||||
|
||||
static void AddCheat(void) {
|
||||
AddCheatParam(0, 0);
|
||||
}
|
||||
|
||||
static int lid;
|
||||
static int clistcallb(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data) {
|
||||
char tmp[512];
|
||||
int ret;
|
||||
|
||||
if (compare >= 0)
|
||||
sprintf(tmp, "%s $%04x:%03d:%03d - %s", s ? "*" : " ", (unsigned int)a, (unsigned int)v, compare, name);
|
||||
else
|
||||
sprintf(tmp, "%s $%04x:%03d - %s", s ? "*" : " ", (unsigned int)a, (unsigned int)v, name);
|
||||
if (type == 1)
|
||||
tmp[2] = 'S';
|
||||
ret = AddToList(tmp, lid);
|
||||
lid++;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void ListCheats(void) {
|
||||
int which;
|
||||
lid = 0;
|
||||
|
||||
BeginListShow();
|
||||
FCEUI_ListCheats(clistcallb, 0);
|
||||
which = EndListShow();
|
||||
if (which >= 0) {
|
||||
char tmp[32];
|
||||
printf(" <(T)oggle status, (M)odify, or (D)elete this cheat.> ");
|
||||
fgets(tmp, 32, stdin);
|
||||
switch (tolower(tmp[0])) {
|
||||
case 't': ToggleCheat(which);
|
||||
break;
|
||||
case 'd': if (!FCEUI_DelCheat(which))
|
||||
puts("Error deleting cheat!");
|
||||
else
|
||||
puts("Cheat has been deleted.");
|
||||
break;
|
||||
case 'm': ModifyCheat(which);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ResetSearch(void) {
|
||||
FCEUI_CheatSearchBegin();
|
||||
puts("Done.");
|
||||
}
|
||||
|
||||
static int srescallb(uint32 a, uint8 last, uint8 current, void *data) {
|
||||
char tmp[13];
|
||||
sprintf(tmp, "$%04x:%03d:%03d", (unsigned int)a, (unsigned int)last, (unsigned int)current);
|
||||
return(AddToList(tmp, a));
|
||||
}
|
||||
|
||||
static void ShowRes(void) {
|
||||
int n = FCEUI_CheatSearchGetCount();
|
||||
printf(" %d results:\n", n);
|
||||
if (n) {
|
||||
int which;
|
||||
BeginListShow();
|
||||
FCEUI_CheatSearchGet(srescallb, 0);
|
||||
which = EndListShow();
|
||||
if (which >= 0)
|
||||
AddCheatParam(which, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static int ShowShortList(char *moe[], int n, int def) {
|
||||
int x, c;
|
||||
unsigned int baa;
|
||||
char tmp[16];
|
||||
|
||||
red:
|
||||
for (x = 0; x < n; x++)
|
||||
printf("%d) %s\n", x + 1, moe[x]);
|
||||
puts("D) Display List");
|
||||
clo:
|
||||
|
||||
printf("\nSelection [%d]> ", def + 1);
|
||||
fgets(tmp, 256, stdin);
|
||||
if (tmp[0] == '\n')
|
||||
return def;
|
||||
c = tolower(tmp[0]);
|
||||
baa = c - '1';
|
||||
|
||||
if (baa < n)
|
||||
return baa;
|
||||
else if (c == 'd')
|
||||
goto red;
|
||||
else {
|
||||
puts("Invalid selection.");
|
||||
goto clo;
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSearch(void) {
|
||||
static int v1 = 0, v2 = 0;
|
||||
static int method = 0;
|
||||
char *m[6] = { "O==V1 && C==V2", "O==V1 && |O-C|==V2", "|O-C|==V2", "O!=C", "Value decreased", "Value increased" };
|
||||
printf("\nSearch Filter:\n");
|
||||
|
||||
method = ShowShortList(m, 6, method);
|
||||
if (method <= 1) {
|
||||
printf("V1 [%03d]: ", v1);
|
||||
v1 = Get8(v1);
|
||||
}
|
||||
if (method <= 2) {
|
||||
printf("V2 [%03d]: ", v2);
|
||||
v2 = Get8(v2);
|
||||
}
|
||||
FCEUI_CheatSearchEnd(method, v1, v2);
|
||||
puts("Search completed.\n");
|
||||
}
|
||||
|
||||
|
||||
static MENU NewCheatsMenu[] = {
|
||||
{ "Add Cheat", (void*)AddCheat, 1 },
|
||||
{ "Reset Search", (void*)ResetSearch, 1 },
|
||||
{ "Do Search", (void*)DoSearch, 1 },
|
||||
{ "Set Original to Current", (void*)SetOC, 1 },
|
||||
{ "Unhide Excluded", (void*)UnhideEx, 1 },
|
||||
{ "Show Results", (void*)ShowRes, 1 },
|
||||
{ "Add Game Genie Cheat", (void*)AddCheatGG, 1 },
|
||||
{ "Add PAR Cheat", (void*)AddCheatPAR, 1 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static MENU MainMenu[] = {
|
||||
{ "List Cheats", (void*)ListCheats, 1 },
|
||||
{ "New Cheats...", (void*)NewCheatsMenu, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void DoMenu(MENU *men) {
|
||||
int x = 0;
|
||||
|
||||
redisplay:
|
||||
x = 0;
|
||||
puts("");
|
||||
while (men[x].text) {
|
||||
printf("%d) %s\n", x + 1, men[x].text);
|
||||
x++;
|
||||
}
|
||||
puts("D) Display Menu\nX) Return to Previous\n");
|
||||
{
|
||||
char buf[32];
|
||||
int c;
|
||||
|
||||
recommand:
|
||||
printf("Command> ");
|
||||
fgets(buf, 32, stdin);
|
||||
c = tolower(buf[0]);
|
||||
if (c == '\n')
|
||||
goto recommand;
|
||||
else if (c == 'd')
|
||||
goto redisplay;
|
||||
else if (c == 'x') {
|
||||
return;
|
||||
} else if (sscanf(buf, "%d", &c)) {
|
||||
if (c > x) goto invalid;
|
||||
if (men[c - 1].type) {
|
||||
void (*func)(void) = (void (*)())men[c - 1].action;
|
||||
func();
|
||||
} else
|
||||
DoMenu((MENU*)men[c - 1].action); /* Mmm...recursivey goodness. */
|
||||
goto redisplay;
|
||||
} else {
|
||||
invalid:
|
||||
puts("Invalid command.\n");
|
||||
goto recommand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoConsoleCheatConfig(void) {
|
||||
MENU *curmenu = MainMenu;
|
||||
|
||||
DoMenu(curmenu);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
void DoConsoleCheatConfig(void);
|
||||
@@ -1,134 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/****************************************************************/
|
||||
/* FCE Ultra */
|
||||
/* */
|
||||
/* This file contains routines for reading/writing the */
|
||||
/* configuration file. */
|
||||
/* */
|
||||
/****************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../fceu-types.h"
|
||||
#include "config.h"
|
||||
|
||||
static int FReadString(FILE *fp, char *str, int n) {
|
||||
int x = 0, z;
|
||||
for (;; ) {
|
||||
z = fgetc(fp);
|
||||
str[x] = z;
|
||||
x++;
|
||||
if (z <= 0) break;
|
||||
if (x >= n) return 0;
|
||||
}
|
||||
if (z < 0) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void GetValueR(FILE *fp, char *str, void *v, int c) {
|
||||
char buf[256];
|
||||
int s;
|
||||
|
||||
while (FReadString(fp, buf, 256)) {
|
||||
fread(&s, 1, 4, fp);
|
||||
if (!strcmp(str, buf)) {
|
||||
if (!c) { // String, allocate some memory.
|
||||
if (!(*(char**)v = (char*)malloc(s)))
|
||||
goto gogl;
|
||||
fread(*(char**)v, 1, s, fp);
|
||||
continue;
|
||||
} else if (s > c || s < c) {
|
||||
gogl:
|
||||
fseek(fp, s, SEEK_CUR);
|
||||
continue;
|
||||
}
|
||||
fread((uint8*)v, 1, c, fp);
|
||||
} else
|
||||
fseek(fp, s, SEEK_CUR);
|
||||
}
|
||||
fseek(fp, 4, SEEK_SET);
|
||||
}
|
||||
|
||||
static void SetValueR(FILE *fp, char *str, void *v, int c) {
|
||||
fwrite(str, 1, strlen(str) + 1, fp);
|
||||
fwrite((uint8*)&c, 1, 4, fp);
|
||||
fwrite((uint8*)v, 1, c, fp);
|
||||
}
|
||||
|
||||
static void SaveParse(CFGSTRUCT *cfgst, FILE *fp) {
|
||||
int x = 0;
|
||||
|
||||
while (cfgst[x].ptr) {
|
||||
if (!cfgst[x].name) { // Link to new config structure
|
||||
SaveParse((CFGSTRUCT*)cfgst[x].ptr, fp); // Recursion is sexy. I could
|
||||
// save a little stack space if I made
|
||||
// the file pointer a non-local
|
||||
// variable...
|
||||
x++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cfgst[x].len) // Plain data
|
||||
SetValueR(fp, cfgst[x].name, cfgst[x].ptr, cfgst[x].len);
|
||||
else // String
|
||||
if (*(char**)cfgst[x].ptr) // Only save it if there IS a string.
|
||||
SetValueR(fp, cfgst[x].name, *(char**)cfgst[x].ptr,
|
||||
strlen(*(char**)cfgst[x].ptr) + 1);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
void SaveFCEUConfig(char *filename, CFGSTRUCT *cfgst) {
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp == NULL) return;
|
||||
|
||||
SaveParse(cfgst, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
static void LoadParse(CFGSTRUCT *cfgst, FILE *fp) {
|
||||
int x = 0;
|
||||
|
||||
while (cfgst[x].ptr) {
|
||||
if (!cfgst[x].name) { // Link to new config structure
|
||||
LoadParse((CFGSTRUCT*)cfgst[x].ptr, fp);
|
||||
x++;
|
||||
continue;
|
||||
}
|
||||
GetValueR(fp, cfgst[x].name, cfgst[x].ptr, cfgst[x].len);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadFCEUConfig(char *filename, CFGSTRUCT *cfgst) {
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filename, "rb");
|
||||
if (fp == NULL) return;
|
||||
LoadParse(cfgst, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef _DRIVERS_CONFIGH
|
||||
typedef struct {
|
||||
char *name;
|
||||
void *ptr;
|
||||
int len;
|
||||
} CFGSTRUCT;
|
||||
|
||||
void SaveFCEUConfig(char *filename, CFGSTRUCT *cfgst);
|
||||
void LoadFCEUConfig(char *filename, CFGSTRUCT *cfgst);
|
||||
|
||||
/* Macros for building CFGSTRUCT structures. */
|
||||
|
||||
/* CFGSTRUCT structures must always end with ENDCFGSTRUCT */
|
||||
#define ENDCFGSTRUCT { 0, 0, 0 }
|
||||
|
||||
/* When this macro is used, the config loading/saving code will parse
|
||||
the new config structure until the end of it is detected, then it
|
||||
will continue parsing the original config structure.
|
||||
*/
|
||||
#define ADDCFGSTRUCT(x) { 0, &x, 0 }
|
||||
|
||||
/* Oops. The NAC* macros shouldn't have the # in front of the w, but
|
||||
fixing this would break configuration files of previous versions and it
|
||||
isn't really hurting much.
|
||||
*/
|
||||
|
||||
/* Single piece of data(integer). */
|
||||
#define AC(x) { # x, &x, sizeof(x) }
|
||||
#define NAC(w, x) { # w, &x, sizeof(x) }
|
||||
|
||||
/* Array. */
|
||||
#define ACA(x) { # x, x, sizeof(x) }
|
||||
#define NACA(w, x) { # w, x, sizeof(x) }
|
||||
|
||||
/* String(pointer) with automatic memory allocation. */
|
||||
#define ACS(x) { # x, &x, 0 }
|
||||
#define NACS(w, x) { # w, &x, 0 }
|
||||
|
||||
#define _DRIVERS_CONFIGH
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
void hq2x_32(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int BpL);
|
||||
int hq2x_InitLUTs(void);
|
||||
void hq2x_Kill(void);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
void hq3x_32(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int BpL);
|
||||
int hq3x_InitLUTs(void);
|
||||
void hq3x_Kill(void);
|
||||
|
||||
@@ -1,911 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a C and MMX implementation of the Scale2x effect.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://scale2x.sourceforge.net/
|
||||
*
|
||||
* Alternatively at the previous license terms, you are allowed to use this
|
||||
* code in your program with these conditions:
|
||||
* - the program is not used in commercial activities.
|
||||
* - the whole source code of the program is released with the binary.
|
||||
* - derivative works of the program are allowed.
|
||||
*/
|
||||
|
||||
#include "scale2x.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/***************************************************************************/
|
||||
/* Scale2x C implementation */
|
||||
|
||||
static inline void scale2x_8_def_single(scale2x_uint8* __restrict__ dst, const scale2x_uint8* __restrict__ src0, const scale2x_uint8* __restrict__ src1, const scale2x_uint8* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale2x_16_def_single(scale2x_uint16* __restrict__ dst, const scale2x_uint16* __restrict__ src0, const scale2x_uint16* __restrict__ src1, const scale2x_uint16* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale2x_32_def_single(scale2x_uint32* __restrict__ dst, const scale2x_uint32* __restrict__ src0, const scale2x_uint32* __restrict__ src1, const scale2x_uint32* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[1] = src0[0];
|
||||
else
|
||||
dst[1] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 8 bits.
|
||||
* The function is implemented in C.
|
||||
* The pixels over the left and right borders are assumed of the same color of
|
||||
* the pixels on the border.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale2x_8_def_single(dst0, src0, src1, src2, count);
|
||||
scale2x_8_def_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 16 bits.
|
||||
* This function operates like scale2x_8_def() but for 16 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale2x_16_def_single(dst0, src0, src1, src2, count);
|
||||
scale2x_16_def_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 32 bits.
|
||||
* This function operates like scale2x_8_def() but for 32 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale2x_32_def_single(dst0, src0, src1, src2, count);
|
||||
scale2x_32_def_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/* Scale2x MMX implementation */
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
/*
|
||||
* Apply the Scale2x effect at a single row.
|
||||
* This function must be called only by the other scale2x functions.
|
||||
*
|
||||
* Considering the pixel map :
|
||||
*
|
||||
* ABC (src0)
|
||||
* DEF (src1)
|
||||
* GHI (src2)
|
||||
*
|
||||
* this functions compute 2 new pixels in substitution of the source pixel E
|
||||
* like this map :
|
||||
*
|
||||
* ab (dst)
|
||||
*
|
||||
* with these variables :
|
||||
*
|
||||
* ¤t -> E
|
||||
* ¤t_left -> D
|
||||
* ¤t_right -> F
|
||||
* ¤t_upper -> B
|
||||
* ¤t_lower -> H
|
||||
*
|
||||
* %0 -> current_upper
|
||||
* %1 -> current
|
||||
* %2 -> current_lower
|
||||
* %3 -> dst
|
||||
* %4 -> counter
|
||||
*
|
||||
* %mm0 -> *current_left
|
||||
* %mm1 -> *current_next
|
||||
* %mm2 -> tmp0
|
||||
* %mm3 -> tmp1
|
||||
* %mm4 -> tmp2
|
||||
* %mm5 -> tmp3
|
||||
* %mm6 -> *current_upper
|
||||
* %mm7 -> *current
|
||||
*/
|
||||
static inline void scale2x_8_mmx_single(scale2x_uint8* dst, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) {
|
||||
assert(count >= 16);
|
||||
assert(count % 8 == 0);
|
||||
|
||||
/* always do the first and last run */
|
||||
count -= 2 * 8;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
/* first run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq 0(%1), %%mm0\n"
|
||||
"movq 0(%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psllq $56, %%mm0\n"
|
||||
"psllq $56, %%mm1\n"
|
||||
"psrlq $56, %%mm0\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $8, %%mm2\n"
|
||||
"psrlq $8, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqb %%mm6, %%mm2\n"
|
||||
"pcmpeqb %%mm6, %%mm4\n"
|
||||
"pcmpeqb (%2), %%mm3\n"
|
||||
"pcmpeqb (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqb %%mm1, %%mm2\n"
|
||||
"pcmpeqb %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklbw %%mm4, %%mm2\n"
|
||||
"punpckhbw %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
/* central runs */
|
||||
"shrl $3, %4\n"
|
||||
"jz 1f\n"
|
||||
|
||||
"0:\n"
|
||||
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psrlq $56, %%mm0\n"
|
||||
"psllq $56, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $8, %%mm2\n"
|
||||
"psrlq $8, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqb %%mm6, %%mm2\n"
|
||||
"pcmpeqb %%mm6, %%mm4\n"
|
||||
"pcmpeqb (%2), %%mm3\n"
|
||||
"pcmpeqb (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqb %%mm1, %%mm2\n"
|
||||
"pcmpeqb %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklbw %%mm4, %%mm2\n"
|
||||
"punpckhbw %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
"decl %4\n"
|
||||
"jnz 0b\n"
|
||||
"1:\n"
|
||||
|
||||
/* final run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq (%1), %%mm1\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"psrlq $56, %%mm1\n"
|
||||
"psrlq $56, %%mm0\n"
|
||||
"psllq $56, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $8, %%mm2\n"
|
||||
"psrlq $8, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqb %%mm6, %%mm2\n"
|
||||
"pcmpeqb %%mm6, %%mm4\n"
|
||||
"pcmpeqb (%2), %%mm3\n"
|
||||
"pcmpeqb (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqb %%mm1, %%mm2\n"
|
||||
"pcmpeqb %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklbw %%mm4, %%mm2\n"
|
||||
"punpckhbw %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
: "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count)
|
||||
:
|
||||
: "cc"
|
||||
);
|
||||
}
|
||||
|
||||
static inline void scale2x_16_mmx_single(scale2x_uint16* dst, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) {
|
||||
assert(count >= 8);
|
||||
assert(count % 4 == 0);
|
||||
|
||||
/* always do the first and last run */
|
||||
count -= 2 * 4;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
/* first run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq 0(%1), %%mm0\n"
|
||||
"movq 0(%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psllq $48, %%mm0\n"
|
||||
"psllq $48, %%mm1\n"
|
||||
"psrlq $48, %%mm0\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $16, %%mm2\n"
|
||||
"psrlq $16, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqw %%mm6, %%mm2\n"
|
||||
"pcmpeqw %%mm6, %%mm4\n"
|
||||
"pcmpeqw (%2), %%mm3\n"
|
||||
"pcmpeqw (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqw %%mm1, %%mm2\n"
|
||||
"pcmpeqw %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklwd %%mm4, %%mm2\n"
|
||||
"punpckhwd %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
/* central runs */
|
||||
"shrl $2, %4\n"
|
||||
"jz 1f\n"
|
||||
|
||||
"0:\n"
|
||||
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psrlq $48, %%mm0\n"
|
||||
"psllq $48, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $16, %%mm2\n"
|
||||
"psrlq $16, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqw %%mm6, %%mm2\n"
|
||||
"pcmpeqw %%mm6, %%mm4\n"
|
||||
"pcmpeqw (%2), %%mm3\n"
|
||||
"pcmpeqw (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqw %%mm1, %%mm2\n"
|
||||
"pcmpeqw %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklwd %%mm4, %%mm2\n"
|
||||
"punpckhwd %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
"decl %4\n"
|
||||
"jnz 0b\n"
|
||||
"1:\n"
|
||||
|
||||
/* final run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq (%1), %%mm1\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"psrlq $48, %%mm1\n"
|
||||
"psrlq $48, %%mm0\n"
|
||||
"psllq $48, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $16, %%mm2\n"
|
||||
"psrlq $16, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqw %%mm6, %%mm2\n"
|
||||
"pcmpeqw %%mm6, %%mm4\n"
|
||||
"pcmpeqw (%2), %%mm3\n"
|
||||
"pcmpeqw (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqw %%mm1, %%mm2\n"
|
||||
"pcmpeqw %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpcklwd %%mm4, %%mm2\n"
|
||||
"punpckhwd %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
: "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count)
|
||||
:
|
||||
: "cc"
|
||||
);
|
||||
}
|
||||
|
||||
static inline void scale2x_32_mmx_single(scale2x_uint32* dst, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) {
|
||||
assert(count >= 4);
|
||||
assert(count % 2 == 0);
|
||||
|
||||
/* always do the first and last run */
|
||||
count -= 2 * 2;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
/* first run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq 0(%1), %%mm0\n"
|
||||
"movq 0(%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psllq $32, %%mm0\n"
|
||||
"psllq $32, %%mm1\n"
|
||||
"psrlq $32, %%mm0\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $32, %%mm2\n"
|
||||
"psrlq $32, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqd %%mm6, %%mm2\n"
|
||||
"pcmpeqd %%mm6, %%mm4\n"
|
||||
"pcmpeqd (%2), %%mm3\n"
|
||||
"pcmpeqd (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqd %%mm1, %%mm2\n"
|
||||
"pcmpeqd %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpckldq %%mm4, %%mm2\n"
|
||||
"punpckhdq %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
/* central runs */
|
||||
"shrl $1, %4\n"
|
||||
"jz 1f\n"
|
||||
|
||||
"0:\n"
|
||||
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq 8(%1), %%mm1\n"
|
||||
"psrlq $32, %%mm0\n"
|
||||
"psllq $32, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $32, %%mm2\n"
|
||||
"psrlq $32, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqd %%mm6, %%mm2\n"
|
||||
"pcmpeqd %%mm6, %%mm4\n"
|
||||
"pcmpeqd (%2), %%mm3\n"
|
||||
"pcmpeqd (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqd %%mm1, %%mm2\n"
|
||||
"pcmpeqd %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpckldq %%mm4, %%mm2\n"
|
||||
"punpckhdq %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
/* next */
|
||||
"addl $8, %0\n"
|
||||
"addl $8, %1\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $16, %3\n"
|
||||
|
||||
"decl %4\n"
|
||||
"jnz 0b\n"
|
||||
"1:\n"
|
||||
|
||||
/* final run */
|
||||
/* set the current, current_pre, current_next registers */
|
||||
"movq (%1), %%mm1\n"
|
||||
"movq (%1), %%mm7\n"
|
||||
"movq -8(%1), %%mm0\n"
|
||||
"psrlq $32, %%mm1\n"
|
||||
"psrlq $32, %%mm0\n"
|
||||
"psllq $32, %%mm1\n"
|
||||
"movq %%mm7, %%mm2\n"
|
||||
"movq %%mm7, %%mm3\n"
|
||||
"psllq $32, %%mm2\n"
|
||||
"psrlq $32, %%mm3\n"
|
||||
"por %%mm2, %%mm0\n"
|
||||
"por %%mm3, %%mm1\n"
|
||||
|
||||
/* current_upper */
|
||||
"movq (%0), %%mm6\n"
|
||||
|
||||
/* compute the upper-left pixel for dst on %%mm2 */
|
||||
/* compute the upper-right pixel for dst on %%mm4 */
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"movq %%mm0, %%mm3\n"
|
||||
"movq %%mm1, %%mm5\n"
|
||||
"pcmpeqd %%mm6, %%mm2\n"
|
||||
"pcmpeqd %%mm6, %%mm4\n"
|
||||
"pcmpeqd (%2), %%mm3\n"
|
||||
"pcmpeqd (%2), %%mm5\n"
|
||||
"pandn %%mm2, %%mm3\n"
|
||||
"pandn %%mm4, %%mm5\n"
|
||||
"movq %%mm0, %%mm2\n"
|
||||
"movq %%mm1, %%mm4\n"
|
||||
"pcmpeqd %%mm1, %%mm2\n"
|
||||
"pcmpeqd %%mm0, %%mm4\n"
|
||||
"pandn %%mm3, %%mm2\n"
|
||||
"pandn %%mm5, %%mm4\n"
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"pand %%mm6, %%mm2\n"
|
||||
"pand %%mm6, %%mm4\n"
|
||||
"pandn %%mm7, %%mm3\n"
|
||||
"pandn %%mm7, %%mm5\n"
|
||||
"por %%mm3, %%mm2\n"
|
||||
"por %%mm5, %%mm4\n"
|
||||
|
||||
/* set *dst */
|
||||
"movq %%mm2, %%mm3\n"
|
||||
"punpckldq %%mm4, %%mm2\n"
|
||||
"punpckhdq %%mm4, %%mm3\n"
|
||||
"movq %%mm2, (%3)\n"
|
||||
"movq %%mm3, 8(%3)\n"
|
||||
|
||||
: "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count)
|
||||
:
|
||||
: "cc"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 8 bits.
|
||||
* This is a very fast MMX implementation.
|
||||
* The implementation uses a combination of cmp/and/not operations to
|
||||
* completly remove the need of conditional jumps. This trick give the
|
||||
* major speed improvement.
|
||||
* Also, using the 8 bytes MMX registers more than one pixel are computed
|
||||
* at the same time.
|
||||
* Before calling this function you must ensure that the currenct CPU supports
|
||||
* the MMX instruction set. After calling it you must be sure to call the EMMS
|
||||
* instruction before any floating-point operation.
|
||||
* The pixels over the left and right borders are assumed of the same color of
|
||||
* the pixels on the border.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows. It must
|
||||
* be at least 16 and a multiple of 8.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) {
|
||||
if (count % 8 != 0 || count < 16) {
|
||||
scale2x_8_def(dst0, dst1, src0, src1, src2, count);
|
||||
} else {
|
||||
assert(count >= 16);
|
||||
assert(count % 8 == 0);
|
||||
|
||||
scale2x_8_mmx_single(dst0, src0, src1, src2, count);
|
||||
scale2x_8_mmx_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 16 bits.
|
||||
* This function operates like scale2x_8_mmx() but for 16 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows. It must
|
||||
* be at least 8 and a multiple of 4.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) {
|
||||
if (count % 4 != 0 || count < 8) {
|
||||
scale2x_16_def(dst0, dst1, src0, src1, src2, count);
|
||||
} else {
|
||||
assert(count >= 8);
|
||||
assert(count % 4 == 0);
|
||||
|
||||
scale2x_16_mmx_single(dst0, src0, src1, src2, count);
|
||||
scale2x_16_mmx_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 32 bits.
|
||||
* This function operates like scale2x_8_mmx() but for 32 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows. It must
|
||||
* be at least 4 and a multiple of 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) {
|
||||
if (count % 2 != 0 || count < 4) {
|
||||
scale2x_32_def(dst0, dst1, src0, src1, src2, count);
|
||||
} else {
|
||||
assert(count >= 4);
|
||||
assert(count % 2 == 0);
|
||||
|
||||
scale2x_32_mmx_single(dst0, src0, src1, src2, count);
|
||||
scale2x_32_mmx_single(dst1, src2, src1, src0, count);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SCALE2X_H
|
||||
#define __SCALE2X_H
|
||||
|
||||
typedef unsigned char scale2x_uint8;
|
||||
typedef unsigned short scale2x_uint16;
|
||||
typedef unsigned scale2x_uint32;
|
||||
|
||||
void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
/**
|
||||
* End the use of the MMX instructions.
|
||||
* This function must be called before using any floating-point operations.
|
||||
*/
|
||||
static inline void scale2x_mmx_emms(void) {
|
||||
__asm__ __volatile__ (
|
||||
"emms"
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a C and MMX implementation of the Scale2x effect.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://scale2x.sourceforge.net/
|
||||
*
|
||||
* Alternatively at the previous license terms, you are allowed to use this
|
||||
* code in your program with these conditions:
|
||||
* - the program is not used in commercial activities.
|
||||
* - the whole source code of the program is released with the binary.
|
||||
* - derivative works of the program are allowed.
|
||||
*/
|
||||
|
||||
#include "scale3x.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/***************************************************************************/
|
||||
/* Scale3x C implementation */
|
||||
|
||||
static inline void scale3x_8_def_border(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[2] = src0[0];
|
||||
else
|
||||
dst[2] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale3x_8_def_center(scale3x_uint8* __restrict__ dst, const scale3x_uint8* __restrict__ src0, const scale3x_uint8* __restrict__ src1, const scale3x_uint8* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
}
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale3x_16_def_border(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[2] = src0[0];
|
||||
else
|
||||
dst[2] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale3x_16_def_center(scale3x_uint16* __restrict__ dst, const scale3x_uint16* __restrict__ src0, const scale3x_uint16* __restrict__ src1, const scale3x_uint16* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
}
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale3x_32_def_border(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src1[1] == src0[0] && src2[0] != src0[0])
|
||||
dst[2] = src0[0];
|
||||
else
|
||||
dst[2] = src1[0];
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src1[-1] == src0[0] && src2[0] != src0[0])
|
||||
dst[0] = src0[0];
|
||||
else
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
static inline void scale3x_32_def_center(scale3x_uint32* __restrict__ dst, const scale3x_uint32* __restrict__ src0, const scale3x_uint32* __restrict__ src1, const scale3x_uint32* __restrict__ src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
}
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 8 bits.
|
||||
* The function is implemented in C.
|
||||
* The pixels over the left and right borders are assumed of the same color of
|
||||
* the pixels on the border.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale3x_8_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_8_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_8_def_border(dst2, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 16 bits.
|
||||
* This function operates like scale3x_8_def() but for 16 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale3x_16_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_16_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_16_def_border(dst2, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 32 bits.
|
||||
* This function operates like scale3x_8_def() but for 32 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count) {
|
||||
assert(count >= 2);
|
||||
|
||||
scale3x_32_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_32_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_32_def_border(dst2, src2, src1, src0, count);
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SCALE3X_H
|
||||
#define __SCALE3X_H
|
||||
|
||||
typedef unsigned char scale3x_uint8;
|
||||
typedef unsigned short scale3x_uint16;
|
||||
typedef unsigned scale3x_uint32;
|
||||
|
||||
void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count);
|
||||
void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count);
|
||||
void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,376 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2003 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains an example implementation of the Scale effect
|
||||
* applyed to a generic bitmap.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://scale2x.sourceforge.net/
|
||||
*
|
||||
* Alternatively at the previous license terms, you are allowed to use this
|
||||
* code in your program with these conditions:
|
||||
* - the program is not used in commercial activities.
|
||||
* - the whole source code of the program is released with the binary.
|
||||
* - derivative works of the program are allowed.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "scale2x.h"
|
||||
#include "scale3x.h"
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Apply the Scale2x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) {
|
||||
switch (pixel) {
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
case 1: scale2x_8_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
case 2: scale2x_16_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
case 4: scale2x_32_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
#else
|
||||
case 1: scale2x_8_def(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
case 2: scale2x_16_def(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
case 4: scale2x_32_def(dst0, dst1, src0, src1, src2, pixel_per_row); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale3x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale3x(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) {
|
||||
switch (pixel) {
|
||||
case 1: scale3x_8_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row); break;
|
||||
case 2: scale3x_16_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row); break;
|
||||
case 4: scale3x_32_def(dst0, dst1, dst2, src0, src1, src2, pixel_per_row); break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale4x(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, const void* src3, unsigned pixel, unsigned pixel_per_row) {
|
||||
stage_scale2x(dst0, dst1, src0, src1, src2, pixel, 2 * pixel_per_row);
|
||||
stage_scale2x(dst2, dst3, src1, src2, src3, pixel, 2 * pixel_per_row);
|
||||
}
|
||||
|
||||
#define SCDST(i) (dst + (i) * dst_slice)
|
||||
#define SCSRC(i) (src + (i) * src_slice)
|
||||
#define SCMID(i) (mid[(i)])
|
||||
|
||||
/**
|
||||
* Apply the Scale2x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 2x2 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) {
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(2);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(2);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(1 - 1), SCSRC(2 - 1), SCSRC(2 - 1), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale32x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 3x3 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale3x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) {
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(1 - 1), SCSRC(2 - 1), SCSRC(2 - 1), pixel, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 4x4 times the size of the source bitmap.
|
||||
* \note This function requires also a small buffer bitmap used internally to store
|
||||
* intermediate results. This bitmap must have at least an horizontal size in bytes of 2*width*pixel,
|
||||
* and a vertical size of 6 rows. The memory of this buffer must not be allocated
|
||||
* in video memory because it's also read and not only written. Generally
|
||||
* a heap (malloc) or a stack (alloca) buffer is the best choices.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_mid Pointer at the first pixel of the buffer bitmap.
|
||||
* \param mid_slice Size in bytes of a buffer bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale4x_buf(void* void_dst, unsigned dst_slice, void* void_mid, unsigned mid_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) {
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (unsigned char*)void_src;
|
||||
unsigned count;
|
||||
unsigned char* mid[6];
|
||||
|
||||
assert(height >= 4);
|
||||
|
||||
count = height;
|
||||
|
||||
/* set the 6 buffer pointers */
|
||||
mid[0] = (unsigned char*)void_mid;
|
||||
mid[1] = mid[0] + mid_slice;
|
||||
mid[2] = mid[1] + mid_slice;
|
||||
mid[3] = mid[2] + mid_slice;
|
||||
mid[4] = mid[3] + mid_slice;
|
||||
mid[5] = mid[4] + mid_slice;
|
||||
|
||||
stage_scale2x(SCMID(-2 + 6), SCMID(-1 + 6), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
stage_scale2x(SCMID(0), SCMID(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
stage_scale2x(SCMID(2), SCMID(3), SCSRC(1), SCSRC(2), SCSRC(3), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-2 + 6), SCMID(-2 + 6), SCMID(-1 + 6), SCMID(0), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-1 + 6), SCMID(0), SCMID(1), SCMID(2), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
count -= 4;
|
||||
while (count) {
|
||||
unsigned char* tmp;
|
||||
|
||||
stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(4), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
src = SCSRC(1);
|
||||
|
||||
tmp = SCMID(0); /* shift by 2 position */
|
||||
SCMID(0) = SCMID(2);
|
||||
SCMID(2) = SCMID(4);
|
||||
SCMID(4) = tmp;
|
||||
tmp = SCMID(1);
|
||||
SCMID(1) = SCMID(3);
|
||||
SCMID(3) = SCMID(5);
|
||||
SCMID(5) = tmp;
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(3), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(3), SCMID(4), SCMID(5), SCMID(5), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 4x4 times the size of the source bitmap.
|
||||
* \note This function operates like ::scale4x_buf() but the intermediate buffer is
|
||||
* automatically allocated in the stack.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale4x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) {
|
||||
unsigned mid_slice;
|
||||
void* mid;
|
||||
|
||||
mid_slice = 2 * pixel * width; /* required space for 1 row buffer */
|
||||
|
||||
mid_slice = (mid_slice + 0x7) & ~0x7; /* align to 8 bytes */
|
||||
|
||||
#if HAVE_ALLOCA
|
||||
mid = alloca(6 * mid_slice); /* allocate space for 6 row buffers */
|
||||
|
||||
assert(mid != 0); /* alloca should never fails */
|
||||
#else
|
||||
mid = malloc(6 * mid_slice); /* allocate space for 6 row buffers */
|
||||
|
||||
if (!mid)
|
||||
return;
|
||||
#endif
|
||||
|
||||
scale4x_buf(void_dst, dst_slice, mid, mid_slice, void_src, src_slice, pixel, width, height);
|
||||
|
||||
#if !HAVE_ALLOCA
|
||||
free(mid);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scale implementation is applicable at the given arguments.
|
||||
* \param scale Scale factor. 2, 3 or 4.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
* \return
|
||||
* - -1 on precondition violated.
|
||||
* - 0 on success.
|
||||
*/
|
||||
int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height) {
|
||||
if (scale != 2 && scale != 3 && scale != 4)
|
||||
return -1;
|
||||
|
||||
if (pixel != 1 && pixel != 2 && pixel != 4)
|
||||
return -1;
|
||||
|
||||
switch (scale) {
|
||||
case 2:
|
||||
case 3:
|
||||
if (height < 2)
|
||||
return -1;
|
||||
break;
|
||||
case 4:
|
||||
if (height < 4)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
switch (scale) {
|
||||
case 2:
|
||||
case 4:
|
||||
if (width < (16 / pixel))
|
||||
return -1;
|
||||
if (width % (8 / pixel) != 0)
|
||||
return -1;
|
||||
break;
|
||||
case 3:
|
||||
if (width < 2)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (width < 2)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale effect on a bitmap.
|
||||
* This function is simply a common interface for ::scale2x(), ::scale3x() and ::scale4x().
|
||||
* \param scale Scale factor. 2, 3 or 4.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) {
|
||||
switch (scale) {
|
||||
case 2:
|
||||
scale2x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 3:
|
||||
scale3x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 4:
|
||||
scale4x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2003 Andrea Mazzoleni
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains an example implementation of the Scale effect
|
||||
* applyed to a generic bitmap.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://scale2x.sourceforge.net/
|
||||
*
|
||||
* Alternatively at the previous license terms, you are allowed to use this
|
||||
* code in your program with these conditions:
|
||||
* - the program is not used in commercial activities.
|
||||
* - the whole source code of the program is released with the binary.
|
||||
* - derivative works of the program are allowed.
|
||||
*/
|
||||
|
||||
#ifndef __SCALEBIT_H
|
||||
#define __SCALEBIT_H
|
||||
|
||||
int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height);
|
||||
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,726 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "scalebit.h"
|
||||
#include "hq2x.h"
|
||||
#include "hq3x.h"
|
||||
|
||||
#include "../../fceu-types.h"
|
||||
|
||||
static uint32 CBM[3];
|
||||
static uint32 *palettetranslate = 0;
|
||||
|
||||
static uint16 *specbuf = NULL; // 8bpp -> 16bpp, pre hq2x/hq3x
|
||||
static uint32 *specbuf32bpp = NULL; // Buffer to hold output
|
||||
// of hq2x/hq3x when converting
|
||||
// to 16bpp and 24bpp
|
||||
static int backBpp, backshiftr[3], backshiftl[3];
|
||||
//static uint32 backmask[3];
|
||||
|
||||
static uint8 *specbuf8bpp = NULL; // For 2xscale, 3xscale.
|
||||
|
||||
|
||||
static int silt;
|
||||
|
||||
static int Bpp; // BYTES per pixel
|
||||
static int highefx;
|
||||
|
||||
#define BLUR_RED 20
|
||||
#define BLUR_GREEN 20
|
||||
#define BLUR_BLUE 10
|
||||
|
||||
#define FVB_SCANLINES 1
|
||||
|
||||
/* The blur effect is only available for bpp>=16. It could be easily modified
|
||||
to look like what happens on the real NES and TV, but lack of decent
|
||||
synchronization to the vertical retrace period makes it look rather
|
||||
blah.
|
||||
*/
|
||||
#define FVB_BLUR 2
|
||||
|
||||
static void CalculateShift(uint32 *CBM, int *cshiftr, int *cshiftl) {
|
||||
int a, x, z, y;
|
||||
cshiftl[0] = cshiftl[1] = cshiftl[2] = -1;
|
||||
for (a = 0; a < 3; a++) {
|
||||
for (x = 0, y = -1, z = 0; x < 32; x++) {
|
||||
if (CBM[a] & (1 << x)) {
|
||||
if (cshiftl[a] == -1) cshiftl[a] = x;
|
||||
z++;
|
||||
}
|
||||
}
|
||||
cshiftr[a] = (8 - z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int specfilt) {
|
||||
if (specfilt == 2 || specfilt == 4) { // scale2x and scale3x
|
||||
int multi;
|
||||
|
||||
if (specfilt == 2) multi = 2 * 2;
|
||||
else multi = 3 * 3;
|
||||
|
||||
specbuf8bpp = malloc(256 * 240 * multi);
|
||||
} else if (specfilt == 1 || specfilt == 3) { // hq2x and hq3x
|
||||
if (b == 1)
|
||||
return(0);
|
||||
|
||||
if (b == 2 || b == 3) { // 8->16->(hq2x)->32-> 24 or 16. YARGH.
|
||||
uint32 tmpCBM[3];
|
||||
backBpp = b;
|
||||
tmpCBM[0] = rmask;
|
||||
tmpCBM[1] = gmask;
|
||||
tmpCBM[2] = bmask;
|
||||
|
||||
CalculateShift(tmpCBM, backshiftr, backshiftl);
|
||||
|
||||
if (b == 2) {
|
||||
// ark
|
||||
backshiftr[0] += 16;
|
||||
backshiftr[1] += 8;
|
||||
backshiftr[2] += 0;
|
||||
|
||||
// Begin iffy code(requires 16bpp and 32bpp to have same RGB order)
|
||||
//backmask[0] = (rmask>>backshiftl[0]) << (backshiftr[0]);
|
||||
//backmask[1] = (gmask>>backshiftl[1]) << (backshiftr[1]);
|
||||
//backmask[2] = (bmask>>backshiftl[2]) << (backshiftr[2]);
|
||||
|
||||
//int x;
|
||||
//for(x=0;x<3;x++)
|
||||
// backshiftr[x] -= backshiftl[x];
|
||||
// End iffy code
|
||||
}
|
||||
if (specfilt == 1) specbuf32bpp = malloc(256 * 240 * 4 * sizeof(uint32));
|
||||
else if (specfilt == 3) specbuf32bpp = malloc(256 * 240 * 9 * sizeof(uint32));
|
||||
}
|
||||
|
||||
efx = 0;
|
||||
b = 2;
|
||||
rmask = 0x1F << 11;
|
||||
gmask = 0x3F << 5;
|
||||
bmask = 0x1F;
|
||||
|
||||
if (specfilt == 3)
|
||||
hq3x_InitLUTs();
|
||||
else
|
||||
hq2x_InitLUTs();
|
||||
|
||||
specbuf = malloc(256 * 240 * sizeof(uint16));
|
||||
}
|
||||
|
||||
silt = specfilt;
|
||||
|
||||
Bpp = b;
|
||||
|
||||
highefx = efx;
|
||||
|
||||
if (Bpp <= 1 || Bpp > 4)
|
||||
return(0);
|
||||
|
||||
if (efx & FVB_BLUR) {
|
||||
if (Bpp == 2)
|
||||
palettetranslate = (uint32*)malloc(65536 * 4);
|
||||
else if (Bpp >= 3)
|
||||
palettetranslate = (uint32*)malloc(65536 * 4);
|
||||
} else {
|
||||
if (Bpp == 2)
|
||||
palettetranslate = (uint32*)malloc(65536 * 4);
|
||||
else if (Bpp >= 3)
|
||||
palettetranslate = (uint32*)malloc(256 * 4);
|
||||
}
|
||||
|
||||
if (!palettetranslate)
|
||||
return(0);
|
||||
|
||||
|
||||
CBM[0] = rmask;
|
||||
CBM[1] = gmask;
|
||||
CBM[2] = bmask;
|
||||
return(1);
|
||||
}
|
||||
|
||||
void KillBlitToHigh(void) {
|
||||
if (palettetranslate) {
|
||||
free(palettetranslate);
|
||||
palettetranslate = NULL;
|
||||
}
|
||||
|
||||
if (specbuf8bpp) {
|
||||
free(specbuf8bpp);
|
||||
specbuf8bpp = NULL;
|
||||
}
|
||||
if (specbuf32bpp) {
|
||||
free(specbuf32bpp);
|
||||
specbuf32bpp = NULL;
|
||||
}
|
||||
if (specbuf) {
|
||||
if (silt == 3)
|
||||
hq3x_Kill();
|
||||
else
|
||||
hq2x_Kill();
|
||||
specbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetPaletteBlitToHigh(uint8 *src) {
|
||||
int cshiftr[3];
|
||||
int cshiftl[3];
|
||||
int x, y;
|
||||
|
||||
CalculateShift(CBM, cshiftr, cshiftl);
|
||||
|
||||
switch (Bpp) {
|
||||
case 2:
|
||||
if (highefx & FVB_BLUR) {
|
||||
for (x = 0; x < 256; x++) {
|
||||
uint32 r, g, b;
|
||||
for (y = 0; y < 256; y++) {
|
||||
r = src[x << 2] * (100 - BLUR_RED);
|
||||
g = src[(x << 2) + 1] * (100 - BLUR_GREEN);
|
||||
b = src[(x << 2) + 2] * (100 - BLUR_BLUE);
|
||||
|
||||
r += src[y << 2] * BLUR_RED;
|
||||
g += src[(y << 2) + 1] * BLUR_GREEN;
|
||||
b += src[(y << 2) + 2] * BLUR_BLUE;
|
||||
r /= 100;
|
||||
g /= 100;
|
||||
b /= 100;
|
||||
|
||||
if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255;
|
||||
palettetranslate[x | (y << 8)] = ((r >> cshiftr[0]) << cshiftl[0]) |
|
||||
((g >> cshiftr[1]) << cshiftl[1]) |
|
||||
((b >> cshiftr[2]) << cshiftl[2]);
|
||||
}
|
||||
}
|
||||
} else
|
||||
for (x = 0; x < 65536; x++) {
|
||||
uint16 lower, upper;
|
||||
|
||||
lower = (src[((x & 255) << 2)] >> cshiftr[0]) << cshiftl[0];
|
||||
lower |= (src[((x & 255) << 2) + 1] >> cshiftr[1]) << cshiftl[1];
|
||||
lower |= (src[((x & 255) << 2) + 2] >> cshiftr[2]) << cshiftl[2];
|
||||
upper = (src[((x >> 8) << 2)] >> cshiftr[0]) << cshiftl[0];
|
||||
upper |= (src[((x >> 8) << 2) + 1] >> cshiftr[1]) << cshiftl[1];
|
||||
upper |= (src[((x >> 8) << 2) + 2] >> cshiftr[2]) << cshiftl[2];
|
||||
|
||||
palettetranslate[x] = lower | (upper << 16);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
for (x = 0; x < 256; x++) {
|
||||
uint32 r, g, b;
|
||||
|
||||
if (!(highefx & FVB_BLUR)) {
|
||||
r = src[x << 2];
|
||||
g = src[(x << 2) + 1];
|
||||
b = src[(x << 2) + 2];
|
||||
palettetranslate[x] = (r << cshiftl[0]) | (g << cshiftl[1]) | (b << cshiftl[2]);
|
||||
} else
|
||||
for (y = 0; y < 256; y++) {
|
||||
r = src[x << 2] * (100 - BLUR_RED);
|
||||
g = src[(x << 2) + 1] * (100 - BLUR_GREEN);
|
||||
b = src[(x << 2) + 2] * (100 - BLUR_BLUE);
|
||||
|
||||
r += src[y << 2] * BLUR_RED;
|
||||
g += src[(y << 2) + 1] * BLUR_GREEN;
|
||||
b += src[(y << 2) + 2] * BLUR_BLUE;
|
||||
|
||||
r /= 100;
|
||||
g /= 100;
|
||||
b /= 100;
|
||||
if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255;
|
||||
|
||||
palettetranslate[x | (y << 8)] = (r << cshiftl[0]) | (g << cshiftl[1]) | (b << cshiftl[2]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Blit32to24(uint32 *src, uint8 *dest, int xr, int yr, int dpitch) {
|
||||
int x, y;
|
||||
|
||||
for (y = yr; y; y--) {
|
||||
for (x = xr; x; x--) {
|
||||
uint32 tmp = *src;
|
||||
*dest = tmp;
|
||||
dest++;
|
||||
*dest = tmp >> 8;
|
||||
dest++;
|
||||
*dest = tmp >> 16;
|
||||
dest++;
|
||||
src++;
|
||||
}
|
||||
dest += dpitch / 3 - xr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Blit32to16(uint32 *src, uint16 *dest, int xr, int yr, int dpitch,
|
||||
int shiftr[3], int shiftl[3]) {
|
||||
int x, y;
|
||||
//printf("%d\n",shiftl[1]);
|
||||
for (y = yr; y; y--) {
|
||||
for (x = xr; x; x--) {
|
||||
uint32 tmp = *src;
|
||||
uint16 dtmp;
|
||||
|
||||
// Begin iffy code
|
||||
//dtmp = (tmp & backmask[2]) >> shiftr[2];
|
||||
//dtmp |= (tmp & backmask[1]) >> shiftr[1];
|
||||
//dtmp |= (tmp & backmask[0]) >> shiftr[0];
|
||||
// End iffy code
|
||||
|
||||
// Begin non-iffy code
|
||||
dtmp = ((tmp & 0x0000FF) >> shiftr[2]) << shiftl[2];
|
||||
dtmp |= ((tmp & 0x00FF00) >> shiftr[1]) << shiftl[1];
|
||||
dtmp |= ((tmp & 0xFF0000) >> shiftr[0]) << shiftl[0];
|
||||
// End non-iffy code
|
||||
|
||||
//dtmp = ((tmp&0x0000FF) >> 3);
|
||||
//dtmp |= ((tmp&0x00FC00) >>5);
|
||||
//dtmp |= ((tmp&0xF80000) >>8);
|
||||
|
||||
*dest = dtmp;
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
dest += dpitch / 2 - xr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Blit8To8(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, int yscale, int efx, int special) {
|
||||
int x, y;
|
||||
int pinc;
|
||||
|
||||
if (special == 2) {
|
||||
if (xscale != 2 || yscale != 2) return;
|
||||
|
||||
scale(2, dest, pitch, src, 256, 1, xr, yr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (special == 4) {
|
||||
if (xscale != 3 || yscale != 3) return;
|
||||
scale(3, dest, pitch, src, 256, 1, xr, yr);
|
||||
return;
|
||||
}
|
||||
|
||||
pinc = pitch - (xr * xscale);
|
||||
if (xscale != 1 || yscale != 1) {
|
||||
if (efx & FVB_SCANLINES) {
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale - (yscale >> 1);
|
||||
do {
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint8*)dest = *(uint8*)src;
|
||||
dest++;
|
||||
} while (--too);
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
//src-=xr*(yscale-(yscale>>1));
|
||||
dest += pitch * (yscale >> 1);
|
||||
|
||||
src += xr;
|
||||
}
|
||||
} else {
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
do {
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint8*)dest = *(uint8*)src;
|
||||
dest++;
|
||||
} while (--too);
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (y = yr; y; y--, dest += pinc, src += 256 - xr)
|
||||
for (x = xr; x; x -= 4, dest += 4, src += 4)
|
||||
*(uint32*)dest = *(uint32*)src;
|
||||
}
|
||||
}
|
||||
|
||||
/* Todo: Make sure 24bpp code works right with big-endian cpus */
|
||||
|
||||
void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch,
|
||||
int xscale, int yscale) {
|
||||
int x, y;
|
||||
int pinc;
|
||||
uint8 *destbackup = NULL; /* For hq2x */
|
||||
int pitchbackup = 0;
|
||||
|
||||
//static int google=0;
|
||||
//google^=1;
|
||||
|
||||
if (specbuf8bpp) { // 2xscale/3xscale
|
||||
int mult;
|
||||
int base;
|
||||
|
||||
if (silt == 2) mult = 2;
|
||||
else mult = 3;
|
||||
|
||||
Blit8To8(src, specbuf8bpp, xr, yr, 256 * mult, xscale, yscale, 0, silt);
|
||||
|
||||
xr *= mult;
|
||||
yr *= mult;
|
||||
xscale = yscale = 1;
|
||||
src = specbuf8bpp;
|
||||
base = 256 * mult;
|
||||
|
||||
switch (Bpp) {
|
||||
case 4:
|
||||
pinc = pitch - (xr << 2);
|
||||
for (y = yr; y; y--, src += base - xr) {
|
||||
for (x = xr; x; x--) {
|
||||
*(uint32*)dest = palettetranslate[(uint32) * src];
|
||||
dest += 4;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
pinc = pitch - (xr + xr + xr);
|
||||
for (y = yr; y; y--, src += base - xr) {
|
||||
for (x = xr; x; x--) {
|
||||
uint32 tmp = palettetranslate[(uint32) * src];
|
||||
*(uint8*)dest = tmp;
|
||||
*((uint8*)dest + 1) = tmp >> 8;
|
||||
*((uint8*)dest + 2) = tmp >> 16;
|
||||
dest += 3;
|
||||
src++;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
pinc = pitch - (xr << 1);
|
||||
|
||||
for (y = yr; y; y--, src += base - xr) {
|
||||
for (x = xr >> 1; x; x--) {
|
||||
*(uint32*)dest = palettetranslate[*(uint16*)src];
|
||||
dest += 4;
|
||||
src += 2;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
} else if (specbuf) {
|
||||
destbackup = dest;
|
||||
dest = (uint8*)specbuf;
|
||||
pitchbackup = pitch;
|
||||
|
||||
pitch = xr * sizeof(uint16);
|
||||
xscale = 1;
|
||||
yscale = 1;
|
||||
}
|
||||
|
||||
if (highefx & FVB_BLUR) { // DONE
|
||||
if (xscale != 1 || yscale != 1 || (highefx & FVB_SCANLINES)) { // DONE
|
||||
switch (Bpp) {
|
||||
case 4:
|
||||
pinc = pitch - ((xr * xscale) << 2);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
uint8 last = 0x00;
|
||||
|
||||
//if(doo == 1 && google) dest+=4;
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint32*)dest = palettetranslate[*src | (last << 8)];
|
||||
dest += 4;
|
||||
} while (--too);
|
||||
last = *src;
|
||||
}
|
||||
//if(doo == 1 && google) dest-=4;
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
pinc = pitch - ((xr * xscale) * 3);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
uint8 last = 0x00;
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint32*)dest = palettetranslate[*src | (last << 8)];
|
||||
dest += 3;
|
||||
} while (--too);
|
||||
last = *src;
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pinc = pitch - ((xr * xscale) << 1);
|
||||
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
uint8 last = 0x00;
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint16*)dest = palettetranslate[*src | (last << 8)];
|
||||
dest += 2;
|
||||
} while (--too);
|
||||
last = *src;
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else // No scaling, no scanlines, just blurring. - DONE
|
||||
switch (Bpp) {
|
||||
case 4:
|
||||
pinc = pitch - (xr << 2);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
uint8 last = 0x00;
|
||||
for (x = xr; x; x--) {
|
||||
*(uint32*)dest = palettetranslate[*src | (last << 8)];
|
||||
last = *src;
|
||||
dest += 4;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
pinc = pitch - (xr + xr + xr);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
uint8 last = 0x00;
|
||||
for (x = xr; x; x--) {
|
||||
uint32 tmp = palettetranslate[*src | (last << 8)];
|
||||
last = *src;
|
||||
*(uint8*)dest = tmp;
|
||||
*((uint8*)dest + 1) = tmp >> 8;
|
||||
*((uint8*)dest + 2) = tmp >> 16;
|
||||
dest += 3;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
pinc = pitch - (xr << 1);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
uint8 last = 0x00;
|
||||
for (x = xr; x; x--) {
|
||||
*(uint16*)dest = palettetranslate[*src | (last << 8)];
|
||||
last = *src;
|
||||
dest += 2;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else { // No blur effects.
|
||||
if (xscale != 1 || yscale != 1 || (highefx & FVB_SCANLINES)) {
|
||||
switch (Bpp) {
|
||||
case 4:
|
||||
pinc = pitch - ((xr * xscale) << 2);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint32*)dest = palettetranslate[*src];
|
||||
dest += 4;
|
||||
} while (--too);
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pinc = pitch - ((xr * xscale) * 3);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
uint32 tmp = palettetranslate[(uint32) * src];
|
||||
*(uint8*)dest = tmp;
|
||||
*((uint8*)dest + 1) = tmp >> 8;
|
||||
*((uint8*)dest + 2) = tmp >> 16;
|
||||
dest += 3;
|
||||
|
||||
//*(uint32 *)dest=palettetranslate[*src];
|
||||
//dest+=4;
|
||||
} while (--too);
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pinc = pitch - ((xr * xscale) << 1);
|
||||
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
int doo = yscale;
|
||||
|
||||
if (highefx & FVB_SCANLINES)
|
||||
doo -= yscale >> 1;
|
||||
do {
|
||||
for (x = xr; x; x--, src++) {
|
||||
int too = xscale;
|
||||
do {
|
||||
*(uint16*)dest = palettetranslate[*src];
|
||||
dest += 2;
|
||||
} while (--too);
|
||||
}
|
||||
src -= xr;
|
||||
dest += pinc;
|
||||
} while (--doo);
|
||||
src += xr;
|
||||
if (highefx & FVB_SCANLINES)
|
||||
dest += pitch * (yscale >> 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else
|
||||
switch (Bpp) {
|
||||
case 4:
|
||||
pinc = pitch - (xr << 2);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
for (x = xr; x; x--) {
|
||||
*(uint32*)dest = palettetranslate[(uint32) * src];
|
||||
dest += 4;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
pinc = pitch - (xr + xr + xr);
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
for (x = xr; x; x--) {
|
||||
uint32 tmp = palettetranslate[(uint32) * src];
|
||||
*(uint8*)dest = tmp;
|
||||
*((uint8*)dest + 1) = tmp >> 8;
|
||||
*((uint8*)dest + 2) = tmp >> 16;
|
||||
dest += 3;
|
||||
src++;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
pinc = pitch - (xr << 1);
|
||||
|
||||
for (y = yr; y; y--, src += 256 - xr) {
|
||||
for (x = xr >> 1; x; x--) {
|
||||
*(uint32*)dest = palettetranslate[*(uint16*)src];
|
||||
dest += 4;
|
||||
src += 2;
|
||||
}
|
||||
dest += pinc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (specbuf) {
|
||||
if (specbuf32bpp) {
|
||||
int mult = (silt == 3) ? 3 : 2;
|
||||
|
||||
if (silt == 3)
|
||||
hq3x_32((uint8*)specbuf, (uint8*)specbuf32bpp, xr, yr, xr * 3 * sizeof(uint32));
|
||||
else
|
||||
hq2x_32((uint8*)specbuf, (uint8*)specbuf32bpp, xr, yr, xr * 2 * sizeof(uint32));
|
||||
|
||||
if (backBpp == 2)
|
||||
Blit32to16(specbuf32bpp, (uint16*)destbackup, xr * mult, yr * mult, pitchbackup, backshiftr, backshiftl);
|
||||
else// == 3
|
||||
Blit32to24(specbuf32bpp, (uint8*)destbackup, xr * mult, yr * mult, pitchbackup);
|
||||
} else {
|
||||
if (silt == 3)
|
||||
hq3x_32((uint8*)specbuf, destbackup, xr, yr, pitchbackup);
|
||||
else
|
||||
hq2x_32((uint8*)specbuf, destbackup, xr, yr, pitchbackup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int eefx, int specfilt);
|
||||
void SetPaletteBlitToHigh(uint8 *src);
|
||||
void KillBlitToHigh(void);
|
||||
void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, int yscale);
|
||||
void Blit8To8(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, int yscale, int efx, int special);
|
||||
@@ -1,38 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../common/args.h"
|
||||
|
||||
char *ParseArgies(int argc, char *argv[]) {
|
||||
// int x;
|
||||
static ARGPSTRUCT FCEUArgs[] = {
|
||||
{ "-pal", 0, &palyo, 0 },
|
||||
{ "-gg", 0, &genie, 0 },
|
||||
{ "-no8lim", 0, &eoptions, 0x8000 | EO_NOSPRLIM },
|
||||
//{"-nofs",0,&eoptions,0},
|
||||
{ "-clipsides", 0, &eoptions, 0x8000 | EO_CLIPSIDES },
|
||||
{ "-nothrottle", 0, &eoptions, 0x8000 | EO_NOTHROTTLE },
|
||||
};
|
||||
|
||||
if (argc <= 1) return(0);
|
||||
|
||||
ParseArguments(argc - 2, &argv[1], FCEUArgs);
|
||||
return(argv[argc - 1]);
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "cheat.h"
|
||||
|
||||
static HWND acwin = 0;
|
||||
|
||||
static int selcheat;
|
||||
static int scheatmethod = 0;
|
||||
static uint8 cheatval1 = 0;
|
||||
static uint8 cheatval2 = 0;
|
||||
|
||||
#define CSTOD 24
|
||||
|
||||
static uint16 StrToU16(char *s) {
|
||||
unsigned int ret = 0;
|
||||
sscanf(s, "%4x", &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint8 StrToU8(char *s) {
|
||||
unsigned int ret = 0;
|
||||
sscanf(s, "%d", &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int StrToI(char *s) {
|
||||
int ret = 0;
|
||||
sscanf(s, "%d", &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Need to be careful where these functions are used. */
|
||||
static char *U16ToStr(uint16 a) {
|
||||
static char TempArray[16];
|
||||
sprintf(TempArray, "%04X", a);
|
||||
return TempArray;
|
||||
}
|
||||
|
||||
static char *U8ToStr(uint8 a) {
|
||||
static char TempArray[16];
|
||||
sprintf(TempArray, "%03d", a);
|
||||
return TempArray;
|
||||
}
|
||||
|
||||
static char *IToStr(int a) {
|
||||
static char TempArray[32];
|
||||
sprintf(TempArray, "%d", a);
|
||||
return TempArray;
|
||||
}
|
||||
|
||||
static HWND RedoCheatsWND;
|
||||
static int RedoCheatsCallB(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data) {
|
||||
char tmp[512];
|
||||
sprintf(tmp, "%s %s", s ? "+" : "-", name);
|
||||
SendDlgItemMessage(RedoCheatsWND, 300, LB_ADDSTRING, 0, (LPARAM)(LPSTR)tmp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void RedoCheatsLB(HWND hwndDlg) {
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_RESETCONTENT, 0, 0);
|
||||
RedoCheatsWND = hwndDlg;
|
||||
FCEUI_ListCheats(RedoCheatsCallB, 0);
|
||||
}
|
||||
|
||||
int cfcallb(uint32 a, uint8 last, uint8 current) {
|
||||
char temp[16];
|
||||
|
||||
sprintf(temp, "%04X:%03d:%03d", (unsigned int)a, last, current);
|
||||
SendDlgItemMessage(acwin, 108, LB_ADDSTRING, 0, (LPARAM)(LPSTR)temp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int scrollindex;
|
||||
static int scrollnum;
|
||||
static int scrollmax;
|
||||
|
||||
int cfcallbinsert(uint32 a, uint8 last, uint8 current) {
|
||||
char temp[16];
|
||||
|
||||
sprintf(temp, "%04X:%03d:%03d", (unsigned int)a, last, current);
|
||||
SendDlgItemMessage(acwin, 108, LB_INSERTSTRING, (CSTOD - 1), (LPARAM)(LPSTR)temp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
int cfcallbinsertt(uint32 a, uint8 last, uint8 current) {
|
||||
char temp[16];
|
||||
|
||||
sprintf(temp, "%04X:%03d:%03d", (unsigned int)a, last, current);
|
||||
SendDlgItemMessage(acwin, 108, LB_INSERTSTRING, 0, (LPARAM)(LPSTR)temp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
void AddTheThing(HWND hwndDlg, char *s, int a, int v) {
|
||||
if (FCEUI_AddCheat(s, a, v, -1, 0))
|
||||
MessageBox(hwndDlg, "Cheat Added", "Cheat Added", MB_OK);
|
||||
}
|
||||
|
||||
|
||||
static void DoGet(void) {
|
||||
int n = FCEUI_CheatSearchGetCount();
|
||||
int t;
|
||||
scrollnum = n;
|
||||
scrollindex = -32768;
|
||||
|
||||
SendDlgItemMessage(acwin, 108, LB_RESETCONTENT, 0, 0);
|
||||
FCEUI_CheatSearchGetRange(0, (CSTOD - 1), cfcallb);
|
||||
|
||||
t = -32768 + n - 1 - (CSTOD - 1);
|
||||
if (t < -32768)
|
||||
t = -32768;
|
||||
scrollmax = t;
|
||||
SendDlgItemMessage(acwin, 120, SBM_SETRANGE, -32768, t);
|
||||
SendDlgItemMessage(acwin, 120, SBM_SETPOS, -32768, 1);
|
||||
}
|
||||
|
||||
static void FixCheatSelButtons(HWND hwndDlg, int how) {
|
||||
/* Update Cheat Button */
|
||||
EnableWindow(GetDlgItem(hwndDlg, 251), how);
|
||||
|
||||
/* Delete Cheat Button */
|
||||
EnableWindow(GetDlgItem(hwndDlg, 252), how);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK AddCheatCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
static int lbfocus;
|
||||
static HWND hwndLB;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_VSCROLL:
|
||||
if (scrollnum > (CSTOD - 1)) {
|
||||
switch ((int)LOWORD(wParam)) {
|
||||
case SB_TOP:
|
||||
scrollindex = -32768;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb);
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
scrollindex = scrollmax;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb);
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
if (scrollindex > -32768) {
|
||||
scrollindex--;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_DELETESTRING, (CSTOD - 1), 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768, cfcallbinsertt);
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
scrollindex -= CSTOD;
|
||||
if (scrollindex < -32768) scrollindex = -32768;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb);
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
if (scrollindex < scrollmax) {
|
||||
scrollindex++;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_DELETESTRING, 0, 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768 + (CSTOD - 1), scrollindex + 32768 + (CSTOD - 1), cfcallbinsert);
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
scrollindex += CSTOD;
|
||||
if (scrollindex > scrollmax)
|
||||
scrollindex = scrollmax;
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, 0, 0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb);
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
scrollindex = (short int)HIWORD(wParam);
|
||||
SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1);
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, 0, 0);
|
||||
FCEUI_CheatSearchGetRange(32768 + scrollindex, 32768 + scrollindex + (CSTOD - 1), cfcallb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
selcheat = -1;
|
||||
FixCheatSelButtons(hwndDlg, 0);
|
||||
acwin = hwndDlg;
|
||||
SetDlgItemText(hwndDlg, 110, (LPTSTR)U8ToStr(cheatval1));
|
||||
SetDlgItemText(hwndDlg, 111, (LPTSTR)U8ToStr(cheatval2));
|
||||
DoGet();
|
||||
CheckRadioButton(hwndDlg, 115, 120, scheatmethod + 115);
|
||||
lbfocus = 0;
|
||||
hwndLB = 0;
|
||||
|
||||
RedoCheatsLB(hwndDlg);
|
||||
break;
|
||||
|
||||
case WM_VKEYTOITEM:
|
||||
if (lbfocus) {
|
||||
int real;
|
||||
|
||||
real = SendDlgItemMessage(hwndDlg, 108, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
switch ((int)LOWORD(wParam)) {
|
||||
case VK_UP:
|
||||
/* mmmm....recursive goodness */
|
||||
if (!real)
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_LINEUP, 0);
|
||||
return(-1);
|
||||
break;
|
||||
case VK_DOWN:
|
||||
if (real == (CSTOD - 1))
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_LINEDOWN, 0);
|
||||
return(-1);
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_PAGEUP, 0);
|
||||
break;
|
||||
case VK_NEXT:
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_PAGEDOWN, 0);
|
||||
break;
|
||||
case VK_HOME:
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_TOP, 0);
|
||||
break;
|
||||
case VK_END:
|
||||
SendMessage(hwndDlg, WM_VSCROLL, SB_BOTTOM, 0);
|
||||
break;
|
||||
}
|
||||
return(-2);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT: goto gornk;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case 300: /* List box selection changed. */
|
||||
if (HIWORD(wParam) == LBN_SELCHANGE) {
|
||||
char *s;
|
||||
uint32 a;
|
||||
uint8 v;
|
||||
int status;
|
||||
int c, type;
|
||||
|
||||
selcheat = SendDlgItemMessage(hwndDlg, 300, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
if (selcheat < 0) {
|
||||
FixCheatSelButtons(hwndDlg, 0);
|
||||
break;
|
||||
}
|
||||
FixCheatSelButtons(hwndDlg, 1);
|
||||
|
||||
FCEUI_GetCheat(selcheat, &s, &a, &v, &c, &status, &type);
|
||||
SetDlgItemText(hwndDlg, 200, (LPTSTR)s);
|
||||
SetDlgItemText(hwndDlg, 201, (LPTSTR)U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, 202, (LPTSTR)U8ToStr(v));
|
||||
SetDlgItemText(hwndDlg, 203, (c == -1) ? (LPTSTR)"" : (LPTSTR)IToStr(c));
|
||||
CheckDlgButton(hwndDlg, 204, type ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
break;
|
||||
case 108:
|
||||
switch (HIWORD(wParam)) {
|
||||
case LBN_SELCHANGE:
|
||||
{
|
||||
char TempArray[32];
|
||||
SendDlgItemMessage(hwndDlg, 108, LB_GETTEXT, SendDlgItemMessage(hwndDlg, 108, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0), (LPARAM)(LPCTSTR)TempArray);
|
||||
TempArray[4] = 0;
|
||||
SetDlgItemText(hwndDlg, 201, (LPTSTR)TempArray);
|
||||
}
|
||||
break;
|
||||
case LBN_SETFOCUS:
|
||||
lbfocus = 1;
|
||||
break;
|
||||
case LBN_KILLFOCUS:
|
||||
lbfocus = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (HIWORD(wParam)) {
|
||||
case LBN_DBLCLK:
|
||||
if (selcheat >= 0) {
|
||||
if (LOWORD(wParam) == 300)
|
||||
FCEUI_ToggleCheat(selcheat);
|
||||
RedoCheatsLB(hwndDlg);
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case BN_CLICKED:
|
||||
if (LOWORD(wParam) >= 115 && LOWORD(wParam) <= 120)
|
||||
scheatmethod = LOWORD(wParam) - 115;
|
||||
else switch (LOWORD(wParam)) {
|
||||
case 112:
|
||||
FCEUI_CheatSearchBegin();
|
||||
DoGet();
|
||||
break;
|
||||
case 113:
|
||||
FCEUI_CheatSearchEnd(scheatmethod, cheatval1, cheatval2);
|
||||
DoGet();
|
||||
break;
|
||||
case 114:
|
||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||
DoGet();
|
||||
break;
|
||||
case 107:
|
||||
FCEUI_CheatSearchShowExcluded();
|
||||
DoGet();
|
||||
break;
|
||||
case 250: /* Add Cheat Button */
|
||||
{
|
||||
int a, v, c, t;
|
||||
char name[257];
|
||||
char temp[16];
|
||||
|
||||
GetDlgItemText(hwndDlg, 200, name, 256 + 1);
|
||||
GetDlgItemText(hwndDlg, 201, temp, 4 + 1);
|
||||
a = StrToU16(temp);
|
||||
GetDlgItemText(hwndDlg, 202, temp, 3 + 1);
|
||||
v = StrToU8(temp);
|
||||
GetDlgItemText(hwndDlg, 203, temp, 3 + 1);
|
||||
if (temp[0] == 0)
|
||||
c = -1;
|
||||
else
|
||||
c = StrToI(temp);
|
||||
t = (IsDlgButtonChecked(hwndDlg, 204) == BST_CHECKED) ? 1 : 0;
|
||||
FCEUI_AddCheat(name, a, v, c, t);
|
||||
RedoCheatsLB(hwndDlg);
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0);
|
||||
}
|
||||
break;
|
||||
case 253: /* Add GG Cheat Button */
|
||||
{
|
||||
uint16 a;
|
||||
int c;
|
||||
uint8 v;
|
||||
char name[257];
|
||||
|
||||
GetDlgItemText(hwndDlg, 200, name, 256 + 1);
|
||||
|
||||
if (FCEUI_DecodeGG(name, &a, &v, &c)) {
|
||||
FCEUI_AddCheat(name, a, v, c, 1);
|
||||
RedoCheatsLB(hwndDlg);
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 251: /* Update Cheat Button */
|
||||
if (selcheat >= 0) {
|
||||
int a, v, c, t;
|
||||
char name[257];
|
||||
char temp[16];
|
||||
|
||||
GetDlgItemText(hwndDlg, 200, name, 256 + 1);
|
||||
GetDlgItemText(hwndDlg, 201, temp, 4 + 1);
|
||||
a = StrToU16(temp);
|
||||
GetDlgItemText(hwndDlg, 202, temp, 3 + 1);
|
||||
v = StrToU8(temp);
|
||||
GetDlgItemText(hwndDlg, 203, temp, 3 + 1);
|
||||
if (temp[0] == 0)
|
||||
c = -1;
|
||||
else
|
||||
c = StrToI(temp);
|
||||
t = (IsDlgButtonChecked(hwndDlg, 204) == BST_CHECKED) ? 1 : 0;
|
||||
FCEUI_SetCheat(selcheat, name, a, v, c, -1, t);
|
||||
RedoCheatsLB(hwndDlg);
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0);
|
||||
}
|
||||
break;
|
||||
case 252: /* Delete cheat button */
|
||||
if (selcheat >= 0) {
|
||||
FCEUI_DelCheat(selcheat);
|
||||
SendDlgItemMessage(hwndDlg, 300, LB_DELETESTRING, selcheat, 0);
|
||||
FixCheatSelButtons(hwndDlg, 0);
|
||||
selcheat = -1;
|
||||
SetDlgItemText(hwndDlg, 200, (LPTSTR)"");
|
||||
SetDlgItemText(hwndDlg, 201, (LPTSTR)"");
|
||||
SetDlgItemText(hwndDlg, 202, (LPTSTR)"");
|
||||
SetDlgItemText(hwndDlg, 203, (LPTSTR)"");
|
||||
CheckDlgButton(hwndDlg, 204, BST_UNCHECKED);
|
||||
}
|
||||
break;
|
||||
case 106:
|
||||
gornk:
|
||||
EndDialog(hwndDlg, 0);
|
||||
acwin = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EN_CHANGE:
|
||||
{
|
||||
char TempArray[256];
|
||||
GetDlgItemText(hwndDlg, LOWORD(wParam), TempArray, 256);
|
||||
switch (LOWORD(wParam)) {
|
||||
case 110: cheatval1 = StrToU8(TempArray); break;
|
||||
case 111: cheatval2 = StrToU8(TempArray); break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ConfigAddCheat(HWND wnd) {
|
||||
if (!GI) {
|
||||
FCEUD_PrintError("You must have a game loaded before you can manipulate cheats.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GI->type == GIT_NSF) {
|
||||
FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
|
||||
return;
|
||||
}
|
||||
|
||||
DialogBox(fceu_hInstance, "ADDCHEAT", wnd, AddCheatCallB);
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
void ConfigCheats(HWND hParent);
|
||||
void ConfigAddCheat(HWND wnd);
|
||||
@@ -1,43 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#define WIN32
|
||||
#endif
|
||||
#undef WINNT
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#define DIRECTSOUND_VERSION 0x0700
|
||||
#define DIRECTDRAW_VERSION 0x0700
|
||||
#define DIRECTINPUT_VERSION 0x700
|
||||
#include "../../driver.h"
|
||||
#include "../common/config.h"
|
||||
|
||||
/* Message logging(non-netplay messages, usually) for all. */
|
||||
#include "log.h"
|
||||
extern HWND hAppWnd;
|
||||
extern HINSTANCE fceu_hInstance;
|
||||
|
||||
extern int NoWaiting;
|
||||
extern FCEUGI *GI;
|
||||
void DSMFix(UINT msg);
|
||||
void StopSound(void);
|
||||
|
||||
extern int eoptions;
|
||||
|
||||
#define EO_BGRUN 1
|
||||
|
||||
#define EO_CPALETTE 4
|
||||
#define EO_NOSPRLIM 8
|
||||
#define EO_FSAFTERLOAD 32
|
||||
#define EO_FOAFTERSTART 64
|
||||
#define EO_NOTHROTTLE 128
|
||||
#define EO_CLIPSIDES 256
|
||||
#define EO_SNAPNAME 512
|
||||
#define EO_HIDEMENU 2048
|
||||
#define EO_HIGHPRIO 4096
|
||||
#define EO_FORCEASPECT 8192
|
||||
#define EO_FORCEISCALE 16384
|
||||
#define EO_NOFOURSCORE 32768
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/****************************************************************/
|
||||
/* FCE Ultra */
|
||||
/* */
|
||||
/* This file contains code to interface to the standard */
|
||||
/* FCE Ultra configuration file saving/loading code. */
|
||||
/* */
|
||||
/****************************************************************/
|
||||
|
||||
static CFGSTRUCT fceuconfig[] = {
|
||||
ACS(rfiles[0]),
|
||||
ACS(rfiles[1]),
|
||||
ACS(rfiles[2]),
|
||||
ACS(rfiles[3]),
|
||||
ACS(rfiles[4]),
|
||||
ACS(rfiles[5]),
|
||||
ACS(rfiles[6]),
|
||||
ACS(rfiles[7]),
|
||||
ACS(rfiles[8]),
|
||||
ACS(rfiles[9]),
|
||||
|
||||
ACS(rdirs[0]),
|
||||
ACS(rdirs[1]),
|
||||
ACS(rdirs[2]),
|
||||
ACS(rdirs[3]),
|
||||
ACS(rdirs[4]),
|
||||
ACS(rdirs[5]),
|
||||
ACS(rdirs[6]),
|
||||
ACS(rdirs[7]),
|
||||
ACS(rdirs[8]),
|
||||
ACS(rdirs[9]),
|
||||
|
||||
AC(ntsccol), AC(ntsctint), AC(ntschue),
|
||||
|
||||
NAC("palyo", palyo),
|
||||
NAC("genie", genie),
|
||||
NAC("fs", fullscreen),
|
||||
NAC("vgamode", vmod),
|
||||
NAC("sound", soundo),
|
||||
|
||||
ACS(gfsdir),
|
||||
|
||||
NACS("odcheats", DOvers[0]),
|
||||
NACS("odmisc", DOvers[1]),
|
||||
NACS("odnonvol", DOvers[2]),
|
||||
NACS("odstates", DOvers[3]),
|
||||
NACS("odsnaps", DOvers[4]),
|
||||
NACS("odbase", DOvers[5]),
|
||||
|
||||
AC(winspecial),
|
||||
AC(winsizemulx),
|
||||
AC(winsizemuly),
|
||||
NAC("saspectw987", saspectw),
|
||||
NAC("saspecth987", saspecth),
|
||||
|
||||
AC(soundrate),
|
||||
AC(soundbuftime),
|
||||
AC(soundoptions),
|
||||
AC(soundquality),
|
||||
AC(soundvolume),
|
||||
|
||||
AC(goptions),
|
||||
NAC("eoptions", eoptions),
|
||||
NACA("cpalette", cpalette),
|
||||
|
||||
NACA("InputType", UsrInputType),
|
||||
|
||||
NAC("vmcx", vmodes[0].x),
|
||||
NAC("vmcy", vmodes[0].y),
|
||||
NAC("vmcb", vmodes[0].bpp),
|
||||
NAC("vmcf", vmodes[0].flags),
|
||||
NAC("vmcxs", vmodes[0].xscale),
|
||||
NAC("vmcys", vmodes[0].yscale),
|
||||
NAC("vmspecial", vmodes[0].special),
|
||||
|
||||
NAC("srendline", srendlinen),
|
||||
NAC("erendline", erendlinen),
|
||||
NAC("srendlinep", srendlinep),
|
||||
NAC("erendlinep", erendlinep),
|
||||
|
||||
AC(disvaccel),
|
||||
AC(winsync),
|
||||
NAC("988fssync", fssync),
|
||||
|
||||
AC(ismaximized),
|
||||
AC(maxconbskip),
|
||||
AC(ffbskip),
|
||||
|
||||
ADDCFGSTRUCT(NetplayConfig),
|
||||
ADDCFGSTRUCT(InputConfig),
|
||||
ENDCFGSTRUCT
|
||||
};
|
||||
|
||||
static void SaveConfig(char *filename) {
|
||||
SaveFCEUConfig(filename, fceuconfig);
|
||||
}
|
||||
|
||||
static void LoadConfig(char *filename) {
|
||||
FCEUI_GetNTSCTH(&ntsctint, &ntschue);
|
||||
LoadFCEUConfig(filename, fceuconfig);
|
||||
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
|
||||
}
|
||||
|
||||
@@ -1,672 +0,0 @@
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
#include "common.h"
|
||||
#include "../../x6502.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../ppuview.h"
|
||||
#include "debug.h"
|
||||
#include "../../ppu.h"
|
||||
#include "../../fds.h"
|
||||
|
||||
static void DoMemmo(HWND hParent);
|
||||
void UpdateDebugger(void);
|
||||
//static int discallb(uint16 a, char *s);
|
||||
static void crs(HWND hParent);
|
||||
static void Disyou(uint16 a);
|
||||
static void UpdateDMem(uint16 a);
|
||||
|
||||
static HWND mwin = 0;
|
||||
static int32 cmsi;
|
||||
static int instep = -1;
|
||||
static X6502 *Xsave;
|
||||
|
||||
extern uint32 RefreshAddr;
|
||||
|
||||
HWND dwin;
|
||||
|
||||
static uint16 StrToU16(char *s) {
|
||||
unsigned int ret = 0;
|
||||
sscanf(s, "%4x", &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint8 StrToU8(char *s) {
|
||||
unsigned int ret = 0;
|
||||
sscanf(s, "%2x", &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Need to be careful where these functions are used. */
|
||||
static char *U16ToStr(uint16 a) {
|
||||
static char TempArray[16];
|
||||
sprintf(TempArray, "%04X", a);
|
||||
return TempArray;
|
||||
}
|
||||
|
||||
static char *U8ToStr(uint8 a) {
|
||||
static char TempArray[16];
|
||||
sprintf(TempArray, "%02X", a);
|
||||
return TempArray;
|
||||
}
|
||||
|
||||
static uint16 asavers[27];
|
||||
|
||||
|
||||
static void crs(HWND hParent) {
|
||||
EnableWindow(GetDlgItem(hParent, 301), (instep >= 0) ? 1 : 0);
|
||||
}
|
||||
|
||||
static void Disyou(uint16 a) {
|
||||
int discount;
|
||||
|
||||
SendDlgItemMessage(dwin, 100, LB_RESETCONTENT, 0, 0);
|
||||
|
||||
discount = 0;
|
||||
while (discount < 25) {
|
||||
char buffer[256];
|
||||
uint16 prea = a;
|
||||
|
||||
asavers[discount] = a;
|
||||
sprintf(buffer, "%04x: ", a);
|
||||
|
||||
a = FCEUI_Disassemble(Xsave, a, buffer + strlen(buffer));
|
||||
if (prea == Xsave->PC)
|
||||
SendDlgItemMessage(dwin, 100, LB_SETCURSEL, discount, 0);
|
||||
|
||||
SendDlgItemMessage(dwin, 100, LB_ADDSTRING, 0, (LPARAM)(LPSTR)buffer);
|
||||
discount++;
|
||||
}
|
||||
//FCEUI_Disassemble(Xsave,a,discallb);
|
||||
}
|
||||
|
||||
static void SSI(X6502 *X) {
|
||||
SCROLLINFO si;
|
||||
|
||||
memset(&si, 0, sizeof(si));
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_ALL;
|
||||
si.nMin = -32768;
|
||||
si.nMax = 32767;
|
||||
si.nPage = 27;
|
||||
si.nPos = X->PC - 32768;
|
||||
SetScrollInfo(GetDlgItem(dwin, 101), SB_CTL, &si, 1);
|
||||
}
|
||||
|
||||
static void RFlags(X6502 *X) {
|
||||
int x;
|
||||
|
||||
SetDlgItemText(dwin, 202, (LPTSTR)U8ToStr(X->P & ~0x30));
|
||||
for (x = 0; x < 8; x++) {
|
||||
if (x != 4 && x != 5)
|
||||
CheckDlgButton(dwin, 400 + x, ((X->P >> x) & 1) ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
}
|
||||
|
||||
static void RRegs(X6502 *X) {
|
||||
SetDlgItemText(dwin, 200, (LPTSTR)U16ToStr(X->PC));
|
||||
SetDlgItemText(dwin, 201, (LPTSTR)U8ToStr(X->S));
|
||||
SetDlgItemText(dwin, 210, (LPTSTR)U8ToStr(X->A));
|
||||
SetDlgItemText(dwin, 211, (LPTSTR)U8ToStr(X->X));
|
||||
SetDlgItemText(dwin, 212, (LPTSTR)U8ToStr(X->Y));
|
||||
SetDlgItemText(dwin, 223, (LPTSTR)U16ToStr(RefreshAddr));
|
||||
SetDlgItemText(dwin, 224, (LPTSTR)U16ToStr(lastDiskPtrRead));
|
||||
SetDlgItemText(dwin, 225, (LPTSTR)U16ToStr(lastDiskPtrWrite));
|
||||
}
|
||||
|
||||
static void DoVecties(HWND hParent) {
|
||||
uint16 m[3];
|
||||
int x;
|
||||
|
||||
FCEUI_GetIVectors(&m[2], &m[0], &m[1]);
|
||||
for (x = 0; x < 3; x++)
|
||||
SetDlgItemText(hParent, 220 + x, (LPTSTR)U16ToStr(m[x]));
|
||||
}
|
||||
|
||||
static void Redrawsy(X6502 *X) {
|
||||
SSI(X);
|
||||
RFlags(X);
|
||||
RRegs(X);
|
||||
Disyou(X->PC);
|
||||
DoVecties(dwin);
|
||||
}
|
||||
|
||||
int BlockingCheck(void);
|
||||
|
||||
static void MultiCB(X6502 *X) {
|
||||
Xsave = X;
|
||||
if (instep >= 0) {
|
||||
Redrawsy(X);
|
||||
if (mwin)
|
||||
UpdateDMem(cmsi);
|
||||
}
|
||||
|
||||
while (instep >= 0) {
|
||||
if (instep >= 1) {
|
||||
instep--;
|
||||
return;
|
||||
}
|
||||
StopSound();
|
||||
if (!BlockingCheck()) { /* Whoops, need to exit for some reason. */
|
||||
instep = -1;
|
||||
FCEUI_SetCPUCallback(0);
|
||||
return;
|
||||
}
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
|
||||
static int multistep = 0;
|
||||
static void cpucb(X6502 *X) {
|
||||
multistep = 0;
|
||||
MultiCB(X);
|
||||
}
|
||||
|
||||
static void BPointHandler(X6502 *X, int type, unsigned int A) {
|
||||
if (multistep) return; /* To handle instructions that can cause multiple
|
||||
breakpoints per instruction. */
|
||||
if (!dwin) return; /* Window is closed, don't do breakpoints. */
|
||||
multistep = 1;
|
||||
instep = 0;
|
||||
crs(dwin);
|
||||
MultiCB(X);
|
||||
}
|
||||
|
||||
static HWND hWndCallB;
|
||||
static int RBPCallBack(int type, unsigned int A1, unsigned int A2,
|
||||
void (*Handler)(X6502 *, int type, unsigned int A)) {
|
||||
char buf[128];
|
||||
sprintf(buf, "%s%s%s%s $%04x - $%04x", (type & BPOINT_READ) ? "R" : " ",
|
||||
(type & BPOINT_WRITE) ? "W" : " ", (type & BPOINT_PC) ? "P" : " ", (type & BPOINT_EXCLUDE) ? "X" : " ", A1, A2);
|
||||
SendDlgItemMessage(hWndCallB, 510, LB_ADDSTRING, 0, (LPARAM)(LPSTR)buf);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void RebuildBPointList(HWND hwndDlg) {
|
||||
SendDlgItemMessage(hwndDlg, 510, LB_RESETCONTENT, 0, 0);
|
||||
hWndCallB = hwndDlg;
|
||||
FCEUI_ListBreakPoints(RBPCallBack);
|
||||
}
|
||||
|
||||
static void FetchBPDef(HWND hwndDlg, uint16 *A1, uint16 *A2, int *type) {
|
||||
char tmp[256];
|
||||
|
||||
GetDlgItemText(hwndDlg, 520, tmp, 256);
|
||||
*A1 = StrToU16(tmp);
|
||||
GetDlgItemText(hwndDlg, 521, tmp, 256);
|
||||
if (tmp[0] == 0)
|
||||
*A2 = *A1;
|
||||
else
|
||||
*A2 = StrToU16(tmp);
|
||||
|
||||
*type = 0;
|
||||
*type |= (IsDlgButtonChecked(hwndDlg, 530) == BST_CHECKED) ? BPOINT_READ : 0;
|
||||
*type |= (IsDlgButtonChecked(hwndDlg, 531) == BST_CHECKED) ? BPOINT_WRITE : 0;
|
||||
*type |= (IsDlgButtonChecked(hwndDlg, 532) == BST_CHECKED) ? BPOINT_PC : 0;
|
||||
*type |= (IsDlgButtonChecked(hwndDlg, 533) == BST_CHECKED) ? BPOINT_EXCLUDE : 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK DebugCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
int32 scrollindex = 0, ced = 0;
|
||||
int type;
|
||||
DSMFix(uMsg);
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
crs(hwndDlg);
|
||||
DoVecties(hwndDlg);
|
||||
FCEUI_SetCPUCallback(cpucb);
|
||||
RebuildBPointList(hwndDlg);
|
||||
break;
|
||||
case WM_VSCROLL:
|
||||
if (0 != instep) break;
|
||||
switch ((int)LOWORD(wParam)) {
|
||||
case SB_TOP:
|
||||
scrollindex = -32768;
|
||||
ced = 1;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
scrollindex = 32767;
|
||||
ced = 1;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 101), SB_CTL);
|
||||
if (scrollindex > -32768) {
|
||||
scrollindex--;
|
||||
ced = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 101), SB_CTL);
|
||||
scrollindex -= 27;
|
||||
if (scrollindex < -32768)
|
||||
scrollindex = -32768;
|
||||
ced = 1;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 101), SB_CTL);
|
||||
if (scrollindex < 32767) {
|
||||
scrollindex++;
|
||||
ced = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 101), SB_CTL);
|
||||
scrollindex += 27;
|
||||
if (scrollindex > 32767) {
|
||||
scrollindex = 32767;
|
||||
}
|
||||
ced = 1;
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
scrollindex = (int16)(wParam >> 16);
|
||||
ced = 1;
|
||||
break;
|
||||
}
|
||||
if (ced) {
|
||||
SendDlgItemMessage(hwndDlg, 101, SBM_SETPOS, scrollindex, 1);
|
||||
Disyou(scrollindex + 32768);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT: goto gornk;
|
||||
case WM_COMMAND:
|
||||
switch (HIWORD(wParam)) {
|
||||
case LBN_DBLCLK:
|
||||
if ((0 == instep) && (LOWORD(wParam) == 0x64)) {
|
||||
uint16 A1, A2;
|
||||
type = BPOINT_READ | BPOINT_PC;
|
||||
A1 = A2 = asavers[SendDlgItemMessage(hwndDlg, 100, LB_GETCURSEL, 0, 0)];
|
||||
FCEUI_AddBreakPoint(type, A1, A2, BPointHandler);
|
||||
hWndCallB = hwndDlg; /* Hacky hacky. */
|
||||
RBPCallBack(type, A1, A2, 0);
|
||||
}
|
||||
break;
|
||||
case EN_KILLFOCUS:
|
||||
{
|
||||
char TempArray[64];
|
||||
int id = LOWORD(wParam);
|
||||
GetDlgItemText(hwndDlg, id, TempArray, 64);
|
||||
|
||||
if (0 == instep) {
|
||||
int tscroll = 32768 + SendDlgItemMessage(hwndDlg, 101, SBM_GETPOS, 0, 0);
|
||||
|
||||
switch (id) {
|
||||
case 200:
|
||||
if (Xsave->PC != StrToU16(TempArray)) {
|
||||
Xsave->PC = StrToU16(TempArray);
|
||||
Disyou(Xsave->PC);
|
||||
RRegs(Xsave);
|
||||
}
|
||||
break;
|
||||
case 201: Xsave->S = StrToU8(TempArray);
|
||||
RRegs(Xsave);
|
||||
Disyou(tscroll);
|
||||
break;
|
||||
case 202: Xsave->P &= 0x30;
|
||||
Xsave->P |= StrToU8(TempArray) & ~0x30;
|
||||
RFlags(Xsave);
|
||||
Disyou(tscroll);
|
||||
break;
|
||||
case 210: Xsave->A = StrToU8(TempArray);
|
||||
RRegs(Xsave);
|
||||
Disyou(tscroll);
|
||||
break;
|
||||
case 211: Xsave->X = StrToU8(TempArray);
|
||||
RRegs(Xsave);
|
||||
Disyou(tscroll);
|
||||
break;
|
||||
case 212: Xsave->Y = StrToU8(TempArray);
|
||||
RRegs(Xsave);
|
||||
Disyou(tscroll);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BN_CLICKED:
|
||||
if (LOWORD(wParam) >= 400 && LOWORD(wParam) <= 407) {
|
||||
if (0 == instep) {
|
||||
Xsave->P ^= 1 << (LOWORD(wParam) & 7);
|
||||
RFlags(Xsave);
|
||||
}
|
||||
} else switch (LOWORD(wParam)) {
|
||||
case 300:
|
||||
instep = 1;
|
||||
crs(hwndDlg);
|
||||
if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1);
|
||||
break;
|
||||
case 301:
|
||||
instep = -1;
|
||||
crs(hwndDlg);
|
||||
break;
|
||||
case 302: FCEUI_NMI(); break;
|
||||
case 303: FCEUI_IRQ(); break;
|
||||
case 310: FCEUI_ResetNES();
|
||||
if (instep >= 0)
|
||||
instep = 1;
|
||||
crs(hwndDlg);
|
||||
break;
|
||||
case 311: DoMemmo(hwndDlg); break;
|
||||
|
||||
case 540:
|
||||
{
|
||||
LONG t;
|
||||
t = SendDlgItemMessage(hwndDlg, 510, LB_GETCURSEL, 0, 0);
|
||||
if (t != LB_ERR) {
|
||||
FCEUI_DeleteBreakPoint(t);
|
||||
SendDlgItemMessage(hWndCallB, 510, LB_DELETESTRING, t, (LPARAM)(LPSTR)0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 541:
|
||||
{
|
||||
uint16 A1, A2;
|
||||
int type;
|
||||
FetchBPDef(hwndDlg, &A1, &A2, &type);
|
||||
FCEUI_AddBreakPoint(type, A1, A2, BPointHandler);
|
||||
hWndCallB = hwndDlg; /* Hacky hacky. */
|
||||
RBPCallBack(type, A1, A2, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!(wParam >> 16))
|
||||
switch (wParam & 0xFFFF) {
|
||||
case 1:
|
||||
gornk:
|
||||
instep = -1;
|
||||
FCEUI_SetCPUCallback(0);
|
||||
DestroyWindow(dwin);
|
||||
dwin = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BeginDSeq(HWND hParent) {
|
||||
if (dwin) {
|
||||
SetFocus(dwin);
|
||||
return;
|
||||
}
|
||||
if (!GI) {
|
||||
FCEUD_PrintError("You must have a game loaded before you can screw up a game.");
|
||||
return;
|
||||
}
|
||||
|
||||
dwin = CreateDialog(fceu_hInstance, "DEBUGGER", 0, DebugCon);
|
||||
}
|
||||
|
||||
/* 16 numbers per line times 3 then minus one(no space at end) and plus
|
||||
6 for "8000: "-like string and plus 2 for crlf. *16 for 16 lines, and
|
||||
+1 for a null.
|
||||
*/
|
||||
static uint8 kbuf[(16 * 3 - 1 + 6 + 2) * 16 + 1];
|
||||
static void sexycallb(uint16 a, uint8 v) {
|
||||
if ((a & 15) == 15)
|
||||
sprintf(kbuf + strlen(kbuf), "%02X\r\n", v);
|
||||
else if ((a & 15) == 0)
|
||||
sprintf(kbuf + strlen(kbuf), "%03xx: %02X ", a >> 4, v);
|
||||
else
|
||||
sprintf(kbuf + strlen(kbuf), "%02X ", v);
|
||||
}
|
||||
|
||||
static void MDSSI(void) {
|
||||
SCROLLINFO si;
|
||||
|
||||
memset(&si, 0, sizeof(si));
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_ALL;
|
||||
si.nMin = 0;
|
||||
si.nMax = 0xFFFF >> 4;
|
||||
si.nPage = 16;
|
||||
cmsi = si.nPos = 0;
|
||||
SetScrollInfo(GetDlgItem(mwin, 103), SB_CTL, &si, 1);
|
||||
}
|
||||
|
||||
static void UpdateDMem(uint16 a) {
|
||||
kbuf[0] = 0;
|
||||
FCEUI_MemDump(a << 4, 256, sexycallb);
|
||||
SetDlgItemText(mwin, 100, kbuf);
|
||||
}
|
||||
|
||||
int CreateDumpSaveVid(uint32 a1, uint32 a2) {
|
||||
const char filter[] = "Raw dump(*.chr)\0*.chr\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Dump Video Memory As...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetSaveFileName(&ofn)) {
|
||||
FCEUI_DumpVid(nameo, a1, a2);
|
||||
return(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreateDumpSave(uint32 a1, uint32 a2) {
|
||||
const char filter[] = "Raw dump(*.dmp)\0*.dmp\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Dump Memory As...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetSaveFileName(&ofn)) {
|
||||
FCEUI_DumpMem(nameo, a1, a2);
|
||||
return(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LoadSave(uint32 a) {
|
||||
const char filter[] = "Raw dump(*.dmp)\0*.dmp\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Load Memory...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetOpenFileName(&ofn)) {
|
||||
FCEUI_LoadMem(nameo, a, 0); /* LL Load */
|
||||
return(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK MemCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
int32 scrollindex = 0, ced = 0;
|
||||
char TempArray[64];
|
||||
|
||||
DSMFix(uMsg);
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT: goto gornk;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (HIWORD(wParam)) {
|
||||
case BN_CLICKED:
|
||||
switch (LOWORD(wParam)) {
|
||||
case 203:
|
||||
case 202:
|
||||
{
|
||||
uint16 a;
|
||||
uint8 v;
|
||||
GetDlgItemText(hwndDlg, 200, TempArray, 64);
|
||||
a = StrToU16(TempArray);
|
||||
GetDlgItemText(hwndDlg, 201, TempArray, 64);
|
||||
v = StrToU8(TempArray);
|
||||
FCEUI_MemPoke(a, v, LOWORD(wParam) & 1);
|
||||
UpdateDMem(cmsi);
|
||||
|
||||
if (dwin && 0 == instep) {
|
||||
int tscroll = 32768 + SendDlgItemMessage(dwin, 101, SBM_GETPOS, 0, 0);
|
||||
Disyou(tscroll);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 212:
|
||||
{
|
||||
uint16 a1;
|
||||
uint16 a2;
|
||||
GetDlgItemText(hwndDlg, 210, TempArray, 64);
|
||||
a1 = StrToU16(TempArray);
|
||||
GetDlgItemText(hwndDlg, 211, TempArray, 64);
|
||||
a2 = StrToU16(TempArray);
|
||||
CreateDumpSave(a1, a2);
|
||||
}
|
||||
break;
|
||||
case 232:
|
||||
{
|
||||
uint16 a1;
|
||||
uint16 a2;
|
||||
GetDlgItemText(hwndDlg, 230, TempArray, 64);
|
||||
a1 = StrToU16(TempArray);
|
||||
GetDlgItemText(hwndDlg, 231, TempArray, 64);
|
||||
a2 = StrToU16(TempArray);
|
||||
CreateDumpSaveVid(a1, a2);
|
||||
}
|
||||
break;
|
||||
case 222:
|
||||
{
|
||||
uint16 a;
|
||||
GetDlgItemText(hwndDlg, 220, TempArray, 64);
|
||||
a = StrToU16(TempArray);
|
||||
LoadSave(a);
|
||||
UpdateDMem(cmsi);
|
||||
if (dwin && 0 == instep) {
|
||||
int tscroll = 32768 + SendDlgItemMessage(dwin, 101, SBM_GETPOS, 0, 0);
|
||||
Disyou(tscroll);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(wParam >> 16))
|
||||
switch (wParam & 0xFFFF) {
|
||||
case 1:
|
||||
gornk:
|
||||
DestroyWindow(mwin);
|
||||
mwin = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_INITDIALOG:
|
||||
return(1);
|
||||
case WM_VSCROLL:
|
||||
switch ((int)LOWORD(wParam)) {
|
||||
case SB_TOP:
|
||||
scrollindex = 0;
|
||||
ced = 1;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
scrollindex = 0xffff >> 4;
|
||||
ced = 1;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 103), SB_CTL);
|
||||
if (scrollindex > 0) {
|
||||
scrollindex--;
|
||||
ced = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 103), SB_CTL);
|
||||
scrollindex -= 16;
|
||||
if (scrollindex < 0)
|
||||
scrollindex = 0;
|
||||
ced = 1;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 103), SB_CTL);
|
||||
if (scrollindex < (0xFFFF >> 4)) {
|
||||
scrollindex++;
|
||||
ced = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
scrollindex = GetScrollPos(GetDlgItem(hwndDlg, 103), SB_CTL);
|
||||
scrollindex += 16;
|
||||
if (scrollindex > (0xFFFF >> 4)) {
|
||||
scrollindex = (65535 >> 4);
|
||||
}
|
||||
ced = 1;
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
scrollindex = HIWORD(wParam);
|
||||
ced = 1;
|
||||
break;
|
||||
}
|
||||
if (ced) {
|
||||
SendDlgItemMessage(hwndDlg, 103, SBM_SETPOS, scrollindex, 1);
|
||||
UpdateDMem(scrollindex);
|
||||
cmsi = scrollindex;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void DoMemmo(HWND hParent) {
|
||||
if (mwin) {
|
||||
SetFocus(mwin);
|
||||
return;
|
||||
}
|
||||
mwin = CreateDialog(fceu_hInstance, "MEMVIEW", 0, MemCon);
|
||||
MDSSI();
|
||||
UpdateDMem(0);
|
||||
}
|
||||
|
||||
void UpdateDebugger(void) {
|
||||
if (mwin)
|
||||
UpdateDMem(cmsi);
|
||||
}
|
||||
|
||||
void KillDebugger(void) {
|
||||
if (mwin)
|
||||
DestroyWindow(mwin);
|
||||
if (dwin) {
|
||||
instep = -1;
|
||||
FCEUI_SetCPUCallback(0);
|
||||
DestroyWindow(dwin);
|
||||
}
|
||||
dwin = mwin = 0;
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +0,0 @@
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
void KillDebugger(void);
|
||||
void UpdateDebugger(void);
|
||||
void BeginDSeq(HWND hParent);
|
||||
#endif
|
||||
@@ -1,303 +0,0 @@
|
||||
#include "ffb.h"
|
||||
#include <dinput.h>
|
||||
|
||||
#define MAX_JOYSTICKS 32
|
||||
#define kDI_MaxEffects 30 // Hard coded limit (not a DX limit)
|
||||
|
||||
extern LPDIRECTINPUTDEVICE7 Joysticks[MAX_JOYSTICKS];
|
||||
|
||||
// Force Feedback Effect Data
|
||||
// --------------------------
|
||||
REFGUID effectGUID[kMaxEffectSubTypes] =
|
||||
{
|
||||
&GUID_ConstantForce,
|
||||
&GUID_RampForce,
|
||||
&GUID_CustomForce,
|
||||
// period
|
||||
&GUID_Square,
|
||||
&GUID_Sine,
|
||||
&GUID_Triangle,
|
||||
&GUID_SawtoothUp,
|
||||
&GUID_SawtoothDown,
|
||||
// condition
|
||||
&GUID_Spring,
|
||||
&GUID_Damper,
|
||||
&GUID_Inertia,
|
||||
&GUID_Friction
|
||||
};
|
||||
|
||||
typedef union {
|
||||
DICONSTANTFORCE constant;
|
||||
DIRAMPFORCE ramp;
|
||||
DIPERIODIC period;
|
||||
DICONDITION condition;
|
||||
DICUSTOMFORCE custom;
|
||||
} tEffectClasses;
|
||||
|
||||
typedef struct tEffect {
|
||||
DIEFFECT general;
|
||||
tEffectClasses specific;
|
||||
DIENVELOPE envelope;
|
||||
LONG direction[2];
|
||||
} tEffect;
|
||||
|
||||
static tEffect Effect[kDI_MaxEffects];
|
||||
|
||||
// DInput Data
|
||||
// -----------
|
||||
static LPDIRECTINPUTEFFECT DIE_hEffect[kDI_MaxEffects];
|
||||
static int numEffects = 0;
|
||||
|
||||
// ---------
|
||||
// ffb_Pause
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Pause the FFB output on the given device. Use ffb_Continue to
|
||||
// continue where you left off.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_Pause(short dev) {
|
||||
IDirectInputDevice7_SendForceFeedbackCommand(Joysticks[dev], DISFFC_PAUSE);
|
||||
}
|
||||
|
||||
// ------------
|
||||
// ffb_Continue
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Unpause the FFB output on the given device. Complimentary to
|
||||
// ffb_Pause.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_Continue(short dev) {
|
||||
IDirectInputDevice7_SendForceFeedbackCommand(Joysticks[dev], DISFFC_CONTINUE);
|
||||
}
|
||||
|
||||
// ----------
|
||||
// ffb_Enable
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Must be called after initialization in order to activate the
|
||||
// device.
|
||||
// Use ffb_Pause & ffb_Continue if you want disable forces
|
||||
// temporarily and resume later.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_Enable(short dev) {
|
||||
IDirectInputDevice7_SendForceFeedbackCommand(Joysticks[dev], DISFFC_SETACTUATORSON);
|
||||
}
|
||||
|
||||
// -----------
|
||||
// ffb_Disable
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Turns off FFB, but effects still play on processor.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_Disable(short dev) {
|
||||
IDirectInputDevice7_SendForceFeedbackCommand(Joysticks[dev], DISFFC_SETACTUATORSOFF);
|
||||
}
|
||||
|
||||
void
|
||||
ffb_simpleJolt(short dev) {
|
||||
tFFB_Effect effect;
|
||||
short eID;
|
||||
// Constant Effect (simple jolt)
|
||||
// -----------------------------
|
||||
effect.Type = kConstant;
|
||||
effect.TypeInfo.Constant.Mag = 10000;
|
||||
effect.Duration = 1000000 >> 1; // half second
|
||||
effect.Period = 1000;
|
||||
effect.Gain = 10000;
|
||||
effect.Trigger = kNoButton;
|
||||
effect.TriggerRepeatTime = 0;
|
||||
effect.Direction = 0;
|
||||
|
||||
eID = ffb_effectCreate(dev, &effect);
|
||||
}
|
||||
|
||||
// ----------------
|
||||
// ffb_effectCreate
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Create a single effect for future playback.
|
||||
// Effect is given a logical ID
|
||||
// -------------------------------------------------------------------
|
||||
int
|
||||
ffb_effectCreate(short dev, tFFB_Effect* eff) {
|
||||
HRESULT hr;
|
||||
|
||||
// Important stuff
|
||||
Effect[numEffects].general.dwDuration = eff->Duration;
|
||||
Effect[numEffects].general.dwSamplePeriod = eff->Period;
|
||||
Effect[numEffects].general.dwGain = eff->Gain;
|
||||
Effect[numEffects].general.dwTriggerButton = (eff->Trigger == kNoButton ? DIEB_NOTRIGGER : DIJOFS_BUTTON(eff->Trigger));
|
||||
Effect[numEffects].general.dwTriggerRepeatInterval = eff->TriggerRepeatTime;
|
||||
Effect[numEffects].direction[0] = eff->Direction;
|
||||
memcpy(&Effect[numEffects].specific, &eff->TypeInfo, sizeof(tEffectClasses));
|
||||
|
||||
// Wacky COM related overhead
|
||||
Effect[numEffects].general.dwSize = sizeof(DIEFFECT);
|
||||
Effect[numEffects].general.cAxes = 2;
|
||||
Effect[numEffects].general.rgdwAxes = 0;
|
||||
Effect[numEffects].general.dwFlags = DIEFF_POLAR | DIEFF_OBJECTOFFSETS;
|
||||
Effect[numEffects].general.lpvTypeSpecificParams = &Effect[numEffects].specific;
|
||||
Effect[numEffects].general.rglDirection = &Effect[numEffects].direction;
|
||||
Effect[numEffects].direction[1] = 0L;
|
||||
Effect[numEffects].general.lpEnvelope = NULL;
|
||||
Effect[numEffects].general.lpvTypeSpecificParams = &Effect[numEffects].specific;
|
||||
|
||||
|
||||
switch (eff->Type) {
|
||||
case kConstant:
|
||||
Effect[numEffects].general.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
||||
break;
|
||||
case kRamp:
|
||||
Effect[numEffects].general.cbTypeSpecificParams = sizeof(DIRAMPFORCE);
|
||||
break;
|
||||
case kCustom:
|
||||
Effect[numEffects].general.cbTypeSpecificParams = sizeof(DICUSTOMFORCE);
|
||||
break;
|
||||
case kWave_Square:
|
||||
case kWave_Sine:
|
||||
case kWave_Triange:
|
||||
case kWave_SawUp:
|
||||
case kWave_SawDown:
|
||||
Effect[numEffects].general.cbTypeSpecificParams = sizeof(DIPERIODIC);
|
||||
break;
|
||||
case kCondition_Spring:
|
||||
case kCondition_Damper:
|
||||
case kCondition_Inertia:
|
||||
case kCondition_Friction:
|
||||
Effect[numEffects].general.cbTypeSpecificParams = sizeof(DICONDITION);
|
||||
break;
|
||||
default:
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
hr = IDirectInputDevice7_CreateEffect(Joysticks[dev],
|
||||
effectGUID[eff->Type],
|
||||
(LPCDIEFFECT)&Effect[numEffects],
|
||||
(LPDIRECTINPUTEFFECT*)&DIE_hEffect[numEffects], 0);
|
||||
switch (hr) {
|
||||
case DI_OK:
|
||||
ffb_effectUnload(numEffects);
|
||||
++numEffects;
|
||||
return(numEffects - 1);
|
||||
|
||||
case DIERR_DEVICENOTREG:
|
||||
return(-1);
|
||||
|
||||
case DIERR_DEVICEFULL:
|
||||
return(-1);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// --------------
|
||||
// ffb_effectPlay
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Play an effect that was previously created.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_effectPlay(short eID) {
|
||||
IDirectInputEffect_Start(DIE_hEffect[eID], 1, 0);
|
||||
}
|
||||
|
||||
// --------------
|
||||
// ffb_effectStop
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Stop a single effect.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_effectStop(short eID) {
|
||||
IDirectInputEffect_Stop(DIE_hEffect[eID]);
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// ffb_effectStopAll
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Stops all forces on the given device.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_effectStopAll(short dev) {
|
||||
IDirectInputDevice7_SendForceFeedbackCommand(Joysticks[dev], DISFFC_STOPALL);
|
||||
}
|
||||
|
||||
// ----------------
|
||||
// ffb_effectUnload
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Unload a single effect... Necessary to make room for other
|
||||
// effects.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_effectUnload(short eID) {
|
||||
IDirectInputEffect_Unload(DIE_hEffect[eID]);
|
||||
}
|
||||
|
||||
|
||||
// ----------------
|
||||
// ffb_effectModify
|
||||
// -------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Modifies a single effect, only if the given parameters are
|
||||
// different from what's currently loaded.
|
||||
// -------------------------------------------------------------------
|
||||
void
|
||||
ffb_effectModify(short eID, int* Direction, int* Duration, int* Gain,
|
||||
int* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope) {
|
||||
int flags = 0;
|
||||
|
||||
return;
|
||||
if (Direction) {
|
||||
if (Effect[eID].direction[0] != *Direction) {
|
||||
Effect[eID].direction[0] = *Direction;
|
||||
flags |= DIEP_DIRECTION;
|
||||
}
|
||||
}
|
||||
if (Duration) {
|
||||
if (Effect[eID].general.dwDuration != *Duration) {
|
||||
Effect[eID].general.dwDuration = *Duration;
|
||||
flags |= DIEP_DURATION;
|
||||
}
|
||||
}
|
||||
if (Gain) {
|
||||
if (Effect[eID].general.dwGain != *Gain) {
|
||||
Effect[eID].general.dwGain = *Gain;
|
||||
flags |= DIEP_GAIN;
|
||||
}
|
||||
}
|
||||
if (Period) {
|
||||
if (Effect[eID].general.dwSamplePeriod != *Period) {
|
||||
Effect[eID].general.dwSamplePeriod = *Period;
|
||||
flags |= DIEP_SAMPLEPERIOD;
|
||||
}
|
||||
}
|
||||
if (TypeInfo) {
|
||||
if (!memcmp(&Effect[eID].specific, TypeInfo, Effect[eID].general.cbTypeSpecificParams)) {
|
||||
memcpy(&Effect[eID].specific, TypeInfo, Effect[eID].general.cbTypeSpecificParams);
|
||||
flags |= DIEP_TYPESPECIFICPARAMS;
|
||||
}
|
||||
}
|
||||
if (Envelope) {
|
||||
if (Effect[eID].envelope.dwAttackLevel != Envelope->AttackLevel ||
|
||||
Effect[eID].envelope.dwAttackTime != Envelope->AttackTime ||
|
||||
Effect[eID].envelope.dwFadeLevel != Envelope->FadeLevel ||
|
||||
Effect[eID].envelope.dwFadeTime != Envelope->FadeTime) {
|
||||
Effect[eID].envelope.dwAttackLevel = Envelope->AttackLevel;
|
||||
Effect[eID].envelope.dwAttackTime = Envelope->AttackTime;
|
||||
Effect[eID].envelope.dwFadeLevel = Envelope->FadeLevel;
|
||||
Effect[eID].envelope.dwFadeTime = Envelope->FadeTime;
|
||||
flags |= DIEP_ENVELOPE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flags)
|
||||
return;
|
||||
|
||||
IDirectInputEffect_SetParameters(DIE_hEffect[eID], (LPCDIEFFECT)&Effect[eID], flags);
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
#ifndef _DXINPUT_H_
|
||||
#define _DXINPUT_H_
|
||||
|
||||
#define kMAX_Str 80
|
||||
#define kMAX_Axis 8
|
||||
#define kMAX_Sliders 2
|
||||
#define kMAX_POVs 4
|
||||
|
||||
#define kInfinite_Duration 0xFFFFFF
|
||||
#define HZ_to_uS(hz) ((int)(1000000.0 / (double)(hz) + 0.5))
|
||||
|
||||
typedef signed char tSC;
|
||||
typedef signed int tSI;
|
||||
typedef signed long tSL;
|
||||
|
||||
typedef unsigned char tUC;
|
||||
typedef unsigned int tUI;
|
||||
typedef unsigned long tUL;
|
||||
|
||||
typedef enum {
|
||||
kJoy1 = 0,
|
||||
kJoy2,
|
||||
kJoy3,
|
||||
kJoy4,
|
||||
kJoy5,
|
||||
kJoy6,
|
||||
kJoy7,
|
||||
kJoy8,
|
||||
kJoy9,
|
||||
kJoy10,
|
||||
kJoy11,
|
||||
kJoy12,
|
||||
kJoy13,
|
||||
kJoy14,
|
||||
kJoy15,
|
||||
kJoy16,
|
||||
kMaxJoy,
|
||||
kMouse,
|
||||
kKeyBoard,
|
||||
kAllDevices
|
||||
} tDevice;
|
||||
|
||||
typedef enum {
|
||||
kNoButton = -1,
|
||||
kButton0 = 0,
|
||||
kButton1,
|
||||
kButton2,
|
||||
kButton3,
|
||||
kButton4,
|
||||
kButton5,
|
||||
kButton6,
|
||||
kButton7,
|
||||
kButton8,
|
||||
kButton9,
|
||||
kButton10,
|
||||
kButton31 = 31,
|
||||
kButtonMax
|
||||
} tJoyButtons;
|
||||
|
||||
typedef enum {
|
||||
kStick = 1 << 0,
|
||||
kWheel = 1 << 1,
|
||||
kGamePad = 1 << 2,
|
||||
} tDeviceMask;
|
||||
|
||||
typedef struct {
|
||||
int ButtonMask;
|
||||
int AxisMask;
|
||||
tDeviceMask DevType;
|
||||
char Name[kMAX_Str];
|
||||
} tJoyInfo;
|
||||
|
||||
typedef struct {
|
||||
int ButtonMask;
|
||||
tSL X_pos;
|
||||
tSL Y_pos;
|
||||
tSL Z_pos;
|
||||
|
||||
tSL X_rot;
|
||||
tSL Y_rot;
|
||||
tSL Z_rot;
|
||||
|
||||
tSL Slide_pos[kMAX_Sliders];
|
||||
tUL POV_dir[kMAX_POVs];
|
||||
} tJoyData;
|
||||
|
||||
typedef enum {
|
||||
kDontPlayNow = 0,
|
||||
kPlayNow,
|
||||
kPlayNowIfModified,
|
||||
} tLoadEffect;
|
||||
|
||||
typedef enum {
|
||||
kConstant,
|
||||
kRamp,
|
||||
kCustom,
|
||||
|
||||
kWave_Square,
|
||||
kWave_Sine,
|
||||
kWave_Triange,
|
||||
kWave_SawUp,
|
||||
kWave_SawDown,
|
||||
|
||||
kCondition_Spring,
|
||||
kCondition_Damper,
|
||||
kCondition_Inertia,
|
||||
kCondition_Friction,
|
||||
|
||||
kMaxEffectSubTypes
|
||||
} tEffType;
|
||||
|
||||
typedef struct tEffConstant {
|
||||
long Mag;
|
||||
} tEffConstant;
|
||||
|
||||
typedef struct tEffRamp {
|
||||
long Start;
|
||||
long End;
|
||||
} tEffRamp;
|
||||
|
||||
typedef struct tEffWave {
|
||||
int Mag;
|
||||
long Offset;
|
||||
int Phase;
|
||||
int Period;
|
||||
} tEffWave;
|
||||
|
||||
typedef struct tEffCondition {
|
||||
long Offset;
|
||||
long PositiveCoefficient;
|
||||
long NegativeCoefficient;
|
||||
int PositiveSaturation;
|
||||
int NegativeSaturation;
|
||||
long DeadBand;
|
||||
} tEffCondition;
|
||||
|
||||
typedef struct tEffCustom {
|
||||
int Channels;
|
||||
int Period;
|
||||
int Samples;
|
||||
long *ForceData;
|
||||
} tEffCustom;
|
||||
|
||||
typedef union tEffectInfo {
|
||||
tEffConstant Constant;
|
||||
tEffRamp Ramp;
|
||||
tEffWave Wave;
|
||||
tEffCondition Condition;
|
||||
tEffCustom Custom;
|
||||
} tEffInfo;
|
||||
|
||||
typedef struct tEffectEnvelope {
|
||||
int AttackLevel;
|
||||
int AttackTime;
|
||||
int FadeLevel;
|
||||
int FadeTime;
|
||||
} tEffEnvelope;
|
||||
|
||||
typedef struct tFFB_Effect {
|
||||
tEffType Type;
|
||||
tEffInfo TypeInfo;
|
||||
int Duration;
|
||||
int Period;
|
||||
int Gain;
|
||||
tJoyButtons Trigger;
|
||||
int TriggerRepeatTime;
|
||||
long Direction;
|
||||
tEffEnvelope Envelope;
|
||||
} tFFB_Effect;
|
||||
|
||||
|
||||
// ===================================================================
|
||||
// Function Prototypes
|
||||
// ===================================================================
|
||||
// Init
|
||||
// ----
|
||||
int ffb_Init(void);
|
||||
|
||||
// Use
|
||||
// ---
|
||||
|
||||
void ffb_Pause(short dev);
|
||||
void ffb_Continue(short dev);
|
||||
|
||||
void ffb_Enable(short dev);
|
||||
void ffb_Disable(short dev);
|
||||
|
||||
int ffb_effectCreate(short dev, tFFB_Effect* eff);
|
||||
void ffb_effectPlay(short effectID);
|
||||
void ffb_effectStop(short effectID);
|
||||
void ffb_effectStopAll(short dev);
|
||||
void ffb_effectModify(short effectID, int* Direction, int* Duration, int* Gain,
|
||||
int* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope);
|
||||
|
||||
#endif // _DXINPUT_H_
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,46 +0,0 @@
|
||||
void ConfigInput(HWND hParent);
|
||||
int InitDInput(void);
|
||||
void CreateInputStuff(void);
|
||||
void InitInputStuff(void);
|
||||
void DestroyInput(void);
|
||||
void InputScreenChanged(int fs);
|
||||
|
||||
extern LPDIRECTINPUT7 lpDI;
|
||||
|
||||
extern int InputType[3];
|
||||
extern int UsrInputType[3];
|
||||
extern int cidisabled;
|
||||
#ifndef _aosdfjk02fmasf
|
||||
#define _aosdfjk02fmasf
|
||||
|
||||
#include "../common/args.h"
|
||||
#include "../common/config.h"
|
||||
|
||||
#define MAXBUTTCONFIG 4
|
||||
typedef struct {
|
||||
uint8 ButtType[MAXBUTTCONFIG];
|
||||
uint8 DeviceNum[MAXBUTTCONFIG];
|
||||
uint16 ButtonNum[MAXBUTTCONFIG];
|
||||
uint32 NumC;
|
||||
GUID DeviceInstance[MAXBUTTCONFIG];
|
||||
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
||||
} ButtConfig;
|
||||
|
||||
extern CFGSTRUCT InputConfig[];
|
||||
extern ARGPSTRUCT InputArgs[];
|
||||
void ParseGIInput(FCEUGI *GI);
|
||||
|
||||
#define BUTTC_KEYBOARD 0x00
|
||||
#define BUTTC_JOYSTICK 0x01
|
||||
#define BUTTC_MOUSE 0x02
|
||||
|
||||
#define FCFGD_GAMEPAD 1
|
||||
#define FCFGD_POWERPAD 2
|
||||
#define FCFGD_HYPERSHOT 3
|
||||
#define FCFGD_QUIZKING 4
|
||||
|
||||
void InitOtherInput(void);
|
||||
void FCEUD_UpdateInput(void);
|
||||
int DTestButton(ButtConfig *bc);
|
||||
#endif
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define MAX_JOYSTICKS 32
|
||||
|
||||
#include "common.h"
|
||||
#include <dinput.h>
|
||||
|
||||
#include "input.h"
|
||||
#include "joystick.h"
|
||||
|
||||
//static LPDIRECTINPUTDEVICE7 Joysticks[MAX_JOYSTICKS]={0};
|
||||
LPDIRECTINPUTDEVICE7 Joysticks[MAX_JOYSTICKS] = { 0 };
|
||||
static GUID JoyGUID[MAX_JOYSTICKS];
|
||||
|
||||
static int numjoysticks = 0;
|
||||
static int HavePolled[MAX_JOYSTICKS];
|
||||
|
||||
static DIJOYSTATE2 StatusSave[MAX_JOYSTICKS];
|
||||
|
||||
static int FindByGUID(GUID how) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < numjoysticks; x++)
|
||||
if (!memcmp(&JoyGUID[x], &how, sizeof(GUID)))
|
||||
return(x);
|
||||
|
||||
return(0xFF);
|
||||
}
|
||||
|
||||
#define FPOV_CENTER 16
|
||||
|
||||
static int POVFix(long pov, int roundpos) {
|
||||
long lowpov;
|
||||
|
||||
if (LOWORD(pov) == 65535)
|
||||
return(FPOV_CENTER);
|
||||
|
||||
if (roundpos == -1) { /* Special case for button configuration */
|
||||
pov /= 4500;
|
||||
pov = (pov >> 1) + (pov & 1);
|
||||
pov &= 3;
|
||||
return(pov);
|
||||
}
|
||||
|
||||
lowpov = pov % 9000;
|
||||
if (lowpov < (4500 - 4500 / 2)) {
|
||||
pov /= 9000;
|
||||
} else if (lowpov > (4500 + 4500 / 2)) {
|
||||
pov /= 9000;
|
||||
pov = (pov + 1) % 4;
|
||||
} else {
|
||||
if (!roundpos) pov /= 9000;
|
||||
else { pov /= 9000; pov = (pov + 1) % 4; }
|
||||
}
|
||||
return(pov);
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
LONG MinX;
|
||||
LONG MaxX;
|
||||
LONG MinY;
|
||||
LONG MaxY;
|
||||
LONG MinZ;
|
||||
LONG MaxZ;
|
||||
} POWER_RANGER;
|
||||
|
||||
static POWER_RANGER ranges[MAX_JOYSTICKS];
|
||||
|
||||
// r=diprg.lMax-diprg.lMin;
|
||||
// JoyXMax[w]=diprg.lMax-(r>>2);
|
||||
// JoyXMin[w]=diprg.lMin+(r>>2);
|
||||
|
||||
static int JoyAutoRestore(HRESULT dival, LPDIRECTINPUTDEVICE7 lpJJoy) {
|
||||
switch (dival) {
|
||||
case DIERR_INPUTLOST:
|
||||
case DIERR_NOTACQUIRED:
|
||||
return(IDirectInputDevice7_Acquire(lpJJoy) == DI_OK);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Called during normal emulator operation, not during button configuration. */
|
||||
/* Call before DTestButtonJoy */
|
||||
void UpdateJoysticks(void) {
|
||||
memset(HavePolled, 0, sizeof(HavePolled));
|
||||
}
|
||||
|
||||
int DTestButtonJoy(ButtConfig *bc) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < bc->NumC; x++) {
|
||||
HRESULT dival;
|
||||
int n = bc->DeviceNum[x];
|
||||
|
||||
if (n == 0xFF)
|
||||
continue;
|
||||
|
||||
if (bc->ButtType[x] != BUTTC_JOYSTICK) continue;
|
||||
if (n >= numjoysticks) continue;
|
||||
|
||||
if (!HavePolled[n]) {
|
||||
while ((dival = IDirectInputDevice7_Poll(Joysticks[n])) != DI_OK) {
|
||||
if (dival == DI_NOEFFECT) break;
|
||||
|
||||
if (!JoyAutoRestore(dival, Joysticks[n])) {
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
IDirectInputDevice7_GetDeviceState(Joysticks[n], sizeof(DIJOYSTATE2), &StatusSave[n]);
|
||||
HavePolled[n] = 1;
|
||||
}
|
||||
|
||||
if (bc->ButtonNum[x] & 0x8000) { /* Axis "button" */
|
||||
int sa = bc->ButtonNum[x] & 3;
|
||||
long source = 0;
|
||||
|
||||
if (sa == 0) source = ((int64)StatusSave[n].lX - ranges[n].MinX) * 262144 /
|
||||
(ranges[n].MaxX - ranges[n].MinX) - 131072;
|
||||
else if (sa == 1) source = ((int64)StatusSave[n].lY - ranges[n].MinY) * 262144 /
|
||||
(ranges[n].MaxY - ranges[n].MinY) - 131072;
|
||||
else if (sa == 2) source = ((int64)StatusSave[n].lZ - ranges[n].MinZ) * 262144 /
|
||||
(ranges[n].MaxZ - ranges[n].MinZ) - 131072;
|
||||
|
||||
/* Now, source is of the range -131072 to 131071. Good enough. */
|
||||
if (bc->ButtonNum[x] & 0x4000) {
|
||||
if (source <= (0 - 262144 / 4))
|
||||
return(1);
|
||||
} else {
|
||||
if (source >= (262144 / 4))
|
||||
return(1);
|
||||
}
|
||||
} else if (bc->ButtonNum[x] & 0x2000) { /* Hat "button" */
|
||||
int wpov = StatusSave[n].rgdwPOV[(bc->ButtonNum[x] >> 4) & 3];
|
||||
int tpov = bc->ButtonNum[x] & 3;
|
||||
|
||||
if (POVFix(wpov, 0) == tpov || POVFix(wpov, 1) == tpov)
|
||||
return(1);
|
||||
} else { /* Normal button */
|
||||
if (StatusSave[n].rgbButtons[bc->ButtonNum[x] & 127] & 0x80)
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int canax[MAX_JOYSTICKS][3];
|
||||
|
||||
/* Now the fun configuration test begins. */
|
||||
void BeginJoyWait(HWND hwnd) {
|
||||
int n;
|
||||
|
||||
//StatusSave = malloc(sizeof(DIJOYSTATE2) * numjoysticks);
|
||||
memset(canax, 0, sizeof(canax));
|
||||
|
||||
for (n = 0; n < numjoysticks; n++) {
|
||||
IDirectInputDevice7_Unacquire(Joysticks[n]);
|
||||
IDirectInputDevice7_SetCooperativeLevel(Joysticks[n], hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
|
||||
IDirectInputDevice7_Acquire(Joysticks[n]);
|
||||
IDirectInputDevice7_Poll(Joysticks[n]);
|
||||
IDirectInputDevice7_GetDeviceState(Joysticks[n], sizeof(DIJOYSTATE2), &StatusSave[n]);
|
||||
}
|
||||
}
|
||||
|
||||
int DoJoyWaitTest(GUID *guid, uint8 *devicenum, uint16 *buttonnum) {
|
||||
int n;
|
||||
int x;
|
||||
|
||||
for (n = 0; n < numjoysticks; n++) {
|
||||
HRESULT dival;
|
||||
DIJOYSTATE2 JoyStatus;
|
||||
int ba;
|
||||
|
||||
while ((dival = IDirectInputDevice7_Poll(Joysticks[n])) != DI_OK) {
|
||||
if (dival == DI_NOEFFECT) break;
|
||||
if (!JoyAutoRestore(dival, Joysticks[n])) return(0);
|
||||
}
|
||||
dival = IDirectInputDevice7_GetDeviceState(Joysticks[n], sizeof(DIJOYSTATE2), &JoyStatus);
|
||||
|
||||
for (ba = 0; ba < 128; ba++)
|
||||
if ((JoyStatus.rgbButtons[ba] & 0x80) && !(StatusSave[n].rgbButtons[ba] & 0x80)) {
|
||||
*devicenum = n;
|
||||
*buttonnum = ba;
|
||||
*guid = JoyGUID[n];
|
||||
//memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||
memcpy(StatusSave[n].rgbButtons, JoyStatus.rgbButtons, 128);
|
||||
return(1);
|
||||
}
|
||||
|
||||
memcpy(StatusSave[n].rgbButtons, JoyStatus.rgbButtons, 128);
|
||||
|
||||
// lX, lY, lZ
|
||||
long dax, day, daz;
|
||||
long source, psource;
|
||||
|
||||
dax = ranges[n].MaxX - ranges[n].MinX;
|
||||
day = ranges[n].MaxY - ranges[n].MinY;
|
||||
daz = ranges[n].MaxZ - ranges[n].MinZ;
|
||||
|
||||
if (dax) {
|
||||
source = ((int64)JoyStatus.lX - ranges[n].MinX) * 262144 / dax - 131072;
|
||||
psource = ((int64)StatusSave[n].lX - ranges[n].MinX) * 262144 / dax - 131072;
|
||||
|
||||
if (abs(source) >= 65536 && canax[n][0]) {
|
||||
*guid = JoyGUID[n];
|
||||
*devicenum = n;
|
||||
*buttonnum = 0x8000 | (0) | ((source < 0) ? 0x4000 : 0);
|
||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||
canax[n][0] = 0;
|
||||
return(1);
|
||||
} else if (abs(source) <= 32768) canax[n][0] = 1;
|
||||
}
|
||||
|
||||
if (day) {
|
||||
source = ((int64)JoyStatus.lY - ranges[n].MinY) * 262144 / day - 131072;
|
||||
psource = ((int64)StatusSave[n].lY - ranges[n].MinY) * 262144 / day - 131072;
|
||||
|
||||
if (abs(source) >= 65536 && canax[n][1]) {
|
||||
*guid = JoyGUID[n];
|
||||
*devicenum = n;
|
||||
*buttonnum = 0x8000 | (1) | ((source < 0) ? 0x4000 : 0);
|
||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||
canax[n][1] = 0;
|
||||
return(1);
|
||||
} else if (abs(source) <= 32768) canax[n][1] = 1;
|
||||
}
|
||||
|
||||
if (daz) {
|
||||
}
|
||||
|
||||
for (x = 0; x < 4; x++) {
|
||||
if (POVFix(JoyStatus.rgdwPOV[x], -1) != FPOV_CENTER && POVFix(StatusSave[n].rgdwPOV[x], -1) == FPOV_CENTER) {
|
||||
*guid = JoyGUID[n];
|
||||
*devicenum = n;
|
||||
*buttonnum = 0x2000 | (x << 4) | POVFix(JoyStatus.rgdwPOV[x], -1);
|
||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void EndJoyWait(HWND hwnd) {
|
||||
int n;
|
||||
|
||||
for (n = 0; n < numjoysticks; n++) {
|
||||
IDirectInputDevice7_Unacquire(Joysticks[n]);
|
||||
IDirectInputDevice7_SetCooperativeLevel(Joysticks[n], hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
int KillJoysticks(void) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < numjoysticks; x++) {
|
||||
IDirectInputDevice7_Unacquire(Joysticks[x]);
|
||||
IDirectInputDevice7_Release(Joysticks[x]);
|
||||
Joysticks[x] = NULL;
|
||||
}
|
||||
|
||||
numjoysticks = 0;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
void JoyClearBC(ButtConfig *bc) {
|
||||
int x;
|
||||
for (x = 0; x < bc->NumC; x++)
|
||||
if (bc->ButtType[x] == BUTTC_JOYSTICK)
|
||||
bc->DeviceNum[x] = FindByGUID(bc->DeviceInstance[x]);
|
||||
}
|
||||
|
||||
static int GetARange(LPDIRECTINPUTDEVICE7 dev, LONG which, LONG *min, LONG *max) {
|
||||
HRESULT dival;
|
||||
DIPROPRANGE diprg;
|
||||
// int r;
|
||||
|
||||
memset(&diprg, 0, sizeof(DIPROPRANGE));
|
||||
diprg.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
diprg.diph.dwHow = DIPH_BYOFFSET;
|
||||
diprg.diph.dwObj = which;
|
||||
dival = IDirectInputDevice7_GetProperty(dev, DIPROP_RANGE, &diprg.diph);
|
||||
if (dival != DI_OK) {
|
||||
*min = *max = 0;
|
||||
return(1);
|
||||
}
|
||||
*min = diprg.lMin;
|
||||
*max = diprg.lMax;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK JoystickFound(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) {
|
||||
// HRESULT dival;
|
||||
int n = numjoysticks;
|
||||
|
||||
if (DI_OK != IDirectInput7_CreateDeviceEx(lpDI, &lpddi->guidInstance, &IID_IDirectInputDevice7, (LPVOID*)&Joysticks[n], 0)) {
|
||||
FCEU_printf("Device creation of a joystick failed during init.\n");
|
||||
return(DIENUM_CONTINUE);
|
||||
}
|
||||
|
||||
if (DI_OK != IDirectInputDevice7_SetCooperativeLevel(Joysticks[n], *(HWND*)pvRef, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE)) {
|
||||
FCEU_printf("Cooperative level set of a joystick failed during init.\n");
|
||||
IDirectInputDevice7_Release(Joysticks[n]);
|
||||
return(DIENUM_CONTINUE);
|
||||
}
|
||||
|
||||
if (DI_OK != IDirectInputDevice7_SetDataFormat(Joysticks[n], &c_dfDIJoystick2)) {
|
||||
FCEU_printf("Data format set of a joystick failed during init.\n");
|
||||
IDirectInputDevice7_Release(Joysticks[n]);
|
||||
return(DIENUM_CONTINUE);
|
||||
}
|
||||
|
||||
GetARange(Joysticks[n], DIJOFS_X, &ranges[n].MinX, &ranges[n].MaxX);
|
||||
GetARange(Joysticks[n], DIJOFS_Y, &ranges[n].MinY, &ranges[n].MaxY);
|
||||
GetARange(Joysticks[n], DIJOFS_Z, &ranges[n].MinZ, &ranges[n].MaxZ);
|
||||
|
||||
JoyGUID[numjoysticks] = lpddi->guidInstance;
|
||||
|
||||
IDirectInputDevice7_Acquire(Joysticks[n]);
|
||||
|
||||
numjoysticks++;
|
||||
|
||||
if (numjoysticks > MAX_JOYSTICKS) return(0);
|
||||
|
||||
return(DIENUM_CONTINUE);
|
||||
}
|
||||
|
||||
int InitJoysticks(HWND hwnd) {
|
||||
IDirectInput7_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, JoystickFound, (LPVOID*)&hwnd, DIEDFL_ATTACHEDONLY);
|
||||
return(1);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
int InitJoysticks(HWND wnd);
|
||||
int KillJoysticks(void);
|
||||
|
||||
void BeginJoyWait(HWND hwnd);
|
||||
int DoJoyWaitTest(GUID *guid, uint8 *devicenum, uint16 *buttonnum);
|
||||
void EndJoyWait(HWND hwnd);
|
||||
|
||||
void JoyClearBC(ButtConfig *bc);
|
||||
|
||||
void UpdateJoysticks(void);
|
||||
int DTestButtonJoy(ButtConfig *bc);
|
||||
@@ -1,85 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <dinput.h>
|
||||
|
||||
#include "input.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
HRESULT ddrval;
|
||||
|
||||
static LPDIRECTINPUTDEVICE7 lpdid = 0;
|
||||
|
||||
void KeyboardClose(void) {
|
||||
if (lpdid) IDirectInputDevice7_Unacquire(lpdid);
|
||||
lpdid = 0;
|
||||
}
|
||||
|
||||
static char keys[256];
|
||||
void KeyboardUpdateState(void) {
|
||||
char tk[256];
|
||||
|
||||
ddrval = IDirectInputDevice7_GetDeviceState(lpdid, 256, tk);
|
||||
switch (ddrval) {
|
||||
case DI_OK: memcpy(keys, tk, 256); break;
|
||||
case DIERR_INPUTLOST:
|
||||
case DIERR_NOTACQUIRED:
|
||||
memset(keys, 0, 256);
|
||||
IDirectInputDevice7_Acquire(lpdid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char *GetKeyboard(void) {
|
||||
return(keys);
|
||||
}
|
||||
|
||||
int KeyboardInitialize(void) {
|
||||
if (lpdid)
|
||||
return(1);
|
||||
|
||||
ddrval = IDirectInput7_CreateDeviceEx(lpDI, &GUID_SysKeyboard, &IID_IDirectInputDevice7, (LPVOID*)&lpdid, 0);
|
||||
if (ddrval != DI_OK) {
|
||||
FCEUD_PrintError("DirectInput: Error creating keyboard device.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectInputDevice7_SetCooperativeLevel(lpdid, hAppWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
|
||||
if (ddrval != DI_OK) {
|
||||
FCEUD_PrintError("DirectInput: Error setting keyboard cooperative level.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectInputDevice7_SetDataFormat(lpdid, &c_dfDIKeyboard);
|
||||
if (ddrval != DI_OK) {
|
||||
FCEUD_PrintError("DirectInput: Error setting keyboard data format.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectInputDevice7_Acquire(lpdid);
|
||||
/* Not really a fatal error. */
|
||||
//if(ddrval != DI_OK)
|
||||
//{
|
||||
// FCEUD_PrintError("DirectInput: Error acquiring keyboard.");
|
||||
// return 0;
|
||||
//}
|
||||
return 1;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
void KeyboardUpdateState(void);
|
||||
void KeyboardClose(void);
|
||||
int KeyboardInitialize(void);
|
||||
void KeyboardUpdate(void);
|
||||
char *GetKeyboard(void);
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define SCAN_GRAVE 0x29
|
||||
#define SCAN_1 0x02
|
||||
#define SCAN_2 0x03
|
||||
#define SCAN_3 0x04
|
||||
#define SCAN_4 0x05
|
||||
#define SCAN_5 0x06
|
||||
#define SCAN_6 0x07
|
||||
#define SCAN_7 0x08
|
||||
#define SCAN_8 0x09
|
||||
#define SCAN_9 0x0A
|
||||
#define SCAN_0 0x0B
|
||||
#define SCAN_MINUS 0x0C
|
||||
#define SCAN_EQUAL 0x0D
|
||||
#define SCAN_BACKSLASH 0x2B
|
||||
#define SCAN_BACKSPACE 0x0E
|
||||
#define SCAN_TAB 0x0F
|
||||
#define SCAN_Q 0x10
|
||||
#define SCAN_W 0x11
|
||||
#define SCAN_E 0x12
|
||||
#define SCAN_R 0x13
|
||||
#define SCAN_T 0x14
|
||||
#define SCAN_Y 0x15
|
||||
#define SCAN_U 0x16
|
||||
#define SCAN_I 0x17
|
||||
#define SCAN_O 0x18
|
||||
#define SCAN_P 0x19
|
||||
#define SCAN_BRACKET_LEFT 0x1A
|
||||
#define SCAN_BRACKET_RIGHT 0x1B
|
||||
#define SCAN_LOWBACKSLASH 0x2B
|
||||
#define SCAN_CAPSLOCK 0x3A
|
||||
#define SCAN_A 0x1E
|
||||
#define SCAN_S 0x1F
|
||||
#define SCAN_D 0x20
|
||||
#define SCAN_F 0x21
|
||||
#define SCAN_G 0x22
|
||||
#define SCAN_H 0x23
|
||||
#define SCAN_J 0x24
|
||||
#define SCAN_K 0x25
|
||||
#define SCAN_L 0x26
|
||||
#define SCAN_SEMICOLON 0x27
|
||||
#define SCAN_APOSTROPHE 0x28
|
||||
#define SCAN_ENTER 0x1C
|
||||
#define SCAN_LEFTSHIFT 0x2A
|
||||
#define SCAN_Z 0x2C
|
||||
#define SCAN_X 0x2D
|
||||
#define SCAN_C 0x2E
|
||||
#define SCAN_V 0x2F
|
||||
#define SCAN_B 0x30
|
||||
#define SCAN_N 0x31
|
||||
#define SCAN_M 0x32
|
||||
#define SCAN_COMMA 0x33
|
||||
#define SCAN_PERIOD 0x34
|
||||
#define SCAN_SLASH 0x35
|
||||
#define SCAN_RIGHTSHIFT 0x36
|
||||
#define SCAN_LEFTCONTROL 0x1D
|
||||
#define SCAN_LEFTALT 0x38
|
||||
#define SCAN_SPACE 0x39
|
||||
|
||||
#define SCAN_RIGHTALT (0x38 | 0x80)
|
||||
#define SCAN_RIGHTCONTROL (0x1D | 0x80)
|
||||
#define SCAN_BL_INSERT (0x52 | 0x80)
|
||||
#define SCAN_BL_DELETE (0x53 | 0x80)
|
||||
#define SCAN_BL_CURSORLEFT (0x4B | 0x80)
|
||||
#define SCAN_BL_HOME (0x47 | 0x80)
|
||||
#define SCAN_BL_END (0x4F | 0x80)
|
||||
#define SCAN_BL_CURSORUP (0x48 | 0x80)
|
||||
#define SCAN_BL_CURSORDOWN (0x50 | 0x80)
|
||||
#define SCAN_BL_PAGEUP (0x49 | 0x80)
|
||||
#define SCAN_BL_PAGEDOWN (0x51 | 0x80)
|
||||
#define SCAN_BL_CURSORRIGHT (0x4D | 0x80)
|
||||
|
||||
#define SCAN_SCROLLLOCK 0x46
|
||||
/* Keys in the key pad area. */
|
||||
#define SCAN_NUMLOCK 0x45
|
||||
#define SCAN_HOME 0x47
|
||||
#define SCAN_CURSORLEFT 0x4B
|
||||
#define SCAN_END 0x4F
|
||||
#define SCAN_SLASH 0x35
|
||||
#define SCAN_CURSORUP 0x48
|
||||
#define SCAN_CENTER 0x4C
|
||||
#define SCAN_CURSORDOWN 0x50
|
||||
#define SCAN_INSERT 0x52
|
||||
#define SCAN_ASTERISK 0x37
|
||||
#define SCAN_PAGEUP 0x49
|
||||
#define SCAN_CURSORRIGHT 0x4D
|
||||
#define SCAN_PAGEDOWN 0x51
|
||||
#define SCAN_KP_DELETE 0x53
|
||||
#define SCAN_KP_MINUS 0x4A
|
||||
#define SCAN_KP_PLUS 0x4E
|
||||
#define SCAN_KP_ENTER 0x1C
|
||||
|
||||
#define SCAN_ESCAPE 0x01
|
||||
#define SCAN_F1 0x3B
|
||||
#define SCAN_F2 0x3C
|
||||
#define SCAN_F3 0x3D
|
||||
#define SCAN_F4 0x3E
|
||||
#define SCAN_F5 0x3F
|
||||
#define SCAN_F6 0x40
|
||||
#define SCAN_F7 0x41
|
||||
#define SCAN_F8 0x42
|
||||
#define SCAN_F9 0x43
|
||||
#define SCAN_F10 0x44
|
||||
#define SCAN_F11 0x57
|
||||
#define SCAN_F12 0x58
|
||||
|
||||
#define MKK(k) SCAN_ ## k
|
||||
#define MKK_COUNT (256)
|
||||
@@ -1,92 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
#define MAXLOGTEXT 1024
|
||||
|
||||
static HWND logwin = 0;
|
||||
|
||||
static char *logtext[MAXLOGTEXT];
|
||||
static int logcount = 0;
|
||||
|
||||
static void RedoText(void) {
|
||||
char textbuf[65535];
|
||||
int x;
|
||||
|
||||
textbuf[0] = 0;
|
||||
if (logcount >= MAXLOGTEXT) {
|
||||
x = logcount & (MAXLOGTEXT - 1);
|
||||
for (;; ) {
|
||||
strcat(textbuf, logtext[x]);
|
||||
x = (x + 1) & (MAXLOGTEXT - 1);
|
||||
if (x == (logcount & (MAXLOGTEXT - 1))) break;
|
||||
}
|
||||
} else
|
||||
for (x = 0; x < logcount; x++) {
|
||||
strcat(textbuf, logtext[x]);
|
||||
}
|
||||
SetDlgItemText(logwin, 100, textbuf);
|
||||
SendDlgItemMessage(logwin, 100, EM_LINESCROLL, 0, 1024 * 4);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
DSMFix(uMsg);
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: logwin = hwndDlg;
|
||||
RedoText(); break;
|
||||
case WM_COMMAND:
|
||||
if (HIWORD(wParam) == BN_CLICKED) {
|
||||
DestroyWindow(hwndDlg);
|
||||
logwin = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MakeLogWindow(void) {
|
||||
if (!logwin)
|
||||
CreateDialog(fceu_hInstance, "MESSAGELOG", 0, LogCon);
|
||||
}
|
||||
|
||||
void AddLogText(char *text, int newline) {
|
||||
int x;
|
||||
char *t;
|
||||
|
||||
if (logcount >= MAXLOGTEXT) free(logtext[logcount & (MAXLOGTEXT - 1)]);
|
||||
|
||||
x = 0;
|
||||
t = text;
|
||||
while (*t) {
|
||||
if (*t == '\n') x++;
|
||||
t++;
|
||||
}
|
||||
|
||||
if (!(logtext[logcount & (MAXLOGTEXT - 1)] = malloc(strlen(text) + 1 + x + newline * 2)))
|
||||
return;
|
||||
|
||||
t = logtext[logcount & (MAXLOGTEXT - 1)];
|
||||
|
||||
while (*text) {
|
||||
if (*text == '\n') {
|
||||
*t = '\r';
|
||||
t++;
|
||||
}
|
||||
*t = *text;
|
||||
t++;
|
||||
text++;
|
||||
}
|
||||
if (newline) {
|
||||
*t = '\r';
|
||||
t++;
|
||||
*t = '\n';
|
||||
t++;
|
||||
}
|
||||
*t = 0;
|
||||
logcount++;
|
||||
if (logwin)
|
||||
RedoText();
|
||||
}
|
||||
|
||||
void FCEUD_Message(char *text) {
|
||||
AddLogText(text, 0);
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
void MakeLogWindow(void);
|
||||
void AddLogText(char *text, int newline);
|
||||
@@ -1,459 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// I like hacks.
|
||||
#define uint8 __UNO492032
|
||||
#include <winsock.h>
|
||||
#include <ddraw.h>
|
||||
#undef LPCWAVEFORMATEX
|
||||
#include <dsound.h>
|
||||
#include <dinput.h>
|
||||
#include <dir.h>
|
||||
#include <commctrl.h>
|
||||
#include <shlobj.h> // For directories configuration dialog.
|
||||
#undef uint8
|
||||
|
||||
#include "input.h"
|
||||
#include "netplay.h"
|
||||
#include "joystick.h"
|
||||
#include "keyboard.h"
|
||||
#include "cheat.h"
|
||||
#include "debug.h"
|
||||
#include "../common/vidblit.h"
|
||||
#include "../../ppuview.h"
|
||||
|
||||
#define VNSCLIP ((eoptions & EO_CLIPSIDES) ? 8 : 0)
|
||||
#define VNSWID ((eoptions & EO_CLIPSIDES) ? 240 : 256)
|
||||
|
||||
uint8 *xbsave = NULL;
|
||||
int eoptions = EO_BGRUN | EO_FORCEISCALE;
|
||||
|
||||
void ResetVideo(void);
|
||||
void ShowCursorAbs(int w);
|
||||
void HideFWindow(int h);
|
||||
void FixWXY(int pref);
|
||||
int SetMainWindowStuff(void);
|
||||
int GetClientAbsRect(LPRECT lpRect);
|
||||
void UpdateFCEUWindow(void);
|
||||
void RedoMenuGI(FCEUGI *gi);
|
||||
|
||||
HWND hAppWnd = 0;
|
||||
HINSTANCE fceu_hInstance;
|
||||
|
||||
HRESULT ddrval;
|
||||
|
||||
FCEUGI *GI = 0;
|
||||
|
||||
// cheats, misc, nonvol, states, snaps, base
|
||||
static char *DOvers[6] = { 0, 0, 0, 0, 0, 0 };
|
||||
static char *defaultds[5] = { "cheats", "gameinfo", "sav", "fcs", "snaps" };
|
||||
|
||||
static char TempArray[2048];
|
||||
static char BaseDirectory[2048];
|
||||
|
||||
void SetDirs(void) {
|
||||
int x;
|
||||
static int jlist[5] =
|
||||
{ FCEUIOD_CHEATS, FCEUIOD_MISC, FCEUIOD_NV, FCEUIOD_STATE, FCEUIOD_SNAPS };
|
||||
|
||||
FCEUI_SetSnapName(eoptions & EO_SNAPNAME);
|
||||
|
||||
for (x = 0; x < 5; x++)
|
||||
FCEUI_SetDirOverride(jlist[x], DOvers[x]);
|
||||
if (DOvers[5])
|
||||
FCEUI_SetBaseDirectory(DOvers[5]);
|
||||
else
|
||||
FCEUI_SetBaseDirectory(BaseDirectory);
|
||||
}
|
||||
/* Remove empty, unused directories. */
|
||||
void RemoveDirs(void) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 5; x++)
|
||||
if (!DOvers[x]) {
|
||||
sprintf(TempArray, "%s\\%s", DOvers[5] ? DOvers[5] : BaseDirectory, defaultds[x]);
|
||||
RemoveDirectory(TempArray);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateDirs(void) {
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 5; x++)
|
||||
if (!DOvers[x]) {
|
||||
sprintf(TempArray, "%s\\%s", DOvers[5] ? DOvers[5] : BaseDirectory, defaultds[x]);
|
||||
CreateDirectory(TempArray, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static char *gfsdir = 0;
|
||||
void GetBaseDirectory(void) {
|
||||
int x;
|
||||
BaseDirectory[0] = 0;
|
||||
GetModuleFileName(0, (LPTSTR)BaseDirectory, 2047);
|
||||
|
||||
for (x = strlen(BaseDirectory); x >= 0; x--) {
|
||||
if (BaseDirectory[x] == '\\' || BaseDirectory[x] == '/') {
|
||||
BaseDirectory[x] = 0; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int exiting = 0;
|
||||
static volatile int moocow = 0;
|
||||
int BlockingCheck(void) {
|
||||
MSG msg;
|
||||
moocow = 1;
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
|
||||
if (GetMessage(&msg, 0, 0, 0) > 0) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
moocow = 0;
|
||||
if (exiting) return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Some timing-related variables. */
|
||||
static int maxconbskip = 9; /* Maximum consecutive blit skips. */
|
||||
static int ffbskip = 9; /* Blit skips per blit when FF-ing */
|
||||
|
||||
static int fullscreen = 0;
|
||||
//static int soundflush=0;
|
||||
static int genie = 0;
|
||||
static int palyo = 0;
|
||||
static int windowedfailed;
|
||||
static double saspectw = 1, saspecth = 1;
|
||||
static double winsizemulx = 1, winsizemuly = 1;
|
||||
static int winwidth, winheight;
|
||||
static int ismaximized = 0;
|
||||
|
||||
static volatile int nofocus = 0;
|
||||
static volatile int userpause = 0;
|
||||
|
||||
#define SO_FORCE8BIT 1
|
||||
#define SO_SECONDARY 2
|
||||
#define SO_GFOCUS 4
|
||||
#define SO_D16VOL 8
|
||||
|
||||
#define GOO_DISABLESS 1 /* Disable screen saver when game is loaded. */
|
||||
#define GOO_CONFIRMEXIT 2 /* Confirmation before exiting. */
|
||||
#define GOO_POWERRESET 4 /* Confirm on power/reset. */
|
||||
|
||||
static uint32 goptions = GOO_DISABLESS;
|
||||
|
||||
static int soundrate = 44100;
|
||||
static int soundbuftime = 50;
|
||||
static int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
||||
static int soundvolume = 100;
|
||||
static int soundquality = 0;
|
||||
|
||||
static unsigned int srendline, erendline;
|
||||
static unsigned int srendlinen = 8;
|
||||
static unsigned int erendlinen = 231;
|
||||
static unsigned int srendlinep = 0;
|
||||
static unsigned int erendlinep = 239;
|
||||
|
||||
|
||||
static unsigned int totallines;
|
||||
|
||||
static void FixFL(void) {
|
||||
FCEUI_GetCurrentVidSystem(&srendline, &erendline);
|
||||
totallines = erendline - srendline + 1;
|
||||
}
|
||||
|
||||
static void UpdateRendBounds(void) {
|
||||
FCEUI_SetRenderedLines(srendlinen, erendlinen, srendlinep, erendlinep);
|
||||
FixFL();
|
||||
}
|
||||
|
||||
static uint8 cpalette[192];
|
||||
static int vmod = 0;
|
||||
static int soundo = 1;
|
||||
static int ntsccol = 0, ntsctint, ntschue;
|
||||
|
||||
void FCEUD_PrintError(char *s) {
|
||||
AddLogText(s, 1);
|
||||
if (fullscreen) ShowCursorAbs(1);
|
||||
MessageBox(0, s, "FCE Ultra Error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
|
||||
if (fullscreen) ShowCursorAbs(0);
|
||||
}
|
||||
|
||||
void ShowAboutBox(void) {
|
||||
sprintf(TempArray, "FCE Ultra "FCEU_VERSION "\n\nhttp://fceultra.sourceforge.net\n\n"__TIME__ "\n"__DATE__ "\n" "gcc "__VERSION__);
|
||||
MessageBox(hAppWnd, TempArray, "About FCE Ultra", MB_OK);
|
||||
}
|
||||
|
||||
|
||||
void DoFCEUExit(void) {
|
||||
/* Wolfenstein 3D had cute exit messages. */
|
||||
char *emsg[4] = { "Are you sure you want to leave? I'll become lonely!",
|
||||
"If you exit, I'll... EAT YOUR MOUSE.",
|
||||
"You can never really exit, you know.",
|
||||
"E-x-i-t?" };
|
||||
|
||||
if (exiting) /* Eh, oops. I'll need to try to fix this later. */
|
||||
return;
|
||||
|
||||
StopSound();
|
||||
if (goptions & GOO_CONFIRMEXIT)
|
||||
if (IDYES != MessageBox(hAppWnd, emsg[rand() & 3], "Exit FCE Ultra?", MB_ICONQUESTION | MB_YESNO))
|
||||
return;
|
||||
|
||||
exiting = 1;
|
||||
if (GI) {
|
||||
GI = 0;
|
||||
RedoMenuGI(GI);
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
KillDebugger();
|
||||
#endif
|
||||
FCEUI_CloseGame();
|
||||
//GI=0;
|
||||
//RedoMenuGI(GI);
|
||||
}
|
||||
}
|
||||
|
||||
void DoPriority(void) {
|
||||
if (eoptions & EO_HIGHPRIO) {
|
||||
if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST)) {
|
||||
AddLogText("Error setting thread priority to THREAD_PRIORITY_HIGHEST.", 1);
|
||||
}
|
||||
} else
|
||||
if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL)) {
|
||||
AddLogText("Error setting thread priority to THREAD_PRIORITY_NORMAL.", 1);
|
||||
}
|
||||
}
|
||||
|
||||
static int changerecursive = 0;
|
||||
|
||||
#include "throttle.c"
|
||||
|
||||
#include "sound.c"
|
||||
#include "video.c"
|
||||
#include "window.c"
|
||||
#include "config.c"
|
||||
#include "args.c"
|
||||
|
||||
int DriverInitialize(void) {
|
||||
if (soundo)
|
||||
soundo = InitSound();
|
||||
|
||||
SetVideoMode(fullscreen);
|
||||
InitInputStuff(); /* Initialize DInput interfaces. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void DriverKill(void) {
|
||||
sprintf(TempArray, "%s/fceu98.cfg", BaseDirectory);
|
||||
SaveConfig(TempArray);
|
||||
DestroyInput();
|
||||
ResetVideo();
|
||||
if (soundo) TrashSound();
|
||||
CloseWave();
|
||||
ByebyeWindow();
|
||||
}
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *t;
|
||||
|
||||
if (timeBeginPeriod(1) != TIMERR_NOERROR) {
|
||||
AddLogText("Error setting timer granularity to 1ms.", 1);
|
||||
}
|
||||
|
||||
if (!FCEUI_Initialize())
|
||||
goto doexito;
|
||||
|
||||
srand(GetTickCount()); // rand() is used for some GUI sillyness.
|
||||
|
||||
fceu_hInstance = GetModuleHandle(0);
|
||||
|
||||
GetBaseDirectory();
|
||||
|
||||
sprintf(TempArray, "%s\\fceu98.cfg", BaseDirectory);
|
||||
LoadConfig(TempArray);
|
||||
|
||||
t = ParseArgies(argc, argv);
|
||||
/* Bleh, need to find a better place for this. */
|
||||
{
|
||||
palyo &= 1;
|
||||
FCEUI_SetVidSystem(palyo);
|
||||
genie &= 1;
|
||||
FCEUI_SetGameGenie(genie);
|
||||
fullscreen &= 1;
|
||||
soundo &= 1;
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
FCEUI_SetSoundQuality(soundquality);
|
||||
}
|
||||
ParseGIInput(NULL); /* Since a game doesn't have to be
|
||||
loaded before the GUI can be used, make
|
||||
sure the temporary input type variables
|
||||
are set.
|
||||
*/
|
||||
|
||||
CreateDirs();
|
||||
SetDirs();
|
||||
|
||||
DoVideoConfigFix();
|
||||
DoTimingConfigFix();
|
||||
|
||||
if (eoptions & EO_CPALETTE)
|
||||
FCEUI_SetPaletteArray(cpalette);
|
||||
|
||||
if (!t) fullscreen = 0;
|
||||
|
||||
CreateMainWindow();
|
||||
|
||||
if (!InitDInput())
|
||||
goto doexito;
|
||||
|
||||
if (!DriverInitialize())
|
||||
goto doexito;
|
||||
|
||||
InitSpeedThrottle();
|
||||
UpdateMenu();
|
||||
|
||||
if (t)
|
||||
ALoad(t);
|
||||
else if (eoptions & EO_FOAFTERSTART)
|
||||
LoadNewGamey(hAppWnd, 0);
|
||||
|
||||
doloopy:
|
||||
UpdateFCEUWindow();
|
||||
if (GI) {
|
||||
while (GI) {
|
||||
uint8 *gfx;
|
||||
int32 *sound;
|
||||
int32 ssize;
|
||||
|
||||
FCEUI_Emulate(&gfx, &sound, &ssize, 0);
|
||||
xbsave = gfx;
|
||||
FCEUD_Update(gfx, sound, ssize);
|
||||
}
|
||||
xbsave = NULL;
|
||||
RedrawWindow(hAppWnd, 0, 0, RDW_ERASE | RDW_INVALIDATE);
|
||||
StopSound();
|
||||
}
|
||||
Sleep(50);
|
||||
if (!exiting)
|
||||
goto doloopy;
|
||||
|
||||
doexito:
|
||||
DriverKill();
|
||||
timeEndPeriod(1);
|
||||
FCEUI_Kill();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count) {
|
||||
static int skipcount = 0;
|
||||
int maxskip = maxconbskip;
|
||||
|
||||
if (NoWaiting & 1)
|
||||
maxskip = ffbskip;
|
||||
|
||||
if (Count) {
|
||||
int32 can = GetWriteSound();
|
||||
static int uflow = 0;
|
||||
int32 tmpcan;
|
||||
extern int FCEUDnetplay;
|
||||
|
||||
if (can >= GetMaxSound()) uflow = 1; /* Go into massive underflow mode. */
|
||||
|
||||
if (can > Count) can = Count;
|
||||
else uflow = 0;
|
||||
|
||||
FCEUD_WriteSoundData(Buffer, can);
|
||||
|
||||
tmpcan = GetWriteSound();
|
||||
if (((tmpcan < Count * 0.90) && !uflow) || (skipcount >= maxskip)) {
|
||||
if (XBuf && (!NoWaiting || skipcount >= maxskip)) {
|
||||
skipcount = 0;
|
||||
FCEUD_BlitScreen(XBuf);
|
||||
} else {
|
||||
skipcount++;
|
||||
//FCEU_printf("Skipped0");
|
||||
}
|
||||
Buffer += can;
|
||||
Count -= can;
|
||||
if (Count) {
|
||||
if (NoWaiting) {
|
||||
can = GetWriteSound();
|
||||
if (Count > can) Count = can;
|
||||
}
|
||||
FCEUD_WriteSoundData(Buffer, Count);
|
||||
}
|
||||
} else {
|
||||
skipcount++;
|
||||
//FCEU_printf("Skipped");
|
||||
#ifdef NETWORK
|
||||
if (!NoWaiting && FCEUDnetplay && (uflow || tmpcan >= (Count * 0.90))) {
|
||||
if (Count > tmpcan) Count = tmpcan;
|
||||
while (tmpcan > 0) {
|
||||
//printf("Overwrite: %d\n", (Count <= tmpcan)?Count : tmpcan);
|
||||
FCEUD_WriteSoundData(Buffer, (Count <= tmpcan) ? Count : tmpcan);
|
||||
tmpcan -= Count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/* This complex statement deserves some explanation.
|
||||
Make sure this special speed throttling hasn't been disabled by the user
|
||||
first. Second, we don't want to throttle the speed if the fast-forward
|
||||
button is pressed down(or during certain network play conditions).
|
||||
|
||||
Now, if we're at this point, we'll throttle speed if sound is disabled.
|
||||
Otherwise, it gets a bit more complicated. We'll throttle speed if focus
|
||||
to FCE Ultra has been lost and we're writing to the primary sound buffer
|
||||
because our sound code won't block. Blocking does seem to work when
|
||||
writing to a secondary buffer, so we won't throttle when a secondary
|
||||
buffer is used.
|
||||
*/
|
||||
int skipthis = 0;
|
||||
|
||||
if (!(eoptions & EO_NOTHROTTLE))
|
||||
if (!NoWaiting)
|
||||
if (!soundo || (soundo && nofocus && !(soundoptions & SO_SECONDARY)))
|
||||
skipthis = SpeedThrottle();
|
||||
|
||||
if (XBuf) {
|
||||
if ((!skipthis && !NoWaiting) || (skipcount >= maxskip)) {
|
||||
FCEUD_BlitScreen(XBuf);
|
||||
skipcount = 0;
|
||||
} else {
|
||||
skipcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateFCEUWindow();
|
||||
FCEUD_UpdateInput();
|
||||
PPUViewDoBlit();
|
||||
}
|
||||
|
||||
FILE *FCEUD_UTF8fopen(const char *n, const char *m) {
|
||||
return(fopen(n, m));
|
||||
}
|
||||
@@ -1,434 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "../../md5.h"
|
||||
|
||||
static int recv_tcpwrap(uint8 *buf, int len);
|
||||
static void NetStatAdd(char *text);
|
||||
|
||||
static HWND netwin = 0;
|
||||
|
||||
static char *netstatt[64];
|
||||
static int netstattcount = 0;
|
||||
static int netlocalplayers = 1;
|
||||
|
||||
static char *netplayhost = 0;
|
||||
static char *netplaynick = 0;
|
||||
static char *netgamekey = 0;
|
||||
static char *netpassword = 0;
|
||||
static int remotetport = 0xFCE;
|
||||
|
||||
static SOCKET Socket = INVALID_SOCKET;
|
||||
|
||||
static int wsainit = 0;
|
||||
|
||||
int FCEUDnetplay = 0;
|
||||
static void WSE(char *ahh) {
|
||||
char tmp[256];
|
||||
sprintf(tmp, "*** Winsock: %s", ahh);
|
||||
NetStatAdd(tmp);
|
||||
}
|
||||
|
||||
static void en32(uint8 *buf, uint32 morp) {
|
||||
buf[0] = morp;
|
||||
buf[1] = morp >> 8;
|
||||
buf[2] = morp >> 16;
|
||||
buf[3] = morp >> 24;
|
||||
}
|
||||
|
||||
static void FixCDis(HWND hParent, int how);
|
||||
void FCEUD_NetworkClose(void) {
|
||||
NetStatAdd("*** Connection lost.");
|
||||
if (netwin) {
|
||||
SetDlgItemText(netwin, 250, "Connect");
|
||||
FixCDis(netwin, 1);
|
||||
}
|
||||
if (Socket != INVALID_SOCKET) {
|
||||
closesocket(Socket);
|
||||
Socket = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
if (wsainit) {
|
||||
WSACleanup();
|
||||
wsainit = 0;
|
||||
}
|
||||
/* Make sure blocking is returned to normal once network play is stopped. */
|
||||
NoWaiting &= ~2;
|
||||
FCEUDnetplay = 0;
|
||||
FCEUI_NetplayStop();
|
||||
}
|
||||
static void FixCDis(HWND hParent, int how) {
|
||||
int x;
|
||||
|
||||
for (x = 200; x <= 206; x++)
|
||||
EnableWindow(GetDlgItem(hParent, x), how);
|
||||
}
|
||||
static void GetSettings(HWND hwndDlg) {
|
||||
char buf[256];
|
||||
char **strs[4] = { &netplayhost, &netplaynick, &netgamekey, &netpassword };
|
||||
int ids[4] = { 200, 203, 205, 206 };
|
||||
int x;
|
||||
|
||||
for (x = 0; x < 4; x++) {
|
||||
GetDlgItemText(hwndDlg, ids[x], buf, 256);
|
||||
if (*strs[x]) {
|
||||
free(*strs[x]);
|
||||
*strs[x] = 0;
|
||||
}
|
||||
if (buf[0]) {
|
||||
*strs[x] = malloc(strlen(buf) + 1);
|
||||
strcpy(*strs[x], buf);
|
||||
}
|
||||
}
|
||||
remotetport = GetDlgItemInt(hwndDlg, 201, 0, 0);
|
||||
netlocalplayers = 1 + SendDlgItemMessage(hwndDlg, 204, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
}
|
||||
|
||||
int FCEUD_NetworkConnect();
|
||||
|
||||
static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (uMsg) {
|
||||
case WM_CLOSE:
|
||||
GetSettings(hwndDlg);
|
||||
DestroyWindow(hwndDlg);
|
||||
netwin = 0;
|
||||
FCEUD_NetworkClose();
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if (HIWORD(wParam) == BN_CLICKED) {
|
||||
switch (LOWORD(wParam)) {
|
||||
case 250:
|
||||
if (FCEUDnetplay) {
|
||||
FCEUD_NetworkClose();
|
||||
SetDlgItemText(hwndDlg, 250, "Connect");
|
||||
FixCDis(hwndDlg, 1);
|
||||
} else if (GI) {
|
||||
GetSettings(hwndDlg);
|
||||
if (FCEUD_NetworkConnect()) {
|
||||
SetDlgItemText(hwndDlg, 250, "Disconnect");
|
||||
FixCDis(hwndDlg, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (HIWORD(wParam) == EN_CHANGE && Socket != INVALID_SOCKET) {
|
||||
char buf[1024];
|
||||
int t;
|
||||
|
||||
|
||||
t = GetDlgItemText(hwndDlg, 102, buf, 1024);
|
||||
buf[1023] = 0;
|
||||
|
||||
if (strchr(buf, '\r')) {
|
||||
char *src, *dest;
|
||||
|
||||
src = dest = buf;
|
||||
|
||||
while (*src) {
|
||||
if (*src != '\n' && *src != '\r') {
|
||||
*dest = *src;
|
||||
dest++;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
*dest = 0;
|
||||
FCEUI_NetplayText(buf);
|
||||
SetDlgItemText(hwndDlg, 102, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_INITDIALOG:
|
||||
if (netplayhost)
|
||||
SetDlgItemText(hwndDlg, 200, netplayhost);
|
||||
SetDlgItemInt(hwndDlg, 201, remotetport, 0);
|
||||
if (netplaynick)
|
||||
SetDlgItemText(hwndDlg, 203, netplaynick);
|
||||
if (netgamekey)
|
||||
SetDlgItemText(hwndDlg, 205, netgamekey);
|
||||
if (netpassword)
|
||||
SetDlgItemText(hwndDlg, 206, netpassword);
|
||||
|
||||
{
|
||||
int x;
|
||||
char buf[8];
|
||||
for (x = 0; x < 4; x++) {
|
||||
sprintf(buf, "%d", x + 1);
|
||||
SendDlgItemMessage(hwndDlg, 204, CB_ADDSTRING, 0, (LPARAM)(LPSTR)buf);
|
||||
}
|
||||
SendDlgItemMessage(hwndDlg, 204, CB_SETCURSEL, netlocalplayers - 1, (LPARAM)(LPSTR)0);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void NetStatAdd(char *text) {
|
||||
int x;
|
||||
uint32 totallen = 0;
|
||||
char *textbuf;
|
||||
|
||||
if (!netwin) return;
|
||||
if (netstattcount >= 64) free(netstatt[netstattcount & 63]);
|
||||
|
||||
if (!(netstatt[netstattcount & 63] = malloc(strlen(text) + 1)))
|
||||
return;
|
||||
strcpy(netstatt[netstattcount & 63], text);
|
||||
netstattcount++;
|
||||
|
||||
if (netstattcount >= 64) {
|
||||
for (x = netstattcount & 63;; ) {
|
||||
totallen += strlen(netstatt[x]);
|
||||
x = (x + 1) & 63;
|
||||
if (x == (netstattcount & 63)) break;
|
||||
totallen += 2;
|
||||
}
|
||||
|
||||
totallen++; // NULL
|
||||
textbuf = malloc(totallen);
|
||||
textbuf[0] = 0;
|
||||
|
||||
for (x = netstattcount & 63;; ) {
|
||||
strcat(textbuf, netstatt[x]);
|
||||
x = (x + 1) & 63;
|
||||
if (x == (netstattcount & 63)) break;
|
||||
strcat(textbuf, "\r\n");
|
||||
}
|
||||
} else {
|
||||
for (x = 0; x < netstattcount; x++) {
|
||||
totallen += strlen(netstatt[x]);
|
||||
if (x < (netstattcount - 1))
|
||||
totallen += 2;
|
||||
}
|
||||
totallen++;
|
||||
textbuf = malloc(totallen);
|
||||
textbuf[0] = 0;
|
||||
for (x = 0; x < netstattcount; x++) {
|
||||
strcat(textbuf, netstatt[x]);
|
||||
if (x < (netstattcount - 1))
|
||||
strcat(textbuf, "\r\n");
|
||||
}
|
||||
}
|
||||
SetDlgItemText(netwin, 101, textbuf);
|
||||
free(textbuf);
|
||||
SendDlgItemMessage(netwin, 101, EM_LINESCROLL, 0, 32767);
|
||||
}
|
||||
|
||||
void FCEUD_NetplayText(uint8 *text) {
|
||||
NetStatAdd(text);
|
||||
}
|
||||
|
||||
int FCEUD_NetworkConnect(void) {
|
||||
WSADATA WSAData;
|
||||
SOCKADDR_IN sockin; /* I want to play with fighting robots. */
|
||||
SOCKET TSocket;
|
||||
int netdivisor;
|
||||
|
||||
if (WSAStartup(MAKEWORD(1, 1), &WSAData)) {
|
||||
NetStatAdd("*** Error initializing WIndows Sockets.");
|
||||
return(0);
|
||||
}
|
||||
wsainit = 1;
|
||||
|
||||
if ((TSocket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
|
||||
WSE("Error creating stream socket.");
|
||||
FCEUD_NetworkClose();
|
||||
return(0);
|
||||
}
|
||||
|
||||
memset(&sockin, 0, sizeof(sockin));
|
||||
sockin.sin_family = AF_INET;
|
||||
|
||||
{
|
||||
struct hostent *phostentb;
|
||||
unsigned long hadr;
|
||||
int sockin_len;
|
||||
|
||||
sockin.sin_port = 0;
|
||||
sockin.sin_addr.s_addr = INADDR_ANY;
|
||||
sockin_len = sizeof(sockin);
|
||||
|
||||
hadr = inet_addr(netplayhost);
|
||||
|
||||
if (hadr != INADDR_NONE)
|
||||
sockin.sin_addr.s_addr = hadr;
|
||||
else {
|
||||
NetStatAdd("*** Looking up host name...");
|
||||
if (!(phostentb = gethostbyname((const char*)netplayhost))) {
|
||||
WSE("Error getting host network information.");
|
||||
closesocket(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return(0);
|
||||
}
|
||||
memcpy((char*)&sockin.sin_addr, ((PHOSTENT)phostentb)->h_addr, ((PHOSTENT)phostentb)->h_length);
|
||||
}
|
||||
|
||||
sockin.sin_port = htons(remotetport);
|
||||
NetStatAdd("*** Connecting to remote host...");
|
||||
if (connect(TSocket, (PSOCKADDR)&sockin, sizeof(sockin)) == SOCKET_ERROR) {
|
||||
WSE("Error connecting to remote host.");
|
||||
closesocket(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return(0);
|
||||
}
|
||||
Socket = TSocket;
|
||||
NetStatAdd("*** Sending initialization data to server...");
|
||||
|
||||
{
|
||||
uint8 *sendbuf;
|
||||
uint8 buf[1];
|
||||
uint32 sblen;
|
||||
|
||||
sblen = 4 + 16 + 16 + 64 + 1 + (netplaynick ? strlen(netplaynick) : 0);
|
||||
sendbuf = malloc(sblen);
|
||||
memset(sendbuf, 0, sblen);
|
||||
|
||||
en32(sendbuf, sblen - 4);
|
||||
|
||||
if (netgamekey) {
|
||||
struct md5_context md5;
|
||||
uint8 md5out[16];
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5, GI->MD5, 16);
|
||||
md5_update(&md5, netgamekey, strlen(netgamekey));
|
||||
md5_finish(&md5, md5out);
|
||||
memcpy(sendbuf + 4, md5out, 16);
|
||||
} else
|
||||
memcpy(sendbuf + 4, GI->MD5, 16);
|
||||
|
||||
if (netpassword) {
|
||||
struct md5_context md5;
|
||||
uint8 md5out[16];
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5, netpassword, strlen(netpassword));
|
||||
md5_finish(&md5, md5out);
|
||||
memcpy(sendbuf + 4 + 16, md5out, 16);
|
||||
}
|
||||
|
||||
memset(sendbuf + 4 + 16 + 16, 0, 64);
|
||||
sendbuf[4 + 16 + 16 + 64] = netlocalplayers;
|
||||
|
||||
if (netplaynick)
|
||||
memcpy(sendbuf + 4 + 16 + 16 + 64 + 1, netplaynick, strlen(netplaynick));
|
||||
|
||||
send(Socket, sendbuf, sblen, 0);
|
||||
free(sendbuf);
|
||||
|
||||
recv_tcpwrap(buf, 1);
|
||||
netdivisor = buf[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FCEUI_NetplayStart(netlocalplayers, netdivisor);
|
||||
NetStatAdd("*** Connection established.");
|
||||
|
||||
FCEUDnetplay = 1;
|
||||
int tcpopt = 1;
|
||||
if (setsockopt(TSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&tcpopt, sizeof(int)))
|
||||
puts("Nodelay fail");
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int FCEUD_SendData(void *data, uint32 len) {
|
||||
send(Socket, data, len, 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int recv_tcpwrap(uint8 *buf, int len) {
|
||||
fd_set fdoo;
|
||||
int t;
|
||||
struct timeval popeye;
|
||||
|
||||
popeye.tv_sec = 0;
|
||||
popeye.tv_usec = 100000;
|
||||
|
||||
while (len) {
|
||||
FD_ZERO(&fdoo);
|
||||
FD_SET(Socket, &fdoo);
|
||||
|
||||
switch (select(0, &fdoo, 0, 0, &popeye)) {
|
||||
case 0: //BlockingCheck();
|
||||
continue;
|
||||
case SOCKET_ERROR: return(0);
|
||||
}
|
||||
|
||||
t = recv(Socket, buf, len, 0);
|
||||
if (t <= 0) return(0);
|
||||
len -= t;
|
||||
buf += t;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
int FCEUD_RecvData(void *data, uint32 len) {
|
||||
NoWaiting &= ~2;
|
||||
|
||||
for (;; ) {
|
||||
fd_set funfun;
|
||||
struct timeval popeye;
|
||||
|
||||
popeye.tv_sec = 0;
|
||||
popeye.tv_usec = 100000;
|
||||
|
||||
FD_ZERO(&funfun);
|
||||
FD_SET(Socket, &funfun);
|
||||
|
||||
switch (select(0, &funfun, 0, 0, &popeye)) {
|
||||
case 0: continue;
|
||||
case SOCKET_ERROR: return(0);
|
||||
}
|
||||
|
||||
if (FD_ISSET(Socket, &funfun)) {
|
||||
if (recv_tcpwrap(data, len) > 0) {
|
||||
unsigned long beefie;
|
||||
if (!ioctlsocket(Socket, FIONREAD, &beefie))
|
||||
if (beefie)
|
||||
NoWaiting |= 2;
|
||||
return(1);
|
||||
} else
|
||||
return(0);
|
||||
} else
|
||||
return(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ShowNetplayConsole(void) {
|
||||
if (!netwin)
|
||||
netwin = CreateDialog(fceu_hInstance, "NETMOO", 0, NetCon);
|
||||
}
|
||||
|
||||
CFGSTRUCT NetplayConfig[] = {
|
||||
AC(remotetport),
|
||||
AC(netlocalplayers),
|
||||
ACS(netgamekey),
|
||||
ACS(netplayhost),
|
||||
ACS(netplaynick),
|
||||
ACS(netpassword),
|
||||
ENDCFGSTRUCT
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
extern CFGSTRUCT NetplayConfig[];
|
||||
@@ -1,347 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Ben Parnell
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "..\..\ppuview.h"
|
||||
#include "..\..\palette.h" //bbit edited: this line changed to include this instead of svga.h
|
||||
|
||||
|
||||
HWND hPPUView;
|
||||
|
||||
extern uint8 *VPage[8];
|
||||
extern uint8 PALRAM[0x20];
|
||||
|
||||
int PPUViewPosX, PPUViewPosY;
|
||||
uint8 palcache[32] = { 0xFF }; //palette cache
|
||||
uint8 chrcache0[0x1000], chrcache1[0x1000]; //cache CHR, fixes a refresh problem when right-clicking
|
||||
VOID *pattern0, *pattern1; //pattern table bitmap arrays
|
||||
VOID *ppuv_palette;
|
||||
static int pindex0 = 0, pindex1 = 0;
|
||||
int PPUViewScanline = 0, PPUViewer = 0;
|
||||
int PPUViewSkip, PPUViewRefresh;
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
#define PATTERNWIDTH 128
|
||||
#define PATTERNHEIGHT 128
|
||||
#define PATTERNBITWIDTH PATTERNWIDTH * 3
|
||||
#define PATTERNDESTX 10
|
||||
#define PATTERNDESTY 15
|
||||
#define ZOOM 2
|
||||
|
||||
#define PALETTEWIDTH 32 * 4 * 4
|
||||
#define PALETTEHEIGHT 32 * 2
|
||||
#define PALETTEBITWIDTH PALETTEWIDTH * 3
|
||||
#define PALETTEDESTX 10
|
||||
#define PALETTEDESTY 327
|
||||
|
||||
#define TBM_SETPOS (WM_USER + 5)
|
||||
#define TBM_SETRANGE (WM_USER + 6)
|
||||
#define TBM_GETPOS (WM_USER)
|
||||
|
||||
BITMAPINFO bmInfo;
|
||||
HDC pDC, TmpDC0, TmpDC1;
|
||||
HBITMAP TmpBmp0, TmpBmp1;
|
||||
HGDIOBJ TmpObj0, TmpObj1;
|
||||
|
||||
BITMAPINFO bmInfo2;
|
||||
HDC TmpDC2, TmpDC3;
|
||||
HBITMAP TmpBmp2, TmpBmp3;
|
||||
HGDIOBJ TmpObj2, TmpObj3;
|
||||
|
||||
|
||||
void PPUViewDoBlit() {
|
||||
if (!hPPUView) return;
|
||||
if (PPUViewSkip < PPUViewRefresh) {
|
||||
PPUViewSkip++;
|
||||
return;
|
||||
}
|
||||
PPUViewSkip = 0;
|
||||
|
||||
StretchBlt(pDC, PATTERNDESTX, PATTERNDESTY, PATTERNWIDTH * ZOOM, PATTERNHEIGHT * ZOOM, TmpDC0, 0, PATTERNHEIGHT - 1, PATTERNWIDTH, -PATTERNHEIGHT, SRCCOPY);
|
||||
StretchBlt(pDC, PATTERNDESTX + (PATTERNWIDTH * ZOOM) + 1, PATTERNDESTY, PATTERNWIDTH * ZOOM, PATTERNHEIGHT * ZOOM, TmpDC1, 0, PATTERNHEIGHT - 1, PATTERNWIDTH, -PATTERNHEIGHT, SRCCOPY);
|
||||
StretchBlt(pDC, PALETTEDESTX, PALETTEDESTY, PALETTEWIDTH, PALETTEHEIGHT, TmpDC2, 0, PALETTEHEIGHT - 1, PALETTEWIDTH, -PALETTEHEIGHT, SRCCOPY);
|
||||
}
|
||||
|
||||
void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 pal) {
|
||||
int i, j, x, y, index = 0;
|
||||
int p = 0, tmp;
|
||||
uint8 chr0, chr1;
|
||||
uint8 *pbitmap = bitmap;
|
||||
|
||||
pal <<= 2;
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
for (y = 0; y < 8; y++) {
|
||||
chr0 = table[index];
|
||||
chr1 = table[index + 8];
|
||||
tmp = 7;
|
||||
for (x = 0; x < 8; x++) {
|
||||
p = (chr0 >> tmp) & 1;
|
||||
p |= ((chr1 >> tmp) & 1) << 1;
|
||||
p = palcache[p | pal];
|
||||
tmp--;
|
||||
|
||||
*(uint8*)(pbitmap++) = palo[p].b;
|
||||
*(uint8*)(pbitmap++) = palo[p].g;
|
||||
*(uint8*)(pbitmap++) = palo[p].r;
|
||||
}
|
||||
index++;
|
||||
pbitmap += ((PALETTEBITWIDTH >> 2) - 24);
|
||||
}
|
||||
index += 8;
|
||||
pbitmap -= (((PALETTEBITWIDTH >> 2) << 3) - 24);
|
||||
}
|
||||
pbitmap += ((PALETTEBITWIDTH >> 2) * 7);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePPUView(int refreshchr) {
|
||||
int x, y, i;
|
||||
uint8 *pbitmap = ppuv_palette;
|
||||
|
||||
if (!hPPUView) return;
|
||||
if (PPUViewSkip < PPUViewRefresh) return;
|
||||
|
||||
if (refreshchr) {
|
||||
for (i = 0, x = 0x1000; i < 0x1000; i++, x++) {
|
||||
chrcache0[i] = VPage[i >> 10][i];
|
||||
chrcache1[i] = VPage[x >> 10][x];
|
||||
}
|
||||
}
|
||||
|
||||
//update palette only if required
|
||||
if (memcmp(palcache, PALRAM, 32) != 0) { //bbit note: let para know that this if is useless and
|
||||
//cache palette content will not work because of the lines
|
||||
memcpy(palcache, PALRAM, 32); //below that change palcache which will make it not equal next time
|
||||
palcache[0x10] = palcache[0x00];
|
||||
palcache[0x14] = palcache[0x00];
|
||||
palcache[0x18] = palcache[0x00];
|
||||
palcache[0x1C] = palcache[0x00];
|
||||
|
||||
//draw palettes
|
||||
for (y = 0; y < PALETTEHEIGHT; y++) {
|
||||
for (x = 0; x < PALETTEWIDTH; x++) {
|
||||
i = (((y >> 5) << 4) + (x >> 5));
|
||||
*(uint8*)(pbitmap++) = palo[palcache[i]].b;
|
||||
*(uint8*)(pbitmap++) = palo[palcache[i]].g;
|
||||
*(uint8*)(pbitmap++) = palo[palcache[i]].r;
|
||||
}
|
||||
}
|
||||
|
||||
//draw line seperators on palette
|
||||
pbitmap = (ppuv_palette + PALETTEBITWIDTH * 31);
|
||||
for (x = 0; x < PALETTEWIDTH * 2; x++) {
|
||||
*(uint8*)(pbitmap++) = 0;
|
||||
*(uint8*)(pbitmap++) = 0;
|
||||
*(uint8*)(pbitmap++) = 0;
|
||||
}
|
||||
pbitmap = (ppuv_palette - 3);
|
||||
for (y = 0; y < 64 * 3; y++) {
|
||||
if (!(y % 3)) pbitmap += (32 * 4 * 3);
|
||||
for (x = 0; x < 6; x++) {
|
||||
*(uint8*)(pbitmap++) = 0;
|
||||
}
|
||||
pbitmap += ((32 * 4 * 3) - 6);
|
||||
}
|
||||
memcpy(palcache, PALRAM, 32); //palcache which will make it not equal next time
|
||||
}
|
||||
|
||||
DrawPatternTable(pattern0, chrcache0, pindex0);
|
||||
DrawPatternTable(pattern1, chrcache1, pindex1);
|
||||
|
||||
//PPUViewDoBlit();
|
||||
}
|
||||
|
||||
void KillPPUView() {
|
||||
//GDI cleanup
|
||||
DeleteObject(TmpBmp0);
|
||||
SelectObject(TmpDC0, TmpObj0);
|
||||
DeleteDC(TmpDC0);
|
||||
DeleteObject(TmpBmp1);
|
||||
SelectObject(TmpDC1, TmpObj1);
|
||||
DeleteDC(TmpDC1);
|
||||
DeleteObject(TmpBmp2);
|
||||
SelectObject(TmpDC2, TmpObj2);
|
||||
DeleteDC(TmpDC2);
|
||||
ReleaseDC(hPPUView, pDC);
|
||||
|
||||
DestroyWindow(hPPUView);
|
||||
hPPUView = NULL;
|
||||
PPUViewer = 0;
|
||||
PPUViewSkip = 0;
|
||||
}
|
||||
|
||||
extern void StopSound(void);
|
||||
|
||||
BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
RECT wrect;
|
||||
char str[20];
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
SetWindowPos(hwndDlg, 0, PPUViewPosX, PPUViewPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
|
||||
//prepare the bitmap attributes
|
||||
//pattern tables
|
||||
memset(&bmInfo.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
|
||||
bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmInfo.bmiHeader.biWidth = PATTERNWIDTH;
|
||||
bmInfo.bmiHeader.biHeight = PATTERNHEIGHT;
|
||||
bmInfo.bmiHeader.biPlanes = 1;
|
||||
bmInfo.bmiHeader.biBitCount = 24;
|
||||
|
||||
//palettes
|
||||
memset(&bmInfo2.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
|
||||
bmInfo2.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmInfo2.bmiHeader.biWidth = PALETTEWIDTH;
|
||||
bmInfo2.bmiHeader.biHeight = PALETTEHEIGHT;
|
||||
bmInfo2.bmiHeader.biPlanes = 1;
|
||||
bmInfo2.bmiHeader.biBitCount = 24;
|
||||
|
||||
//create memory dcs
|
||||
pDC = GetDC(hwndDlg); // GetDC(GetDlgItem(hwndDlg,101));
|
||||
TmpDC0 = CreateCompatibleDC(pDC); //pattern table 0
|
||||
TmpDC1 = CreateCompatibleDC(pDC); //pattern table 1
|
||||
TmpDC2 = CreateCompatibleDC(pDC); //palettes
|
||||
|
||||
//create bitmaps and select them into the memory dc's
|
||||
TmpBmp0 = CreateDIBSection(pDC, &bmInfo, DIB_RGB_COLORS, (VOID**)&pattern0, 0, 0);
|
||||
TmpObj0 = SelectObject(TmpDC0, TmpBmp0);
|
||||
TmpBmp1 = CreateDIBSection(pDC, &bmInfo, DIB_RGB_COLORS, (VOID**)&pattern1, 0, 0);
|
||||
TmpObj1 = SelectObject(TmpDC1, TmpBmp1);
|
||||
TmpBmp2 = CreateDIBSection(pDC, &bmInfo2, DIB_RGB_COLORS, (VOID**)&ppuv_palette, 0, 0);
|
||||
TmpObj2 = SelectObject(TmpDC2, TmpBmp2);
|
||||
|
||||
//Refresh Trackbar
|
||||
SendDlgItemMessage(hwndDlg, 201, TBM_SETRANGE, 0, (LPARAM)MAKELONG(0, 25));
|
||||
SendDlgItemMessage(hwndDlg, 201, TBM_SETPOS, 1, PPUViewRefresh);
|
||||
|
||||
//Set Text Limit
|
||||
SendDlgItemMessage(hwndDlg, 102, EM_SETLIMITTEXT, 3, 0);
|
||||
|
||||
//force redraw the first time the PPU Viewer is opened
|
||||
PPUViewSkip = 100;
|
||||
|
||||
//clear cache
|
||||
memset(palcache, 0, 32);
|
||||
memset(chrcache0, 0, 0x1000);
|
||||
memset(chrcache1, 0, 0x1000);
|
||||
|
||||
PPUViewer = 1;
|
||||
break;
|
||||
case WM_PAINT:
|
||||
PPUViewDoBlit();
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT:
|
||||
KillPPUView();
|
||||
break;
|
||||
case WM_MOVING:
|
||||
StopSound();
|
||||
break;
|
||||
case WM_MOVE:
|
||||
GetWindowRect(hwndDlg, &wrect);
|
||||
PPUViewPosX = wrect.left;
|
||||
PPUViewPosY = wrect.top;
|
||||
break;
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
mouse_x = GET_X_LPARAM(lParam);
|
||||
mouse_y = GET_Y_LPARAM(lParam);
|
||||
if (((mouse_x >= PATTERNDESTX) && (mouse_x < (PATTERNDESTX + (PATTERNWIDTH * ZOOM)))) && (mouse_y >= PATTERNDESTY) && (mouse_y < (PATTERNDESTY + (PATTERNHEIGHT * ZOOM)))) {
|
||||
if (pindex0 == 7) pindex0 = 0;
|
||||
else pindex0++;
|
||||
} else if (((mouse_x >= PATTERNDESTX + (PATTERNWIDTH * ZOOM) + 1) && (mouse_x < (PATTERNDESTX + (PATTERNWIDTH * ZOOM) * 2 + 1))) && (mouse_y >= PATTERNDESTY) && (mouse_y < (PATTERNDESTY + (PATTERNHEIGHT * ZOOM)))) {
|
||||
if (pindex1 == 7) pindex1 = 0;
|
||||
else pindex1++;
|
||||
}
|
||||
UpdatePPUView(0);
|
||||
PPUViewDoBlit();
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
mouse_x = GET_X_LPARAM(lParam);
|
||||
mouse_y = GET_Y_LPARAM(lParam);
|
||||
if (((mouse_x >= PATTERNDESTX) && (mouse_x < (PATTERNDESTX + (PATTERNWIDTH * ZOOM)))) && (mouse_y >= PATTERNDESTY) && (mouse_y < (PATTERNDESTY + (PATTERNHEIGHT * ZOOM)))) {
|
||||
mouse_x = (mouse_x - PATTERNDESTX) / (8 * ZOOM);
|
||||
mouse_y = (mouse_y - PATTERNDESTY) / (8 * ZOOM);
|
||||
sprintf(str, "Tile: $%X%X", mouse_y, mouse_x);
|
||||
SetDlgItemText(hwndDlg, 103, str);
|
||||
SetDlgItemText(hwndDlg, 104, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 105, "Palettes");
|
||||
} else if (((mouse_x >= PATTERNDESTX + (PATTERNWIDTH * ZOOM) + 1) && (mouse_x < (PATTERNDESTX + (PATTERNWIDTH * ZOOM) * 2 + 1))) && (mouse_y >= PATTERNDESTY) && (mouse_y < (PATTERNDESTY + (PATTERNHEIGHT * ZOOM)))) {
|
||||
mouse_x = (mouse_x - (PATTERNDESTX + (PATTERNWIDTH * ZOOM) + 1)) / (8 * ZOOM);
|
||||
mouse_y = (mouse_y - PATTERNDESTY) / (8 * ZOOM);
|
||||
sprintf(str, "Tile: $%X%X", mouse_y, mouse_x);
|
||||
SetDlgItemText(hwndDlg, 104, str);
|
||||
SetDlgItemText(hwndDlg, 103, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 105, "Palettes");
|
||||
} else if (((mouse_x >= PALETTEDESTX) && (mouse_x < (PALETTEDESTX + PALETTEWIDTH))) && (mouse_y >= PALETTEDESTY) && (mouse_y < (PALETTEDESTY + PALETTEHEIGHT))) {
|
||||
mouse_x = (mouse_x - PALETTEDESTX) / 32;
|
||||
mouse_y = (mouse_y - PALETTEDESTY) / 32;
|
||||
sprintf(str, "Palette: $%02X", palcache[(mouse_y << 4) | mouse_x]);
|
||||
SetDlgItemText(hwndDlg, 103, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 104, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 105, str);
|
||||
} else {
|
||||
SetDlgItemText(hwndDlg, 103, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 104, "Tile:");
|
||||
SetDlgItemText(hwndDlg, 105, "Palettes");
|
||||
}
|
||||
|
||||
break;
|
||||
case WM_NCACTIVATE:
|
||||
sprintf(str, "%d", PPUViewScanline);
|
||||
SetDlgItemText(hwndDlg, 102, str);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (HIWORD(wParam)) {
|
||||
case EN_UPDATE:
|
||||
GetDlgItemText(hwndDlg, 102, str, 4);
|
||||
sscanf(str, "%d", &PPUViewScanline);
|
||||
if (PPUViewScanline > 239) PPUViewScanline = 239;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
if (lParam) { //refresh trackbar
|
||||
PPUViewRefresh = SendDlgItemMessage(hwndDlg, 201, TBM_GETPOS, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DoPPUView() {
|
||||
if (!GI) {
|
||||
FCEUD_PrintError("You must have a game loaded before you can use the PPU Viewer.");
|
||||
return;
|
||||
}
|
||||
if (GI->type == GIT_NSF) {
|
||||
FCEUD_PrintError("Sorry, you can't use the PPU Viewer with NSFs.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hPPUView) hPPUView = CreateDialog(fceu_hInstance, "PPUVIEW", NULL, PPUViewCallB);
|
||||
if (hPPUView) {
|
||||
SetWindowPos(hPPUView, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOOWNERZORDER);
|
||||
UpdatePPUView(1);
|
||||
PPUViewDoBlit();
|
||||
}
|
||||
}
|
||||
@@ -1,738 +0,0 @@
|
||||
/*********************************************
|
||||
File: C:\DEV-CPP\PROJECTS\FCEU\SRC\DRIVERS\WIN\RES.RC
|
||||
Generated by Resource Builder.
|
||||
*********************************************/
|
||||
// Below are important 3 lines, don't change them!
|
||||
/*
|
||||
OutputExt=res
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winuser.h>
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, 0
|
||||
ICON_1 ICON "src\\drivers\\win\\res\\EXE.ico"
|
||||
ICON_2 ICON "src\\drivers\\win\\res\\NES.ico"
|
||||
ICON_3 ICON "src\\drivers\\win\\res\\FDS.ico"
|
||||
ICON_4 ICON "src\\drivers\\win\\res\\FAM.ico"
|
||||
|
||||
|
||||
FCEUMENU MENU
|
||||
MOVEABLE PURE LOADONCALL DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Open...", 100
|
||||
MENUITEM "&Close", 101
|
||||
MENUITEM "&Recent", 102
|
||||
MENUITEM "Recent &Directories", 103
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Load State From...", 111
|
||||
MENUITEM "Save State As...", 110
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Log &Sound As...", 120
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Copifamiclone &Hardware Interface...", 140
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit F12", 130
|
||||
END
|
||||
POPUP "&NES"
|
||||
BEGIN
|
||||
MENUITEM "&Reset F10", 200
|
||||
MENUITEM "&Power F11", 201
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Cheats...", 204
|
||||
MENUITEM "&Debugger...", 203
|
||||
MENUITEM "PPU View...", 205
|
||||
END
|
||||
POPUP "&Config"
|
||||
BEGIN
|
||||
MENUITEM "Hide Menu F3", 300
|
||||
MENUITEM "Active While Focus Lost", 301
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Game Genie", 310
|
||||
MENUITEM "PAL Emulation", 311
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Directories...", 320
|
||||
MENUITEM "&GUI...", 327
|
||||
MENUITEM "&Input...", 321
|
||||
MENUITEM "&Network Play...", 323
|
||||
MENUITEM "&Palette...", 324
|
||||
MENUITEM "&Sound...", 325
|
||||
MENUITEM "&Timing...", 322
|
||||
MENUITEM "&Video...", 326
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&Message Log...", 401
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About...", 400
|
||||
END
|
||||
END
|
||||
|
||||
ADDCHEAT DIALOG 28, 53, 405, 239
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Add Cheat"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "",108,"LISTBOX",LBS_WANTKEYBOARDINPUT |LBS_NOINTEGRALHEIGHT |LBS_HASSTRINGS |LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VISIBLE ,9,30,56,202
|
||||
CONTROL "V1:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,85,39,12,8
|
||||
CONTROL "V2:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,136,39,12,8
|
||||
CONTROL "",110,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,101,37,20,12
|
||||
CONTROL "",111,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,152,37,20,12
|
||||
CONTROL "&Reset Search",112,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,98,213,59,14
|
||||
CONTROL "&Do Search",113,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,93,194,49,14
|
||||
CONTROL "&Unhide Excluded",107,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,89,164,59,14
|
||||
CONTROL "Set Original to Current",114,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,82,139,80,14
|
||||
CONTROL "Cheat Search",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,5,17,172,219
|
||||
CONTROL "Parameters",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,80,26,97,103
|
||||
CONTROL "O==V1 &&&& C==V2",115,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,54,87,12
|
||||
CONTROL "O==V1 &&&& |O-C|==V2",116,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,66,87,12
|
||||
CONTROL "|O-C|==V2",117,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,102,48,12
|
||||
CONTROL "O!=C",118,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,114,48,12
|
||||
CONTROL "",120,"SCROLLBAR",SBS_VERT |WS_CHILD |WS_VISIBLE ,66,30,12,200
|
||||
CONTROL "Close",106,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,317,218,81,14
|
||||
CONTROL "Value decreased.",119,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,78,75,12
|
||||
CONTROL "Value increased.",120,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,86,90,75,12
|
||||
CONTROL "Name:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_VISIBLE ,300,31,23,8
|
||||
CONTROL "",200,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,328,30,65,12
|
||||
CONTROL "Address:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_VISIBLE ,304,47,31,8
|
||||
CONTROL "",201,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,340,46,27,12
|
||||
CONTROL "Value:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_VISIBLE ,309,63,26,8
|
||||
CONTROL "",202,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,340,62,27,12
|
||||
CONTROL "",203,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,340,78,27,12
|
||||
CONTROL "Add",250,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,329,116,50,14
|
||||
CONTROL "Cheats",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,182,17,217,188
|
||||
CONTROL "Compare:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_VISIBLE ,306,80,30,8
|
||||
CONTROL "Read Substitute",204,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,317,94,74,12
|
||||
CONTROL "Update",251,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,326,158,58,14
|
||||
CONTROL "",300,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VSCROLL |WS_VISIBLE ,188,30,110,164
|
||||
CONTROL "Delete",252,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,326,187,58,14
|
||||
CONTROL "Add Game Genie",253,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,323,136,64,14
|
||||
CONTROL "To add a Game Genie code, type the code into the \x22Name\x22 field, and hit \x22Add Game Genie\x22.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,10,4,387,8
|
||||
END
|
||||
|
||||
DEBUGGER DIALOG 6, 51, 380, 227
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Debugger"
|
||||
FONT 8, "Fixedsys"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,317,206,56,14
|
||||
CONTROL "",100,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,2,6,187,220
|
||||
CONTROL "",200,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,226,52,20,12
|
||||
CONTROL "PC:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,206,54,15,8
|
||||
CONTROL "",201,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,226,66,12,12
|
||||
CONTROL "SP:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,206,69,15,8
|
||||
CONTROL "",202,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,226,80,12,12
|
||||
CONTROL "P:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,206,82,15,8
|
||||
CONTROL "",210,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,351,53,12,12
|
||||
CONTROL "A:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,335,54,11,8
|
||||
CONTROL "X:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,335,67,11,8
|
||||
CONTROL "",211,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,351,67,12,12
|
||||
CONTROL "Y:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,336,81,10,8
|
||||
CONTROL "",212,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,351,81,12,12
|
||||
CONTROL "N V - - D I Z C",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,260,58,64,8
|
||||
CONTROL "",407,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,259,68,8,12
|
||||
CONTROL "",406,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,267,68,8,12
|
||||
CONTROL "",403,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,291,68,8,12
|
||||
CONTROL "",402,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,299,68,8,12
|
||||
CONTROL "",401,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,307,68,8,12
|
||||
CONTROL "",400,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,315,68,8,12
|
||||
CONTROL "Flags:",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,252,49,81,35
|
||||
CONTROL "",223,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,252,85,18,8
|
||||
CONTROL "",224,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,278,85,18,8
|
||||
CONTROL "",225,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,304,85,18,8
|
||||
CONTROL "&Run",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,207,25,40,14
|
||||
CONTROL "R&eset",310,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,256,4,37,14
|
||||
CONTROL "&Step",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,207,4,40,14
|
||||
CONTROL "&NMI",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,344,25,30,14
|
||||
CONTROL "&IRQ",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,344,4,30,14
|
||||
CONTROL "",101,"SCROLLBAR",SBS_VERT |WS_CHILD |WS_VISIBLE ,190,5,9,219
|
||||
CONTROL "&Memory...",311,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,207,206,51,14
|
||||
CONTROL "BreakPoints",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,201,105,176,84
|
||||
CONTROL "IRQ:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,296,9,16,8
|
||||
CONTROL "",220,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,313,9,18,8
|
||||
CONTROL "NMI:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,296,19,16,8
|
||||
CONTROL "",221,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,313,19,18,8
|
||||
CONTROL "Reset:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,285,29,27,8
|
||||
CONTROL "",222,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,313,29,18,8
|
||||
CONTROL "",510,"LISTBOX",LBS_NOTIFY |WS_CHILD |WS_BORDER |WS_VSCROLL |WS_VISIBLE ,205,114,100,51
|
||||
CONTROL "Delete",540,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,207,168,34,14
|
||||
CONTROL "",520,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,308,114,23,12
|
||||
CONTROL "",521,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,341,114,23,12
|
||||
CONTROL "Read",530,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,310,126,42,12
|
||||
CONTROL "Write",531,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,310,146,36,12
|
||||
CONTROL "PC Same",532,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,315,136,42,12
|
||||
CONTROL "Exclude",533,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,315,156,42,12
|
||||
CONTROL "Add",541,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,337,168,36,14
|
||||
CONTROL "Registers",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,201,42,171,54
|
||||
CONTROL "-",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,332,116,7,8
|
||||
END
|
||||
|
||||
DIRCONFIG DIALOG 63, 7, 280, 331
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Directories Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,215,311,56,14
|
||||
CONTROL "The settings in the \x22Individual Directory Overrides\x22 group will override the settings in the \x22Base Directory Override\x22 group. To delete an override, delete the text from the text edit control. Note that the directory the configuration file is in can not be overridden. Also, no override directories as specified here will be created; they must already exist.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,15,3,254,50
|
||||
CONTROL "Cheats",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,110,235,32
|
||||
CONTROL "",100,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,30,122,150,12
|
||||
CONTROL "Browse...",200,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,191,121,56,14
|
||||
CONTROL "Miscellaneous(custom game palettes)",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,145,235,32
|
||||
CONTROL "",101,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,30,157,150,12
|
||||
CONTROL "Browse...",201,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,191,156,56,14
|
||||
CONTROL "Nonvolatile Game Data(battery-backed RAM)",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,180,235,32
|
||||
CONTROL "",102,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,30,192,150,12
|
||||
CONTROL "Browse...",202,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,191,191,56,14
|
||||
CONTROL "Save States",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,215,235,32
|
||||
CONTROL "",103,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,30,227,150,12
|
||||
CONTROL "Browse...",203,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,191,226,56,14
|
||||
CONTROL "Screen Snapshots",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,250,235,42
|
||||
CONTROL "",104,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,30,262,150,12
|
||||
CONTROL "Browse...",204,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,191,261,56,14
|
||||
CONTROL "Individual Directory Overrides",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,11,96,257,205
|
||||
CONTROL "Base Directory Override",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,11,57,235,32
|
||||
CONTROL "",105,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,20,71,150,12
|
||||
CONTROL "Browse...",205,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,182,70,56,14
|
||||
CONTROL "Save screen snapshots as \x22<filebase>-<x>.png\x22.",300,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,36,277,198,12
|
||||
END
|
||||
|
||||
DWBDIALOG DIALOG 33, 99, 250, 56
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "DWB!"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Text",100,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,7,9,237,8
|
||||
CONTROL "Clear",200,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,64,32,50,14
|
||||
CONTROL "Close",201,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,188,33,50,14
|
||||
END
|
||||
|
||||
FKBDIALOG DIALOG 13, 72, 402, 194
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Family Keyboard Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,320,170,56,14
|
||||
CONTROL "Remember to push the \x22Scroll Lock\x22 key during emulation to enable Family Keyboard input.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,18,6,370,12
|
||||
CONTROL "",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,11,22,380,133
|
||||
CONTROL "F1",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,22,43,32,12
|
||||
CONTROL "1",308,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,30,59,16,12
|
||||
CONTROL "F2",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,43,32,12
|
||||
CONTROL "F3",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,98,43,32,12
|
||||
CONTROL "F4",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,136,43,32,12
|
||||
CONTROL "F5",304,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,174,43,32,12
|
||||
CONTROL "F6",305,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,212,43,32,12
|
||||
CONTROL "F7",306,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,250,43,32,12
|
||||
CONTROL "F8",307,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,288,43,32,12
|
||||
CONTROL "2",309,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,49,59,16,12
|
||||
CONTROL "3",310,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,68,59,16,12
|
||||
CONTROL "4",311,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,87,59,16,12
|
||||
CONTROL "5",312,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,106,59,16,12
|
||||
CONTROL "6",313,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,125,59,16,12
|
||||
CONTROL "7",314,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,144,59,16,12
|
||||
CONTROL "8",315,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,163,59,16,12
|
||||
CONTROL "9",316,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,182,59,16,12
|
||||
CONTROL "0",317,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,201,59,16,12
|
||||
CONTROL "-",318,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,220,59,16,12
|
||||
CONTROL "^",319,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,239,59,16,12
|
||||
CONTROL "\\",320,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,258,59,16,12
|
||||
CONTROL "STP",321,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,277,59,16,12
|
||||
CONTROL "ESC",322,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,22,75,16,12
|
||||
CONTROL "Q",323,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,41,75,16,12
|
||||
CONTROL "W",324,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,75,16,12
|
||||
CONTROL "E",325,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,79,75,16,12
|
||||
CONTROL "R",326,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,98,75,16,12
|
||||
CONTROL "T",327,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,117,75,16,12
|
||||
CONTROL "Y",328,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,136,75,16,12
|
||||
CONTROL "U",329,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,155,75,16,12
|
||||
CONTROL "I",330,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,174,75,16,12
|
||||
CONTROL "O",331,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,193,75,16,12
|
||||
CONTROL "P",332,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,212,75,16,12
|
||||
CONTROL "@",333,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,231,75,16,12
|
||||
CONTROL "[",334,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,250,75,16,12
|
||||
CONTROL "RETURN",335,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,272,75,32,12
|
||||
CONTROL "CTR",336,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,26,91,16,12
|
||||
CONTROL "A",337,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,45,91,16,12
|
||||
CONTROL "S",338,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,64,91,16,12
|
||||
CONTROL "D",339,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,83,91,16,12
|
||||
CONTROL "F",340,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,102,91,16,12
|
||||
CONTROL "G",341,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,121,91,16,12
|
||||
CONTROL "H",342,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,140,91,16,12
|
||||
CONTROL "J",343,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,159,91,16,12
|
||||
CONTROL "K",344,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,178,91,16,12
|
||||
CONTROL "L",345,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,197,91,16,12
|
||||
CONTROL ";",346,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,216,91,16,12
|
||||
CONTROL ":",347,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,235,91,16,12
|
||||
CONTROL "]",348,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,254,91,16,12
|
||||
CONTROL "KANA",349,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,273,91,16,12
|
||||
CONTROL "Z",351,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,55,107,16,12
|
||||
CONTROL "X",352,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,74,107,16,12
|
||||
CONTROL "C",353,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,93,107,16,12
|
||||
CONTROL "V",354,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,112,107,16,12
|
||||
CONTROL "B",355,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,131,107,16,12
|
||||
CONTROL "N",356,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,150,107,16,12
|
||||
CONTROL "M",357,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,169,107,16,12
|
||||
CONTROL ",",358,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,188,107,16,12
|
||||
CONTROL ".",359,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,207,107,16,12
|
||||
CONTROL "/",360,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,226,107,16,12
|
||||
CONTROL "",361,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,245,107,16,12
|
||||
CONTROL "SHIFT",350,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,19,107,32,12
|
||||
CONTROL "SHIFT",362,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,265,107,32,12
|
||||
CONTROL "GRPH",363,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,74,123,16,12
|
||||
CONTROL "SPACE",364,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,93,123,149,12
|
||||
CONTROL "CLR",365,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,316,67,16,12
|
||||
CONTROL "INS",366,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,335,67,16,12
|
||||
CONTROL "DEL",367,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,354,67,16,12
|
||||
CONTROL "UP",368,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,327,83,32,12
|
||||
CONTROL "LEFT",369,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,310,99,32,12
|
||||
CONTROL "RIGHT",370,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,346,99,32,12
|
||||
CONTROL "DOWN",371,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,327,115,32,12
|
||||
END
|
||||
|
||||
GAMEPADDIALOG DIALOG 4, 109, 243, 220
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Gamepad Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,173,196,56,14
|
||||
CONTROL "",100,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,4,8,232,82
|
||||
CONTROL "Up",304,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,35,27,24,12
|
||||
CONTROL "Left",306,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,9,45,25,12
|
||||
CONTROL "Right",307,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,45,24,12
|
||||
CONTROL "Down",305,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,35,64,24,12
|
||||
CONTROL "Select",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,91,45,26,12
|
||||
CONTROL "Start",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,126,45,26,12
|
||||
CONTROL "B",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,169,45,16,12
|
||||
CONTROL "A",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,195,45,16,12
|
||||
CONTROL "Turbo B",309,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,154,29,32,12
|
||||
CONTROL "Turbo A",308,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,195,29,32,12
|
||||
CONTROL "",101,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,4,101,232,82
|
||||
CONTROL "Up",314,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,35,120,24,12
|
||||
CONTROL "Left",316,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,9,138,25,12
|
||||
CONTROL "Right",317,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,138,24,12
|
||||
CONTROL "Down",315,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,35,157,24,12
|
||||
CONTROL "Select",312,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,91,138,26,12
|
||||
CONTROL "Start",313,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,126,138,26,12
|
||||
CONTROL "B",311,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,169,138,16,12
|
||||
CONTROL "A",310,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,195,138,16,12
|
||||
CONTROL "Turbo B",319,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,154,122,32,12
|
||||
CONTROL "Turbo A",318,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,195,122,32,12
|
||||
CONTROL "Disable four-score emulation.",400,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_VISIBLE ,9,193,106,12
|
||||
END
|
||||
|
||||
GUICONFIG DIALOG 16, 123, 216, 103
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "GUI Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,153,83,56,14
|
||||
CONTROL "Load \x22File Open\x22 dialog when FCE Ultra starts.",102,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,16,10,198,12
|
||||
CONTROL "Automatically hide menu on game load.",104,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,16,26,198,12
|
||||
CONTROL "Ask confirmation on exit attempt.",110,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,16,42,146,12
|
||||
CONTROL "Disable screen saver while game is loaded.",111,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,16,58,193,12
|
||||
END
|
||||
|
||||
INPUTCONFIG DIALOG 122, 105, 350, 222
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Input Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,266,194,56,14
|
||||
CONTROL "Select the device you want to be enabled on input ports 1 and 2, and the Famicom expansion port. You may configure the device listed above each drop-down list by pressing \x22Configure\x22, if applicable. The device currently being emulated on the each port is listed above the drop down list; loading certain games will override your settings, but only temporarily. If you select a device to be on the emulated Famicom Expansion Port, you should probably have emulated gamepads on the emulated NES-style input ports.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,15,8,320,55
|
||||
CONTROL "Port 1:",102,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,18,80,152,55
|
||||
CONTROL "",104,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,24,109,71,60
|
||||
CONTROL "Configure",106,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,106,95,56,14
|
||||
CONTROL "Port 2:",103,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,178,80,152,55
|
||||
CONTROL "",105,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,184,109,71,60
|
||||
CONTROL "Configure",107,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,266,95,56,14
|
||||
CONTROL "NES-style Input Ports",108,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,10,66,328,79
|
||||
CONTROL "Famicom Expansion Port:",109,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,41,153,165,55
|
||||
CONTROL "",110,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,47,182,84,60
|
||||
CONTROL "Configure",111,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,142,168,56,14
|
||||
CONTROL "",65535,"STATIC",SS_BLACKFRAME |WS_CHILD |WS_VISIBLE ,24,93,71,12
|
||||
CONTROL "",65535,"STATIC",SS_BLACKFRAME |WS_CHILD |WS_VISIBLE ,184,93,71,12
|
||||
CONTROL "",65535,"STATIC",SS_BLACKFRAME |WS_CHILD |WS_VISIBLE ,47,166,84,12
|
||||
CONTROL "",200,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,27,94,65,10
|
||||
CONTROL "",201,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,187,94,65,10
|
||||
CONTROL "",202,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,50,167,78,10
|
||||
END
|
||||
|
||||
MAHJONGDIALOG DIALOG 26, 106, 216, 91
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "mahjong"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,110,73,56,14
|
||||
CONTROL "",302,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,8,8,200,55
|
||||
CONTROL "1",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,72,40,16,12
|
||||
CONTROL "2",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,94,40,16,12
|
||||
CONTROL "3",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,116,40,16,12
|
||||
CONTROL "4",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,138,40,16,12
|
||||
CONTROL "5",304,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,160,40,16,12
|
||||
CONTROL "6",305,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,182,40,16,12
|
||||
END
|
||||
|
||||
MEMVIEW DIALOG 48, 71, 263, 237
|
||||
STYLE DS_SETFONT |DS_MODALFRAME |WS_OVERLAPPED |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Memory Viewer"
|
||||
FONT 8, "Fixedsys"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,200,218,56,14
|
||||
CONTROL "",100,"EDIT",ES_READONLY |ES_MULTILINE |ES_CENTER |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,6,4,237,132
|
||||
CONTROL "",200,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,14,167,19,12
|
||||
CONTROL "",201,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,42,167,14,12
|
||||
CONTROL "Poke Me!",202,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,68,156,42,14
|
||||
CONTROL "Memory Poke",102,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,6,146,111,48
|
||||
CONTROL "",103,"SCROLLBAR",SBS_VERT |WS_CHILD |WS_VISIBLE ,244,4,9,132
|
||||
CONTROL "Memory File Dump",104,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,118,146,143,33
|
||||
CONTROL "",210,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,133,160,19,12
|
||||
CONTROL "",211,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,189,160,19,12
|
||||
CONTROL "through",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,156,162,29,8
|
||||
CONTROL "Dump Me!",212,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,213,159,42,14
|
||||
CONTROL "Memory File Load",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,6,200,102,33
|
||||
CONTROL "",220,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,21,213,19,12
|
||||
CONTROL "Load!",222,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,56,211,42,14
|
||||
CONTROL "HL Store",203,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,68,176,42,14
|
||||
CONTROL "Video Memory File Dump",105,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,118,181,143,33
|
||||
CONTROL "",230,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,134,194,19,12
|
||||
CONTROL "",231,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,190,194,19,12
|
||||
CONTROL "through",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,156,194,29,8
|
||||
CONTROL "Dump Me!",232,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,212,192,42,14
|
||||
END
|
||||
|
||||
MESSAGELOG DIALOG 33, 38, 370, 184
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Message Log"
|
||||
FONT 9, "Terminal"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,299,157,56,14
|
||||
CONTROL "",100,"EDIT",ES_READONLY |ES_AUTOVSCROLL |ES_MULTILINE |ES_LEFT |WS_CHILD |WS_BORDER |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,19,15,339,130
|
||||
END
|
||||
|
||||
NETMOO DIALOG 44, 59, 350, 202
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_OVERLAPPED |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Network Play"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "",102,"EDIT",ES_WANTRETURN |ES_OEMCONVERT |ES_AUTOHSCROLL |ES_AUTOVSCROLL |ES_MULTILINE |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,129,350,12
|
||||
CONTROL "",101,"EDIT",ES_READONLY |ES_AUTOVSCROLL |ES_MULTILINE |ES_LEFT |WS_CHILD |WS_BORDER |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,0,0,350,130
|
||||
CONTROL "Remote Host:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,3,157,48,8
|
||||
CONTROL "",200,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,54,155,90,12
|
||||
CONTROL "",201,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,145,155,27,12
|
||||
CONTROL "Settings",100,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,0,145,350,55
|
||||
CONTROL "Connect",250,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,290,153,56,14
|
||||
CONTROL "",203,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,276,172,70,12
|
||||
CONTROL "Local Players:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,181,157,46,8
|
||||
CONTROL "Nickname:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,232,175,40,8
|
||||
CONTROL "",204,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,232,155,28,51
|
||||
CONTROL "Game Key:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,121,174,39,8
|
||||
CONTROL "",205,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,163,172,67,12
|
||||
CONTROL "Password:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,13,174,37,8
|
||||
CONTROL "",206,"EDIT",ES_PASSWORD |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,54,172,67,12
|
||||
END
|
||||
|
||||
NETPLAYCONFIG DIALOG 33, 49, 230, 200
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Netplay Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,163,173,56,14
|
||||
CONTROL "Network play will commence when a new game is loaded.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,10,5,211,20
|
||||
CONTROL "",101,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,66,66,135,12
|
||||
CONTROL "Client",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,9,34,198,66
|
||||
CONTROL "",100,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,97,47,29,12
|
||||
CONTROL "Enable network play.",300,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,12,170,102,12
|
||||
CONTROL "Server",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,9,110,198,52
|
||||
CONTROL "Listen on TCP port:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,15,125,68,8
|
||||
CONTROL "",200,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,85,124,29,12
|
||||
CONTROL "Local UDP port:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,16,49,62,8
|
||||
CONTROL "Remote host:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,16,68,50,8
|
||||
CONTROL "Remote TCP Port:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,101,84,61,8
|
||||
CONTROL "",102,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,163,82,29,12
|
||||
CONTROL "",302,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,5,34,9,8
|
||||
CONTROL "",301,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,5,110,9,8
|
||||
END
|
||||
|
||||
PALCONFIG DIALOG 16, 81, 216, 141
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Palette Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,151,122,56,14
|
||||
CONTROL "The \x22NES Palette\x22 section's options will only affect NTSC NES games. NTSC Color Emulation will override any loaded custom palette.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,5,6,207,28
|
||||
CONTROL "NES Palette",302,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,1,37,102,81
|
||||
CONTROL "&Load Palette...",200,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,12,55,58,14
|
||||
CONTROL "&Reset to Default Palette",201,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,12,78,85,14
|
||||
CONTROL "Enabled",100,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,113,51,87,12
|
||||
CONTROL "Tint",500,"msctls_trackbar32",WS_CHILD |WS_TABSTOP |WS_VISIBLE ,111,73,91,11
|
||||
CONTROL "NTSC Color Emulation",101,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,106,37,103,81
|
||||
CONTROL "Hue",501,"msctls_trackbar32",WS_CHILD |WS_TABSTOP |WS_VISIBLE ,112,98,91,11
|
||||
CONTROL "Hue",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,115,88,85,8
|
||||
CONTROL "Tint",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,114,63,85,8
|
||||
END
|
||||
|
||||
POWERPADDIALOG DIALOG 30, 123, 131, 119
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Power Pad Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,34,95,56,14
|
||||
CONTROL "",302,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,8,10,114,74
|
||||
CONTROL "1",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,21,23,16,12
|
||||
CONTROL "2",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,43,23,16,12
|
||||
CONTROL "3",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,70,23,16,12
|
||||
CONTROL "4",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,91,23,16,12
|
||||
CONTROL "5",304,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,21,41,16,12
|
||||
CONTROL "6",305,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,43,41,16,12
|
||||
CONTROL "7",306,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,70,41,16,12
|
||||
CONTROL "8",307,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,91,41,16,12
|
||||
CONTROL "9",308,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,21,59,16,12
|
||||
CONTROL "10",309,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,43,59,16,12
|
||||
CONTROL "11",310,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,70,59,16,12
|
||||
CONTROL "12",311,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,91,59,16,12
|
||||
END
|
||||
|
||||
PPUVIEW DIALOG 44, 38, 355, 246
|
||||
STYLE DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "PPU Viewer"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Pattern Tables",101,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,2,-1,351,192
|
||||
CONTROL "Tile:",103,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,6,168,50,10
|
||||
CONTROL "Tile:",104,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,177,168,50,10
|
||||
CONTROL "",201,"msctls_trackbar32",WS_CHILD |WS_TABSTOP |WS_VISIBLE ,227,178,106,11
|
||||
CONTROL "Refresh: More",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,177,178,50,10
|
||||
CONTROL "Less",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,334,178,18,10
|
||||
CONTROL "Palettes",105,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,2,192,351,53
|
||||
CONTROL "Display on scanline:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,6,178,65,10
|
||||
CONTROL "",102,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,72,176,27,12
|
||||
END
|
||||
|
||||
QUIZKINGDIALOG DIALOG 30, 123, 160, 74
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "quiz king"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,54,56,56,14
|
||||
CONTROL "Buzzers",302,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,8,7,144,39
|
||||
CONTROL "1",300,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,16,23,16,12
|
||||
CONTROL "2",301,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,38,23,16,12
|
||||
CONTROL "3",302,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,23,16,12
|
||||
CONTROL "4",303,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,82,23,16,12
|
||||
CONTROL "5",304,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,104,23,16,12
|
||||
CONTROL "6",305,"BUTTON",BS_PUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,126,23,16,12
|
||||
END
|
||||
|
||||
SOUNDCONFIG DIALOG 8, 95, 371, 152
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Sound Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,304,132,56,14
|
||||
CONTROL "Set various sound options here. The default sound buffering length is rather conservative. Lower settings are probably possible and will reduce sound latency.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,4,350,19
|
||||
CONTROL "Output/Output Format:",302,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,12,30,130,93
|
||||
CONTROL "Sound enabled.",126,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,48,117,12
|
||||
CONTROL "Force 8-bit sound.",122,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,63,117,11
|
||||
CONTROL "Rate:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,106,34,10
|
||||
CONTROL "Hz",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,118,107,15,9
|
||||
CONTROL "Buffering:",127,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,154,30,126,97
|
||||
CONTROL "Use secondary sound buffer...",123,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,162,44,112,12
|
||||
CONTROL "...with global focus.",124,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,170,56,100,12
|
||||
CONTROL "Length of Sound to Buffer:",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,164,73,107,8
|
||||
CONTROL "",128,"msctls_trackbar32",WS_CHILD |WS_TABSTOP |WS_VISIBLE ,164,98,107,13
|
||||
CONTROL "Volume",125,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,298,29,58,86
|
||||
CONTROL "",500,"msctls_trackbar32",WS_CHILD |WS_TABSTOP |WS_VISIBLE |0xB,312,38,28,75
|
||||
CONTROL "15 ms",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,161,112,20,8
|
||||
CONTROL "200 ms",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,252,112,25,8
|
||||
CONTROL "ms",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,217,86,19,8
|
||||
CONTROL "",666,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,195,86,20,8
|
||||
CONTROL "",200,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,59,104,53,46
|
||||
CONTROL "",129,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,59,79,77,46
|
||||
CONTROL "Quality:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,20,80,35,10
|
||||
END
|
||||
|
||||
SUBORKBDIALOG DIALOGEX 13, 72, 478, 171
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Subor Keyboard Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",1,405,151,56,14
|
||||
LTEXT "Remember to push the ""Scroll Lock"" key during emulation to enable Keyboard input.",-1,18,6,370,12
|
||||
GROUPBOX "",-1,9,22,461,123,WS_GROUP
|
||||
PUSHBUTTON "Esc",300,20,36,16,12
|
||||
PUSHBUTTON "F1",301,58,37,16,12
|
||||
PUSHBUTTON "F2",302,78,37,16,12
|
||||
PUSHBUTTON "F3",303,98,37,16,12
|
||||
PUSHBUTTON "F4",304,118,37,16,12
|
||||
PUSHBUTTON "F5",305,143,37,16,12
|
||||
PUSHBUTTON "F6",306,163,37,16,12
|
||||
PUSHBUTTON "F7",307,183,37,16,12
|
||||
PUSHBUTTON "F8",308,203,37,16,12
|
||||
PUSHBUTTON "F9",309,229,37,16,12
|
||||
PUSHBUTTON "F10",310,249,37,16,12
|
||||
PUSHBUTTON "F11",311,268,37,16,12
|
||||
PUSHBUTTON "F12",312,288,37,16,12
|
||||
PUSHBUTTON "Pause",313,318,36,16,12
|
||||
PUSHBUTTON "`",314,20,60,16,12
|
||||
PUSHBUTTON "1",315,39,60,16,12
|
||||
PUSHBUTTON "2",316,58,60,16,12
|
||||
PUSHBUTTON "3",317,77,60,16,12
|
||||
PUSHBUTTON "4",318,96,60,16,12
|
||||
PUSHBUTTON "5",319,115,60,16,12
|
||||
PUSHBUTTON "6",320,134,60,16,12
|
||||
PUSHBUTTON "7",321,153,60,16,12
|
||||
PUSHBUTTON "8",322,172,60,16,12
|
||||
PUSHBUTTON "9",323,191,60,16,12
|
||||
PUSHBUTTON "0",324,210,60,16,12
|
||||
PUSHBUTTON "-",325,229,60,16,12
|
||||
PUSHBUTTON "=",326,248,60,16,12
|
||||
PUSHBUTTON "BS",327,286,60,16,12
|
||||
PUSHBUTTON "Ins",328,318,59,16,12
|
||||
PUSHBUTTON "Home",329,337,59,16,12
|
||||
PUSHBUTTON "NL",330,385,59,16,12
|
||||
PUSHBUTTON "/",331,405,59,16,12
|
||||
PUSHBUTTON "*",332,425,59,16,12
|
||||
PUSHBUTTON "-",333,444,59,16,12
|
||||
PUSHBUTTON "PUp",334,357,59,16,12
|
||||
PUSHBUTTON "TAB",335,20,76,24,12
|
||||
PUSHBUTTON "Q",336,47,76,16,12
|
||||
PUSHBUTTON "W",337,66,76,16,12
|
||||
PUSHBUTTON "E",338,85,76,16,12
|
||||
PUSHBUTTON "R",339,104,76,16,12
|
||||
PUSHBUTTON "T",340,123,76,16,12
|
||||
PUSHBUTTON "Y",341,142,76,16,12
|
||||
PUSHBUTTON "U",342,161,76,16,12
|
||||
PUSHBUTTON "I",343,180,76,16,12
|
||||
PUSHBUTTON "O",344,199,76,16,12
|
||||
PUSHBUTTON "P",345,218,76,16,12
|
||||
PUSHBUTTON "[",346,237,76,16,12
|
||||
PUSHBUTTON "]",347,256,76,16,12
|
||||
PUSHBUTTON "Enter",348,274,76,28,29
|
||||
PUSHBUTTON "Del",349,318,75,16,12
|
||||
PUSHBUTTON "End",350,338,75,16,12
|
||||
PUSHBUTTON "PDn",351,357,75,16,12
|
||||
PUSHBUTTON "7",352,385,75,16,12
|
||||
PUSHBUTTON "8",353,405,75,16,12
|
||||
PUSHBUTTON "9",354,425,75,16,12
|
||||
PUSHBUTTON "+",355,444,75,16,28
|
||||
PUSHBUTTON "CL",356,20,92,27,12
|
||||
PUSHBUTTON "A",357,52,92,16,12
|
||||
PUSHBUTTON "S",358,71,92,16,12
|
||||
PUSHBUTTON "D",359,90,92,16,12
|
||||
PUSHBUTTON "F",360,109,92,16,12
|
||||
PUSHBUTTON "G",361,128,92,16,12
|
||||
PUSHBUTTON "H",362,147,92,16,12
|
||||
PUSHBUTTON "J",363,166,92,16,12
|
||||
PUSHBUTTON "K",364,185,92,16,12
|
||||
PUSHBUTTON "L",365,204,92,16,12
|
||||
PUSHBUTTON ";",366,223,92,16,12
|
||||
PUSHBUTTON "'",367,242,92,16,12
|
||||
PUSHBUTTON "4",368,385,91,16,12
|
||||
PUSHBUTTON "5",369,405,91,16,12
|
||||
PUSHBUTTON "6",370,425,91,16,12
|
||||
PUSHBUTTON "SHIFT",371,20,108,37,12
|
||||
PUSHBUTTON "Z",372,62,108,16,12
|
||||
PUSHBUTTON "X",373,81,108,16,12
|
||||
PUSHBUTTON "C",374,100,108,16,12
|
||||
PUSHBUTTON "V",375,119,108,16,12
|
||||
PUSHBUTTON "B",376,138,108,16,12
|
||||
PUSHBUTTON "N",377,157,108,16,12
|
||||
PUSHBUTTON "M",378,176,108,16,12
|
||||
PUSHBUTTON ",",379,195,108,16,12
|
||||
PUSHBUTTON ".",380,214,108,16,12
|
||||
PUSHBUTTON "/",381,233,108,16,12
|
||||
PUSHBUTTON "\\",382,267,60,16,12
|
||||
PUSHBUTTON "Up",383,337,108,16,12
|
||||
PUSHBUTTON "1",384,385,107,16,12
|
||||
PUSHBUTTON "2",385,405,107,16,12
|
||||
PUSHBUTTON "3",386,425,107,16,12
|
||||
PUSHBUTTON "CTRL",387,20,123,28,12
|
||||
PUSHBUTTON "ALT",388,66,123,27,12
|
||||
PUSHBUTTON "SPACE",389,96,123,130,12
|
||||
PUSHBUTTON "Left",390,318,123,16,12
|
||||
PUSHBUTTON "Dn",391,337,123,16,12
|
||||
PUSHBUTTON "Right",392,357,123,16,12
|
||||
PUSHBUTTON "0",393,386,123,35,12
|
||||
PUSHBUTTON ".",394,425,123,16,12
|
||||
PUSHBUTTON "SHIFT",395,254,108,48,12
|
||||
PUSHBUTTON "ALT",396,229,123,29,12
|
||||
PUSHBUTTON "CTRL",397,274,123,28,12
|
||||
PUSHBUTTON "Break",398,337,36,16,12
|
||||
PUSHBUTTON "Reset",399,357,36,16,12
|
||||
PUSHBUTTON "Enter",400,444,107,16,28
|
||||
END
|
||||
|
||||
TIMINGCONFIG DIALOG 23, 157, 198, 78
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Timing Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,126,54,56,14
|
||||
CONTROL "Disable speed throttling used when sound is disabled.",101,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,9,12,198,12
|
||||
CONTROL "Set high-priority thread.",105,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,9,28,146,12
|
||||
END
|
||||
|
||||
VIDEOCONFIG DIALOG 16, 76, 378, 296
|
||||
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
|
||||
CAPTION "Video Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "For the custom video mode settings to be in effect, the \x22Custom\x22 video mode needs to be selected. If you select a sync method, and sound is disabled, you may want to disable speed throttling(in the \x22Timing\x22 window). If you use \x22wait for vblank\x22, you should use the \x22lazy\x22 form.\x0AAllowing more than 8 sprites per scanline can cause graphics corruption in some games, including \x22Solstice\x22.",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,11,4,347,43
|
||||
CONTROL "Full Screen Settings",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,13,50,346,112
|
||||
CONTROL "Full Screen",101,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,23,64,60,12
|
||||
CONTROL "Enter full screen mode after file is loaded.",102,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,23,79,141,12
|
||||
CONTROL "Sync Method:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,19,97,52,10
|
||||
CONTROL "",105,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,76,94,89,50
|
||||
CONTROL "Video Mode:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,19,113,42,10
|
||||
CONTROL "",100,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,64,112,101,52
|
||||
CONTROL "Disable hardware acceleration.",131,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,142,147,12
|
||||
CONTROL "Custom Video Mode",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,169,60,190,99
|
||||
CONTROL "Mode:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,177,73,25,8
|
||||
CONTROL "",200,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,205,71,27,12
|
||||
CONTROL "by",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,236,73,11,8
|
||||
CONTROL "",201,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,249,71,27,12
|
||||
CONTROL "@",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,280,73,12,8
|
||||
CONTROL "",202,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,292,70,35,60
|
||||
CONTROL "bpp",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,332,72,24,8
|
||||
CONTROL "Image Size Transform",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,175,97,170,60
|
||||
CONTROL "Special scaler:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,183,112,60,8
|
||||
CONTROL "",304,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,286,109,49,46
|
||||
CONTROL "Scale dimensions by:",300,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,184,127,85,12
|
||||
CONTROL "Stretch to Fill Screen",301,"BUTTON",BS_AUTORADIOBUTTON |WS_CHILD |WS_VISIBLE ,184,142,88,12
|
||||
CONTROL "X:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,273,130,10,8
|
||||
CONTROL "",302,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,283,127,20,12
|
||||
CONTROL "Y:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,307,130,11,8
|
||||
CONTROL "",303,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,317,127,20,12
|
||||
CONTROL "Windowed Settings",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,13,165,167,118
|
||||
CONTROL "Size Multiplier:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,18,192,60,8
|
||||
CONTROL "X:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,74,192,11,8
|
||||
CONTROL "Y:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,126,192,11,8
|
||||
CONTROL "",400,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,89,190,35,12
|
||||
CONTROL "",401,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,141,190,35,12
|
||||
CONTROL "Force integral scaling factors.",402,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,203,147,12
|
||||
CONTROL "Force aspect ratio correction.",403,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,217,147,12
|
||||
CONTROL "Sync Method:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,19,250,60,8
|
||||
CONTROL "",104,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,83,248,88,47
|
||||
CONTROL "Disable hardware acceleration.",130,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,20,264,147,12
|
||||
CONTROL "Drawing Area",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,184,165,172,74
|
||||
CONTROL "First Line:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,201,189,39,8
|
||||
CONTROL "Last Line:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,201,209,43,8
|
||||
CONTROL "NTSC",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,244,176,26,8
|
||||
CONTROL "PAL",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,295,176,26,8
|
||||
CONTROL "",500,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,246,188,27,12
|
||||
CONTROL "",501,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,246,207,27,12
|
||||
CONTROL "",502,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,296,188,27,12
|
||||
CONTROL "",503,"EDIT",ES_RIGHT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,296,207,27,12
|
||||
CONTROL "Clip left and right sides(8 columns on each).",106,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,195,224,157,12
|
||||
CONTROL "Close",1,"BUTTON",BS_DEFPUSHBUTTON |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,321,282,56,14
|
||||
CONTROL "Current Pixel Aspect Ratio:",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,21,232,92,8
|
||||
CONTROL "",404,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,120,231,23,12
|
||||
CONTROL ":",65535,"STATIC",SS_CENTER |WS_CHILD |WS_GROUP |WS_VISIBLE ,145,233,8,8
|
||||
CONTROL "",405,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,154,231,22,12
|
||||
CONTROL "Allow more than 8 sprites per scanline.",600,"BUTTON",BS_AUTOCHECKBOX |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,194,256,136,11
|
||||
CONTROL "Emulation",65535,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_GROUP |WS_VISIBLE ,184,243,172,32
|
||||
CONTROL "Special Scaler:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_GROUP |WS_VISIBLE ,18,177,60,8
|
||||
CONTROL "",406,"COMBOBOX",CBS_DROPDOWNLIST |WS_CHILD |WS_VSCROLL |WS_TABSTOP |WS_VISIBLE ,113,176,49,46
|
||||
END
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB |
@@ -1,483 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
LPDIRECTSOUND ppDS = 0; /* DirectSound object. */
|
||||
LPDIRECTSOUNDBUFFER ppbuf = 0; /* Primary buffer object. */
|
||||
LPDIRECTSOUNDBUFFER ppbufsec = 0; /* Secondary buffer object. */
|
||||
LPDIRECTSOUNDBUFFER ppbufw; /* Buffer to actually write to. */
|
||||
|
||||
long DSBufferSize; /* The size of the buffer that we can write to, in bytes. */
|
||||
|
||||
long BufHowMuch; /* How many bytes we should try to buffer. */
|
||||
DWORD ToWritePos; /* Position which the next write to the buffer
|
||||
should write to. */
|
||||
|
||||
|
||||
|
||||
DSBUFFERDESC DSBufferDesc;
|
||||
WAVEFORMATEX wfa;
|
||||
WAVEFORMATEX wf;
|
||||
|
||||
static int bittage;
|
||||
|
||||
void TrashSound(void) {
|
||||
FCEUI_Sound(0);
|
||||
if (ppbufsec) {
|
||||
IDirectSoundBuffer_Stop(ppbufsec);
|
||||
IDirectSoundBuffer_Release(ppbufsec);
|
||||
ppbufsec = 0;
|
||||
}
|
||||
if (ppbuf) {
|
||||
IDirectSoundBuffer_Stop(ppbuf);
|
||||
IDirectSoundBuffer_Release(ppbuf);
|
||||
ppbuf = 0;
|
||||
}
|
||||
if (ppDS) {
|
||||
IDirectSound_Release(ppDS);
|
||||
ppDS = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckDStatus(void) {
|
||||
DWORD status;
|
||||
status = 0;
|
||||
IDirectSoundBuffer_GetStatus(ppbufw, &status);
|
||||
|
||||
if (status & DSBSTATUS_BUFFERLOST) {
|
||||
IDirectSoundBuffer_Restore(ppbufw);
|
||||
}
|
||||
|
||||
if (!(status & DSBSTATUS_PLAYING)) {
|
||||
ToWritePos = 0;
|
||||
IDirectSoundBuffer_SetFormat(ppbufw, &wf);
|
||||
IDirectSoundBuffer_Play(ppbufw, 0, 0, DSBPLAY_LOOPING);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t RawCanWrite(void) {
|
||||
DWORD CurWritePos, CurPlayPos = 0;
|
||||
|
||||
CheckDStatus();
|
||||
|
||||
CurWritePos = 0;
|
||||
|
||||
if (IDirectSoundBuffer_GetCurrentPosition(ppbufw, &CurPlayPos, &CurWritePos) == DS_OK) {
|
||||
// FCEU_DispMessage("%8d",(CurWritePos-CurPlayPos));
|
||||
}
|
||||
CurWritePos = (CurPlayPos + BufHowMuch) % DSBufferSize;
|
||||
|
||||
/* If the current write pos is >= half the buffer size less than the to write pos,
|
||||
assume DirectSound has wrapped around.
|
||||
*/
|
||||
|
||||
if (((int32_t)ToWritePos - (int32_t)CurWritePos) >= (DSBufferSize / 2)) {
|
||||
CurWritePos += DSBufferSize;
|
||||
//FCEU_printf("Fixit: %d,%d,%d\n",ToWritePos,CurWritePos,CurWritePos-DSBufferSize);
|
||||
}
|
||||
if (ToWritePos < CurWritePos) {
|
||||
int32_t howmuch = (int32_t)CurWritePos - (int32_t)ToWritePos;
|
||||
if (howmuch > BufHowMuch) { /* Oopsie. Severe buffer overflow... */
|
||||
//FCEU_printf("Ack");
|
||||
ToWritePos = CurWritePos % DSBufferSize;
|
||||
}
|
||||
return(CurWritePos - ToWritePos);
|
||||
} else
|
||||
return(0);
|
||||
}
|
||||
|
||||
int32 GetWriteSound(void) {
|
||||
return(RawCanWrite() >> bittage);
|
||||
}
|
||||
|
||||
int32 GetMaxSound(void) {
|
||||
return(BufHowMuch >> bittage);
|
||||
}
|
||||
|
||||
static int RawWrite(void *data, uint32_t len) {
|
||||
// uint32_t cw;
|
||||
|
||||
//printf("Pre: %d\n",SexyALI_DSound_RawCanWrite(device));
|
||||
//fflush(stdout);
|
||||
|
||||
CheckDStatus();
|
||||
/* In this block, we write as much data as we can, then we write
|
||||
the rest of it in >=1ms chunks.
|
||||
*/
|
||||
while (len) {
|
||||
VOID *LockPtr[2] = { 0, 0 };
|
||||
DWORD LockLen[2] = { 0, 0 };
|
||||
int32_t curlen;
|
||||
|
||||
while (!(curlen = RawCanWrite())) {
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
if (curlen > len) curlen = len;
|
||||
|
||||
if (DS_OK == IDirectSoundBuffer_Lock(ppbufw, ToWritePos, curlen, &LockPtr[0], &LockLen[0], &LockPtr[1], &LockLen[1], 0)) {
|
||||
}
|
||||
|
||||
if (LockPtr[1] != 0 && LockPtr[1] != LockPtr[0]) {
|
||||
memcpy(LockPtr[0], data, LockLen[0]);
|
||||
memcpy(LockPtr[1], data + LockLen[0], len - LockLen[0]);
|
||||
} else if (LockPtr[0]) {
|
||||
memcpy(LockPtr[0], data, curlen);
|
||||
}
|
||||
IDirectSoundBuffer_Unlock(ppbufw, LockPtr[0], LockLen[0], LockPtr[1], LockLen[1]);
|
||||
ToWritePos = (ToWritePos + curlen) % DSBufferSize;
|
||||
|
||||
len -= curlen;
|
||||
data = (void*)((uint8_t*)data + curlen);
|
||||
if (len)
|
||||
Sleep(1);
|
||||
} // end while(len) loop
|
||||
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
void FCEUD_WriteSoundData(int32 *Buffer, int Count) {
|
||||
static int16 MBuffer[2 * 96000 / 50]; /* * 2 for safety. */
|
||||
int P;
|
||||
|
||||
if (!bittage) {
|
||||
for (P = 0; P < Count; P++)
|
||||
*(((uint8*)MBuffer) + P) = ((int8)(Buffer[P] >> 8)) ^ 128;
|
||||
RawWrite(MBuffer, Count);
|
||||
} else {
|
||||
for (P = 0; P < Count; P++)
|
||||
MBuffer[P] = Buffer[P];
|
||||
//FCEU_printf("Pre: %d\n",RawCanWrite() / 2);
|
||||
RawWrite(MBuffer, Count * 2);
|
||||
//FCEU_printf("Post: %d\n",RawCanWrite() / 2);
|
||||
}
|
||||
}
|
||||
|
||||
int InitSound() {
|
||||
DSCAPS dscaps;
|
||||
DSBCAPS dsbcaps;
|
||||
|
||||
memset(&wf, 0x00, sizeof(wf));
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wf.nChannels = 1;
|
||||
wf.nSamplesPerSec = soundrate;
|
||||
|
||||
ddrval = DirectSoundCreate(0, &ppDS, 0);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error creating DirectSound object.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (soundoptions & SO_SECONDARY) {
|
||||
trysecondary:
|
||||
ddrval = IDirectSound_SetCooperativeLevel(ppDS, hAppWnd, DSSCL_PRIORITY);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error setting cooperative level to DDSCL_PRIORITY.");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
ddrval = IDirectSound_SetCooperativeLevel(ppDS, hAppWnd, DSSCL_WRITEPRIMARY);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error setting cooperative level to DDSCL_WRITEPRIMARY. Forcing use of secondary sound buffer and trying again...");
|
||||
soundoptions |= SO_SECONDARY;
|
||||
goto trysecondary;
|
||||
}
|
||||
}
|
||||
memset(&dscaps, 0x00, sizeof(dscaps));
|
||||
dscaps.dwSize = sizeof(dscaps);
|
||||
ddrval = IDirectSound_GetCaps(ppDS, &dscaps);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error getting capabilities.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dscaps.dwFlags & DSCAPS_EMULDRIVER)
|
||||
FCEUD_PrintError("DirectSound: Sound device is being emulated through waveform-audio functions. Sound quality will most likely be awful. Try to update your sound device's sound drivers.");
|
||||
|
||||
IDirectSound_Compact(ppDS);
|
||||
|
||||
memset(&DSBufferDesc, 0x00, sizeof(DSBUFFERDESC));
|
||||
DSBufferDesc.dwSize = sizeof(DSBufferDesc);
|
||||
if (soundoptions & SO_SECONDARY)
|
||||
DSBufferDesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
else
|
||||
DSBufferDesc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GETCURRENTPOSITION2;
|
||||
|
||||
ddrval = IDirectSound_CreateSoundBuffer(ppDS, &DSBufferDesc, &ppbuf, 0);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error creating primary buffer.");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&wfa, 0x00, sizeof(wfa));
|
||||
|
||||
if (soundoptions & SO_FORCE8BIT)
|
||||
bittage = 0;
|
||||
else {
|
||||
bittage = 1;
|
||||
if ((!(dscaps.dwFlags & DSCAPS_PRIMARY16BIT) && !(soundoptions & SO_SECONDARY)) ||
|
||||
(!(dscaps.dwFlags & DSCAPS_SECONDARY16BIT) && (soundoptions & SO_SECONDARY))) {
|
||||
FCEUD_PrintError("DirectSound: 16-bit sound is not supported. Forcing 8-bit sound.");
|
||||
bittage = 0;
|
||||
soundoptions |= SO_FORCE8BIT;
|
||||
}
|
||||
}
|
||||
|
||||
wf.wBitsPerSample = 8 << bittage;
|
||||
wf.nBlockAlign = bittage + 1;
|
||||
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
|
||||
|
||||
ddrval = IDirectSoundBuffer_SetFormat(ppbuf, &wf);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error setting primary buffer format.");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDirectSoundBuffer_GetFormat(ppbuf, &wfa, sizeof(wfa), 0);
|
||||
|
||||
if (soundoptions & SO_SECONDARY) {
|
||||
memset(&DSBufferDesc, 0x00, sizeof(DSBUFFERDESC));
|
||||
DSBufferDesc.dwSize = sizeof(DSBufferDesc);
|
||||
DSBufferDesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
|
||||
if (soundoptions & SO_GFOCUS)
|
||||
DSBufferDesc.dwFlags |= DSBCAPS_GLOBALFOCUS;
|
||||
DSBufferDesc.dwBufferBytes = 65536;
|
||||
DSBufferDesc.lpwfxFormat = &wfa;
|
||||
ddrval = IDirectSound_CreateSoundBuffer(ppDS, &DSBufferDesc, &ppbufsec, 0);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error creating secondary buffer.");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//sprintf(TempArray,"%d\n",wfa.nSamplesPerSec);
|
||||
//FCEUD_PrintError(TempArray);
|
||||
|
||||
if (soundoptions & SO_SECONDARY) {
|
||||
DSBufferSize = 65536;
|
||||
IDirectSoundBuffer_SetCurrentPosition(ppbufsec, 0);
|
||||
ppbufw = ppbufsec;
|
||||
} else {
|
||||
memset(&dsbcaps, 0, sizeof(dsbcaps));
|
||||
dsbcaps.dwSize = sizeof(dsbcaps);
|
||||
ddrval = IDirectSoundBuffer_GetCaps(ppbuf, &dsbcaps);
|
||||
if (ddrval != DS_OK) {
|
||||
FCEUD_PrintError("DirectSound: Error getting buffer capabilities.");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DSBufferSize = dsbcaps.dwBufferBytes;
|
||||
|
||||
if (DSBufferSize < 8192) {
|
||||
FCEUD_PrintError("DirectSound: Primary buffer size is too small!");
|
||||
TrashSound();
|
||||
return 0;
|
||||
}
|
||||
ppbufw = ppbuf;
|
||||
}
|
||||
|
||||
BufHowMuch = (soundbuftime * soundrate / 1000) << bittage;
|
||||
FCEUI_Sound(soundrate);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HWND uug = 0;
|
||||
|
||||
static void UpdateSD(HWND hwndDlg) {
|
||||
int t;
|
||||
|
||||
CheckDlgButton(hwndDlg, 126, soundo ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwndDlg, 122, (soundoptions & SO_FORCE8BIT) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwndDlg, 123, (soundoptions & SO_SECONDARY) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwndDlg, 124, (soundoptions & SO_GFOCUS) ? BST_CHECKED : BST_UNCHECKED);
|
||||
SendDlgItemMessage(hwndDlg, 129, CB_SETCURSEL, soundquality, (LPARAM)(LPSTR)0);
|
||||
t = 0;
|
||||
if (soundrate == 22050) t = 1;
|
||||
else if (soundrate == 44100) t = 2;
|
||||
else if (soundrate == 48000) t = 3;
|
||||
else if (soundrate == 96000) t = 4;
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_SETCURSEL, t, (LPARAM)(LPSTR)0);
|
||||
}
|
||||
|
||||
BOOL CALLBACK SoundConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (uMsg) {
|
||||
case WM_NCRBUTTONDOWN:
|
||||
case WM_NCMBUTTONDOWN:
|
||||
case WM_NCLBUTTONDOWN: StopSound(); break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
/* Volume Trackbar */
|
||||
SendDlgItemMessage(hwndDlg, 500, TBM_SETRANGE, 1, MAKELONG(0, 150));
|
||||
SendDlgItemMessage(hwndDlg, 500, TBM_SETTICFREQ, 25, 0);
|
||||
SendDlgItemMessage(hwndDlg, 500, TBM_SETPOS, 1, 150 - soundvolume);
|
||||
|
||||
/* buffer size time trackbar */
|
||||
SendDlgItemMessage(hwndDlg, 128, TBM_SETRANGE, 1, MAKELONG(15, 200));
|
||||
SendDlgItemMessage(hwndDlg, 128, TBM_SETTICFREQ, 1, 0);
|
||||
SendDlgItemMessage(hwndDlg, 128, TBM_SETPOS, 1, soundbuftime);
|
||||
|
||||
{
|
||||
char tbuf[8];
|
||||
sprintf(tbuf, "%d", soundbuftime);
|
||||
SetDlgItemText(hwndDlg, 666, (LPTSTR)tbuf);
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 129, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Low");
|
||||
SendDlgItemMessage(hwndDlg, 129, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"High");
|
||||
SendDlgItemMessage(hwndDlg, 129, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Highest");
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"11025");
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"22050");
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"44100");
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"48000");
|
||||
SendDlgItemMessage(hwndDlg, 200, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"96000");
|
||||
|
||||
UpdateSD(hwndDlg);
|
||||
break;
|
||||
case WM_VSCROLL:
|
||||
soundvolume = 150 - SendDlgItemMessage(hwndDlg, 500, TBM_GETPOS, 0, 0);
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
char tbuf[8];
|
||||
soundbuftime = SendDlgItemMessage(hwndDlg, 128, TBM_GETPOS, 0, 0);
|
||||
sprintf(tbuf, "%d", soundbuftime);
|
||||
SetDlgItemText(hwndDlg, 666, (LPTSTR)tbuf);
|
||||
BufHowMuch = (soundbuftime * soundrate / 1000) << bittage;
|
||||
//soundbufsize=(soundbuftime*soundrate/1000);
|
||||
}
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT: goto gornk;
|
||||
case WM_COMMAND:
|
||||
switch (HIWORD(wParam)) {
|
||||
case CBN_SELENDOK:
|
||||
switch (LOWORD(wParam)) {
|
||||
case 200:
|
||||
{
|
||||
int tmp;
|
||||
tmp = SendDlgItemMessage(hwndDlg, 200, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
if (tmp == 0) tmp = 11025;
|
||||
else if (tmp == 1) tmp = 22050;
|
||||
else if (tmp == 2) tmp = 44100;
|
||||
else if (tmp == 3) tmp = 48000;
|
||||
else tmp = 96000;
|
||||
if (tmp != soundrate) {
|
||||
soundrate = tmp;
|
||||
if (soundrate < 44100) {
|
||||
soundquality = 0;
|
||||
FCEUI_SetSoundQuality(0);
|
||||
UpdateSD(hwndDlg);
|
||||
}
|
||||
if (soundo) {
|
||||
TrashSound();
|
||||
soundo = InitSound();
|
||||
UpdateSD(hwndDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 129:
|
||||
soundquality = SendDlgItemMessage(hwndDlg, 129, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
if (soundrate < 44100) soundquality = 0;
|
||||
FCEUI_SetSoundQuality(soundquality);
|
||||
UpdateSD(hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case BN_CLICKED:
|
||||
switch (LOWORD(wParam)) {
|
||||
case 122: soundoptions ^= SO_FORCE8BIT;
|
||||
if (soundo) {
|
||||
TrashSound();
|
||||
soundo = InitSound();
|
||||
UpdateSD(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case 123: soundoptions ^= SO_SECONDARY;
|
||||
if (soundo) {
|
||||
TrashSound();
|
||||
soundo = InitSound();
|
||||
UpdateSD(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case 124: soundoptions ^= SO_GFOCUS;
|
||||
if (soundo) {
|
||||
TrashSound();
|
||||
soundo = InitSound();
|
||||
UpdateSD(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case 126: soundo = !soundo;
|
||||
if (!soundo) TrashSound();
|
||||
else soundo = InitSound();
|
||||
UpdateSD(hwndDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(wParam >> 16))
|
||||
switch (wParam & 0xFFFF) {
|
||||
case 1:
|
||||
gornk:
|
||||
DestroyWindow(hwndDlg);
|
||||
uug = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ConfigSound(void) {
|
||||
if (!uug)
|
||||
uug = CreateDialog(fceu_hInstance, "SOUNDCONFIG", 0, SoundConCallB);
|
||||
else
|
||||
SetFocus(uug);
|
||||
}
|
||||
|
||||
|
||||
void StopSound(void) {
|
||||
if (soundo) {
|
||||
VOID *LockPtr = 0;
|
||||
DWORD LockLen = 0;
|
||||
if (DS_OK == IDirectSoundBuffer_Lock(ppbufw, 0, DSBufferSize, &LockPtr, &LockLen, 0, 0, 0)) {
|
||||
//FCEUD_PrintError("K");
|
||||
if (bittage)
|
||||
memset(LockPtr, 0, LockLen);
|
||||
else
|
||||
memset(LockPtr, 0x80, LockLen);
|
||||
IDirectSoundBuffer_Unlock(ppbufw, LockPtr, LockLen, 0, 0);
|
||||
}
|
||||
|
||||
//IDirectSoundBuffer_Stop(ppbufw);
|
||||
}
|
||||
}
|
||||
|
||||
#include "wave.c"
|
||||
@@ -1,36 +0,0 @@
|
||||
void SaveStateAs(void) {
|
||||
const char filter[] = "FCE Ultra Save State(*.fc?)\0*.fc?\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Save State As...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetSaveFileName(&ofn))
|
||||
FCEUI_SaveState(nameo);
|
||||
}
|
||||
|
||||
void LoadStateFrom(void) {
|
||||
const char filter[] = "FCE Ultra Save State(*.fc?)\0*.fc?\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Load State From...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetOpenFileName(&ofn))
|
||||
FCEUI_LoadState(nameo);
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
static uint64 tmethod, tfreq;
|
||||
static uint64 desiredfps;
|
||||
|
||||
static void RefreshThrottleFPS(void) {
|
||||
desiredfps = FCEUI_GetDesiredFPS() >> 8;
|
||||
}
|
||||
|
||||
static uint64 GetCurTime(void) {
|
||||
if (tmethod) {
|
||||
uint64 tmp;
|
||||
|
||||
/* Practically, LARGE_INTEGER and uint64 differ only by signness and name. */
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&tmp);
|
||||
|
||||
return(tmp);
|
||||
} else
|
||||
return((uint64)GetTickCount());
|
||||
}
|
||||
|
||||
static void InitSpeedThrottle(void) {
|
||||
tmethod = 0;
|
||||
if (QueryPerformanceFrequency((LARGE_INTEGER*)&tfreq)) {
|
||||
tmethod = 1;
|
||||
} else
|
||||
tfreq = 1000;
|
||||
tfreq <<= 16; /* Adjustment for fps returned from FCEUI_GetDesiredFPS(). */
|
||||
}
|
||||
|
||||
|
||||
static int SpeedThrottle(void) {
|
||||
static uint64 ttime, ltime;
|
||||
|
||||
waiter:
|
||||
|
||||
ttime = GetCurTime();
|
||||
|
||||
|
||||
if ((ttime - ltime) < (tfreq / desiredfps)) {
|
||||
uint64 sleepy;
|
||||
sleepy = (tfreq / desiredfps) - (ttime - ltime);
|
||||
sleepy *= 1000;
|
||||
sleepy /= tfreq >> 16;
|
||||
Sleep(sleepy);
|
||||
goto waiter;
|
||||
}
|
||||
if ((ttime - ltime) >= (tfreq * 4 / desiredfps))
|
||||
ltime = ttime;
|
||||
else {
|
||||
ltime += tfreq / desiredfps;
|
||||
|
||||
if ((ttime - ltime) >= (tfreq / desiredfps))// Oops, we're behind!
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
// Quick code for internal FPS display.
|
||||
uint64 FCEUD_GetTime(void) {
|
||||
return(GetCurTime());
|
||||
}
|
||||
uint64 FCEUD_GetTimeFreq(void) {
|
||||
return(tfreq >> 16);
|
||||
}
|
||||
|
||||
@@ -1,994 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
static int RecalcCustom(void);
|
||||
|
||||
#define VF_DDSTRETCHED 1
|
||||
|
||||
#define VEF_LOSTSURFACE 1
|
||||
#define VEF____INTERNAL 2
|
||||
|
||||
#define VMDF_DXBLT 1
|
||||
#define VMDF_STRFS 2
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int bpp;
|
||||
int flags;
|
||||
int xscale;
|
||||
int yscale;
|
||||
RECT srect;
|
||||
RECT drect;
|
||||
int special;
|
||||
} vmdef;
|
||||
|
||||
// left, top, right, bottom
|
||||
static vmdef vmodes[11] = {
|
||||
{ 320, 240, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //0
|
||||
{ 320, 240, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //1
|
||||
{ 512, 384, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //2
|
||||
{ 640, 480, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //3
|
||||
{ 640, 480, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //4
|
||||
{ 640, 480, 8, 0, 1, 1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //5
|
||||
{ 640, 480, 8, VMDF_DXBLT, 2, 2, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //6
|
||||
{ 1024, 768, 8, VMDF_DXBLT, 4, 3, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //7
|
||||
{ 1280, 1024, 8, VMDF_DXBLT, 5, 4, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //8
|
||||
{ 1600, 1200, 8, VMDF_DXBLT, 6, 5, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 }, //9
|
||||
{ 800, 600, 8, VMDF_DXBLT | VMDF_STRFS, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0 } //10
|
||||
};
|
||||
static DDCAPS caps;
|
||||
static int mustrestore = 0;
|
||||
static DWORD CBM[3];
|
||||
|
||||
static int bpp;
|
||||
static int vflags;
|
||||
static int veflags;
|
||||
static int winspecial = 0;
|
||||
|
||||
int disvaccel = 0; /* Disable video hardware acceleration. */
|
||||
|
||||
int fssync = 0;
|
||||
int winsync = 0;
|
||||
|
||||
PALETTEENTRY color_palette[256];
|
||||
static int PaletteChanged = 0;
|
||||
|
||||
LPDIRECTDRAWCLIPPER lpClipper = 0;
|
||||
LPDIRECTDRAW lpDD = 0;
|
||||
LPDIRECTDRAW7 lpDD7 = 0;
|
||||
LPDIRECTDRAWPALETTE lpddpal = 0;
|
||||
|
||||
DDSURFACEDESC2 ddsd;
|
||||
|
||||
DDSURFACEDESC2 ddsdback;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSPrimary = 0;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSDBack = 0;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSBack = 0;
|
||||
|
||||
static void ShowDDErr(char *s) {
|
||||
char tempo[512];
|
||||
sprintf(tempo, "DirectDraw: %s", s);
|
||||
FCEUD_PrintError(tempo);
|
||||
}
|
||||
|
||||
int RestoreDD(int w) {
|
||||
if (w) {
|
||||
if (!lpDDSBack) return 0;
|
||||
if (IDirectDrawSurface7_Restore(lpDDSBack) != DD_OK) return 0;
|
||||
} else {
|
||||
if (!lpDDSPrimary) return 0;
|
||||
if (IDirectDrawSurface7_Restore(lpDDSPrimary) != DD_OK) return 0;
|
||||
}
|
||||
veflags |= 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b) {
|
||||
color_palette[index].peRed = r;
|
||||
color_palette[index].peGreen = g;
|
||||
color_palette[index].peBlue = b;
|
||||
PaletteChanged = 1;
|
||||
}
|
||||
|
||||
void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g, unsigned char *b) {
|
||||
*r = color_palette[i].peRed;
|
||||
*g = color_palette[i].peGreen;
|
||||
*b = color_palette[i].peBlue;
|
||||
}
|
||||
|
||||
static int InitializeDDraw(int fs) {
|
||||
ddrval = DirectDrawCreate((disvaccel & (1 << (fs ? 1 : 0))) ? (GUID FAR*)DDCREATE_EMULATIONONLY : NULL, &lpDD, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating DirectDraw object.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (LPVOID*)&lpDD7);
|
||||
IDirectDraw_Release(lpDD);
|
||||
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error querying interface.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
caps.dwSize = sizeof(caps);
|
||||
if (IDirectDraw7_GetCaps(lpDD7, &caps, 0) != DD_OK) {
|
||||
ShowDDErr("Error getting capabilities.");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetBPP(void) {
|
||||
DDPIXELFORMAT ddpix;
|
||||
|
||||
memset(&ddpix, 0, sizeof(ddpix));
|
||||
ddpix.dwSize = sizeof(ddpix);
|
||||
|
||||
ddrval = IDirectDrawSurface7_GetPixelFormat(lpDDSPrimary, &ddpix);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error getting primary surface pixel format.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ddpix.dwFlags & DDPF_RGB) {
|
||||
bpp = ddpix.DUMMYUNIONNAMEN(1).dwRGBBitCount;
|
||||
CBM[0] = ddpix.DUMMYUNIONNAMEN(2).dwRBitMask;
|
||||
CBM[1] = ddpix.DUMMYUNIONNAMEN(3).dwGBitMask;
|
||||
CBM[2] = ddpix.DUMMYUNIONNAMEN(4).dwBBitMask;
|
||||
} else {
|
||||
ShowDDErr("RGB data not valid.");
|
||||
return 0;
|
||||
}
|
||||
if (bpp == 15) bpp = 16;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int InitBPPStuff(int fs) {
|
||||
if (bpp >= 16) {
|
||||
InitBlitToHigh(bpp >> 3, CBM[0], CBM[1], CBM[2], 0, fs ? vmodes[vmod].special : winspecial);
|
||||
} else if (bpp == 8) {
|
||||
ddrval = IDirectDraw7_CreatePalette(lpDD7, DDPCAPS_8BIT | DDPCAPS_ALLOW256 | DDPCAPS_INITIALIZE, color_palette, &lpddpal, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating palette object.");
|
||||
return 0;
|
||||
}
|
||||
ddrval = IDirectDrawSurface7_SetPalette(lpDDSPrimary, lpddpal);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error setting palette object.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int SetVideoMode(int fs) {
|
||||
int specmul = 1; // Special scaler size multiplier
|
||||
|
||||
|
||||
if (fs)
|
||||
if (!vmod)
|
||||
if (!RecalcCustom())
|
||||
return(0);
|
||||
|
||||
vflags = 0;
|
||||
veflags = 1;
|
||||
PaletteChanged = 1;
|
||||
|
||||
ResetVideo();
|
||||
StopSound();
|
||||
|
||||
if (!InitializeDDraw(fs)) return(1); // DirectDraw not initialized
|
||||
|
||||
|
||||
if (!fs) {
|
||||
if (winspecial == 2 || winspecial == 1)
|
||||
specmul = 2;
|
||||
else if (winspecial == 3 || winspecial == 4)
|
||||
specmul = 3;
|
||||
else
|
||||
specmul = 1;
|
||||
|
||||
ShowCursorAbs(1);
|
||||
windowedfailed = 1;
|
||||
HideFWindow(0);
|
||||
|
||||
ddrval = IDirectDraw7_SetCooperativeLevel(lpDD7, hAppWnd, DDSCL_NORMAL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error setting cooperative level.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Beginning */
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
ddrval = IDirectDraw7_CreateSurface(lpDD7, &ddsd, &lpDDSPrimary, (IUnknown FAR*)NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
// FCEU_PrintError("%08x, %d\n",ddrval,lpDD7);
|
||||
ShowDDErr("Error creating primary surface.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(&ddsdback, 0, sizeof(ddsdback));
|
||||
ddsdback.dwSize = sizeof(ddsdback);
|
||||
ddsdback.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsdback.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
ddsdback.dwWidth = 256 * specmul;
|
||||
ddsdback.dwHeight = 240 * specmul;
|
||||
|
||||
/*
|
||||
If the blit hardware can't stretch, assume it's cheap(and slow)
|
||||
and create the buffer in system memory.
|
||||
*/
|
||||
if (!(caps.dwCaps & DDCAPS_BLTSTRETCH))
|
||||
ddsdback.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
ddrval = IDirectDraw7_CreateSurface(lpDD7, &ddsdback, &lpDDSBack, (IUnknown FAR*)NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating secondary surface.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!GetBPP())
|
||||
return 0;
|
||||
|
||||
if (bpp != 16 && bpp != 24 && bpp != 32) {
|
||||
ShowDDErr("Current bit depth not supported!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!InitBPPStuff(fs))
|
||||
return 0;
|
||||
|
||||
ddrval = IDirectDraw7_CreateClipper(lpDD7, 0, &lpClipper, 0);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating clipper.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectDrawClipper_SetHWnd(lpClipper, 0, hAppWnd);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error setting clipper window.");
|
||||
return 0;
|
||||
}
|
||||
ddrval = IDirectDrawSurface7_SetClipper(lpDDSPrimary, lpClipper);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error attaching clipper to primary surface.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
windowedfailed = 0;
|
||||
SetMainWindowStuff();
|
||||
} else { /* Following is full-screen */
|
||||
if (vmod == 0) {
|
||||
if (vmodes[0].special == 2 || vmodes[0].special == 1)
|
||||
specmul = 2;
|
||||
else if (vmodes[0].special == 3 || vmodes[0].special == 4)
|
||||
specmul = 3;
|
||||
else
|
||||
specmul = 1;
|
||||
}
|
||||
HideFWindow(1);
|
||||
|
||||
ddrval = IDirectDraw7_SetCooperativeLevel(lpDD7, hAppWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error setting cooperative level.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ddrval = IDirectDraw7_SetDisplayMode(lpDD7, vmodes[vmod].x, vmodes[vmod].y, vmodes[vmod].bpp, 0, 0);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error setting display mode.");
|
||||
return 0;
|
||||
}
|
||||
if (vmodes[vmod].flags & VMDF_DXBLT) {
|
||||
memset(&ddsdback, 0, sizeof(ddsdback));
|
||||
ddsdback.dwSize = sizeof(ddsdback);
|
||||
ddsdback.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsdback.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
ddsdback.dwWidth = 256 * specmul; //vmodes[vmod].srect.right;
|
||||
ddsdback.dwHeight = 240 * specmul; //vmodes[vmod].srect.bottom;
|
||||
|
||||
if (!(caps.dwCaps & DDCAPS_BLTSTRETCH))
|
||||
ddsdback.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
ddrval = IDirectDraw7_CreateSurface(lpDD7, &ddsdback, &lpDDSBack, (IUnknown FAR*)NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating secondary surface.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// create foreground surface
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
if (fssync == 3) { // Double buffering.
|
||||
ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT;
|
||||
ddsd.DUMMYUNIONNAMEN(5).dwBackBufferCount = 1;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_COMPLEX | DDSCAPS_FLIP;
|
||||
}
|
||||
|
||||
ddrval = IDirectDraw7_CreateSurface(lpDD7, &ddsd, &lpDDSPrimary, (IUnknown FAR*)NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
ShowDDErr("Error creating primary surface.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fssync == 3) {
|
||||
DDSCAPS2 tmp;
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
tmp.dwCaps = DDSCAPS_BACKBUFFER;
|
||||
|
||||
if (IDirectDrawSurface7_GetAttachedSurface(lpDDSPrimary, &tmp, &lpDDSDBack) != DD_OK) {
|
||||
ShowDDErr("Error getting attached surface.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetBPP())
|
||||
return 0;
|
||||
if (!InitBPPStuff(fs))
|
||||
return 0;
|
||||
|
||||
mustrestore = 1;
|
||||
ShowCursorAbs(0);
|
||||
}
|
||||
|
||||
InputScreenChanged(fs);
|
||||
fullscreen = fs;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void BlitScreenWindow(uint8 *XBuf);
|
||||
static void BlitScreenFull(uint8 *XBuf);
|
||||
//static uint8 *XBSave;
|
||||
void FCEUD_BlitScreen(uint8 *XBuf) {
|
||||
xbsave = XBuf;
|
||||
if (!NoWaiting) {
|
||||
int ws;
|
||||
|
||||
if (fullscreen) ws = fssync;
|
||||
else ws = winsync;
|
||||
|
||||
if (ws == 1)
|
||||
IDirectDraw7_WaitForVerticalBlank(lpDD7, DDWAITVB_BLOCKBEGIN, 0);
|
||||
else if (ws == 2) {
|
||||
BOOL invb = 0;
|
||||
|
||||
while ((DD_OK == IDirectDraw7_GetVerticalBlankStatus(lpDD7, &invb)) && !invb)
|
||||
Sleep(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (fullscreen) {
|
||||
BlitScreenFull(XBuf);
|
||||
} else {
|
||||
if (!windowedfailed)
|
||||
BlitScreenWindow(XBuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void FixPaletteHi(void) {
|
||||
// int x;
|
||||
SetPaletteBlitToHigh((uint8*)color_palette);
|
||||
}
|
||||
|
||||
static void BlitScreenWindow(unsigned char *XBuf) {
|
||||
int pitch;
|
||||
unsigned char *ScreenLoc;
|
||||
static RECT srect;
|
||||
RECT drect;
|
||||
int specialmul;
|
||||
|
||||
if (winspecial == 2 || winspecial == 1)
|
||||
specialmul = 2;
|
||||
else if (winspecial == 4 || winspecial == 3)
|
||||
specialmul = 3;
|
||||
else specialmul = 1;
|
||||
|
||||
|
||||
srect.top = srect.left = 0;
|
||||
srect.right = VNSWID * specialmul;
|
||||
srect.bottom = totallines * specialmul;
|
||||
|
||||
if (PaletteChanged == 1) {
|
||||
FixPaletteHi();
|
||||
PaletteChanged = 0;
|
||||
}
|
||||
|
||||
if (!GetClientAbsRect(&drect)) return;
|
||||
|
||||
ddrval = IDirectDrawSurface7_Lock(lpDDSBack, NULL, &ddsdback, 0, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) RestoreDD(1);
|
||||
return;
|
||||
}
|
||||
|
||||
pitch = ddsdback.DUMMYUNIONNAMEN(1).lPitch;
|
||||
ScreenLoc = ddsdback.lpSurface;
|
||||
if (veflags & 1) {
|
||||
memset(ScreenLoc, 0, pitch * 240);
|
||||
veflags &= ~1;
|
||||
}
|
||||
Blit8ToHigh(XBuf + srendline * 256 + VNSCLIP, ScreenLoc, VNSWID, totallines, pitch, specialmul, specialmul);
|
||||
|
||||
IDirectDrawSurface7_Unlock(lpDDSBack, NULL);
|
||||
|
||||
if (IDirectDrawSurface7_Blt(lpDDSPrimary, &drect, lpDDSBack, &srect, DDBLT_ASYNC, 0) != DD_OK) {
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSPrimary, &drect, lpDDSBack, &srect, DDBLT_WAIT, 0);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) {
|
||||
RestoreDD(1); RestoreDD(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void BlitScreenFull(uint8 *XBuf) {
|
||||
static int pitch;
|
||||
char *ScreenLoc;
|
||||
// unsigned long x;
|
||||
// uint8 y;
|
||||
RECT srect, drect;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSVPrimary;
|
||||
int specmul; // Special scaler size multiplier
|
||||
if (vmodes[0].special == 2 || vmodes[0].special == 1)
|
||||
specmul = 2;
|
||||
else if (vmodes[0].special == 3 || vmodes[0].special == 4)
|
||||
specmul = 3;
|
||||
else
|
||||
specmul = 1;
|
||||
|
||||
|
||||
if (fssync == 3)
|
||||
lpDDSVPrimary = lpDDSDBack;
|
||||
else
|
||||
lpDDSVPrimary = lpDDSPrimary;
|
||||
|
||||
if (PaletteChanged == 1) {
|
||||
if (bpp >= 16)
|
||||
FixPaletteHi();
|
||||
else {
|
||||
ddrval = IDirectDrawPalette_SetEntries(lpddpal, 0, 0, 256, color_palette);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) RestoreDD(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PaletteChanged = 0;
|
||||
}
|
||||
|
||||
if (vmodes[vmod].flags & VMDF_DXBLT) {
|
||||
ddrval = IDirectDrawSurface7_Lock(lpDDSBack, NULL, &ddsdback, 0, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) RestoreDD(1);
|
||||
return;
|
||||
}
|
||||
ScreenLoc = ddsdback.lpSurface;
|
||||
pitch = ddsdback.DUMMYUNIONNAMEN(1).lPitch;
|
||||
|
||||
srect.top = 0;
|
||||
srect.left = 0;
|
||||
srect.right = VNSWID * specmul;
|
||||
srect.bottom = totallines * specmul;
|
||||
|
||||
if (vmodes[vmod].flags & VMDF_STRFS) {
|
||||
drect.top = 0;
|
||||
drect.left = 0;
|
||||
drect.right = vmodes[vmod].x;
|
||||
drect.bottom = vmodes[vmod].y;
|
||||
} else {
|
||||
drect.top = (vmodes[vmod].y - (totallines * vmodes[vmod].yscale)) >> 1;
|
||||
drect.bottom = drect.top + (totallines * vmodes[vmod].yscale);
|
||||
drect.left = (vmodes[vmod].x - VNSWID * vmodes[vmod].xscale) >> 1;
|
||||
drect.right = drect.left + VNSWID * vmodes[vmod].xscale;
|
||||
}
|
||||
} else {
|
||||
ddrval = IDirectDrawSurface7_Lock(lpDDSVPrimary, NULL, &ddsd, 0, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) RestoreDD(0);
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenLoc = ddsd.lpSurface;
|
||||
pitch = ddsd.DUMMYUNIONNAMEN(1).lPitch;
|
||||
}
|
||||
|
||||
if (veflags & 1) {
|
||||
if (vmodes[vmod].flags & VMDF_DXBLT) {
|
||||
veflags |= 2;
|
||||
memset((char*)ScreenLoc, 0, pitch * srect.bottom);
|
||||
} else {
|
||||
memset((char*)ScreenLoc, 0, pitch * vmodes[vmod].y);
|
||||
}
|
||||
PaletteChanged = 1;
|
||||
veflags &= ~1;
|
||||
}
|
||||
|
||||
if (vmod == 5) {
|
||||
if (eoptions & EO_CLIPSIDES) {
|
||||
asm volatile (
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"akoop1:\n\t"
|
||||
"movb $120,%%al \n\t"
|
||||
"akoop2:\n\t"
|
||||
"movb 1(%%esi),%%dl\n\t"
|
||||
"shl $16,%%edx\n\t"
|
||||
"movb (%%esi),%%dl\n\t"
|
||||
"movl %%edx,(%%edi)\n\t"
|
||||
"addl $2,%%esi\n\t"
|
||||
"addl $4,%%edi\n\t"
|
||||
"decb %%al\n\t"
|
||||
"jne akoop2\n\t"
|
||||
"addl $16,%%esi\n\t"
|
||||
"addl %%ecx,%%edi\n\t"
|
||||
"decb %%bl\n\t"
|
||||
"jne akoop1\n\t"
|
||||
:
|
||||
: "S" (XBuf + srendline * 256 + VNSCLIP), "D" (ScreenLoc + ((240 - totallines) / 2) * pitch + (640 - (VNSWID << 1)) / 2), "b" (totallines), "c" ((pitch - VNSWID) << 1)
|
||||
: "%al", "%edx", "%cc");
|
||||
} else {
|
||||
asm volatile (
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"koop1:\n\t"
|
||||
"movb $128,%%al \n\t"
|
||||
"koop2:\n\t"
|
||||
"movb 1(%%esi),%%dl\n\t"
|
||||
"shl $16,%%edx\n\t"
|
||||
"movb (%%esi),%%dl\n\t"
|
||||
"movl %%edx,(%%edi)\n\t"
|
||||
"addl $2,%%esi\n\t"
|
||||
"addl $4,%%edi\n\t"
|
||||
"decb %%al\n\t"
|
||||
"jne koop2\n\t"
|
||||
"addl %%ecx,%%edi\n\t"
|
||||
"decb %%bl\n\t"
|
||||
"jne koop1\n\t"
|
||||
:
|
||||
: "S" (XBuf + srendline * 256), "D" (ScreenLoc + ((240 - totallines) / 2) * pitch + (640 - 512) / 2), "b" (totallines), "c" (pitch - 512 + pitch)
|
||||
: "%al", "%edx", "%cc");
|
||||
}
|
||||
} else if (vmod == 4) {
|
||||
if (eoptions & EO_CLIPSIDES) {
|
||||
asm volatile (
|
||||
"ayoop1:\n\t"
|
||||
"movb $120,%%al \n\t"
|
||||
"ayoop2:\n\t"
|
||||
"movb 1(%%esi),%%dh\n\t"
|
||||
"movb %%dh,%%dl\n\t"
|
||||
"shl $16,%%edx\n\t"
|
||||
"movb (%%esi),%%dl\n\t"
|
||||
"movb %%dl,%%dh\n\t" // Ugh
|
||||
"movl %%edx,(%%edi)\n\t"
|
||||
"addl $2,%%esi\n\t"
|
||||
"addl $4,%%edi\n\t"
|
||||
"decb %%al\n\t"
|
||||
"jne ayoop2\n\t"
|
||||
"addl $16,%%esi\n\t"
|
||||
"addl %%ecx,%%edi\n\t"
|
||||
"decb %%bl\n\t"
|
||||
"jne ayoop1\n\t"
|
||||
:
|
||||
: "S" (XBuf + srendline * 256 + VNSCLIP), "D" (ScreenLoc + ((240 - totallines) / 2) * pitch + (640 - (VNSWID << 1)) / 2), "b" (totallines), "c" ((pitch - VNSWID) << 1)
|
||||
: "%al", "%edx", "%cc");
|
||||
} else {
|
||||
asm volatile (
|
||||
"yoop1:\n\t"
|
||||
"movb $128,%%al \n\t"
|
||||
"yoop2:\n\t"
|
||||
"movb 1(%%esi),%%dh\n\t"
|
||||
"movb %%dh,%%dl\n\t"
|
||||
"shl $16,%%edx\n\t"
|
||||
"movb (%%esi),%%dl\n\t"
|
||||
"movb %%dl,%%dh\n\t" // Ugh
|
||||
"movl %%edx,(%%edi)\n\t"
|
||||
"addl $2,%%esi\n\t"
|
||||
"addl $4,%%edi\n\t"
|
||||
"decb %%al\n\t"
|
||||
"jne yoop2\n\t"
|
||||
"addl %%ecx,%%edi\n\t"
|
||||
"decb %%bl\n\t"
|
||||
"jne yoop1\n\t"
|
||||
:
|
||||
: "S" (XBuf + srendline * 256), "D" (ScreenLoc + ((240 - totallines) / 2) * pitch + (640 - 512) / 2), "b" (totallines), "c" (pitch - 512 + pitch)
|
||||
: "%al", "%edx", "%cc");
|
||||
}
|
||||
} else {
|
||||
if (!(vmodes[vmod].flags & VMDF_DXBLT)) {
|
||||
if (vmodes[vmod].special)
|
||||
ScreenLoc += (vmodes[vmod].drect.left * (bpp >> 3)) + ((vmodes[vmod].drect.top) * pitch);
|
||||
else
|
||||
ScreenLoc += ((vmodes[vmod].x - VNSWID) >> 1) * (bpp >> 3) + (((vmodes[vmod].y - totallines) >> 1)) * pitch;
|
||||
}
|
||||
|
||||
if (bpp >= 16) {
|
||||
Blit8ToHigh(XBuf + srendline * 256 + VNSCLIP, ScreenLoc, VNSWID, totallines, pitch, specmul, specmul);
|
||||
} else {
|
||||
XBuf += srendline * 256 + VNSCLIP;
|
||||
if (vmodes[vmod].special)
|
||||
Blit8To8(XBuf, ScreenLoc, VNSWID, totallines, pitch, vmodes[vmod].xscale, vmodes[vmod].yscale, 0, vmodes[vmod].special);
|
||||
else
|
||||
Blit8To8(XBuf, ScreenLoc, VNSWID, totallines, pitch, 1, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (vmodes[vmod].flags & VMDF_DXBLT) {
|
||||
IDirectDrawSurface7_Unlock(lpDDSBack, NULL);
|
||||
|
||||
if (veflags & 2) {
|
||||
if (IDirectDrawSurface7_Lock(lpDDSVPrimary, NULL, &ddsd, 0, NULL) == DD_OK) {
|
||||
memset(ddsd.lpSurface, 0, ddsd.DUMMYUNIONNAMEN(1).lPitch * vmodes[vmod].y);
|
||||
IDirectDrawSurface7_Unlock(lpDDSVPrimary, NULL);
|
||||
veflags &= ~2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (IDirectDrawSurface7_Blt(lpDDSVPrimary, &drect, lpDDSBack, &srect, DDBLT_ASYNC, 0) != DD_OK) {
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSVPrimary, &drect, lpDDSBack, &srect, DDBLT_WAIT, 0);
|
||||
if (ddrval != DD_OK) {
|
||||
if (ddrval == DDERR_SURFACELOST) {
|
||||
RestoreDD(0);
|
||||
RestoreDD(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
IDirectDrawSurface7_Unlock(lpDDSVPrimary, NULL);
|
||||
if (fssync == 3) {
|
||||
IDirectDrawSurface7_Flip(lpDDSPrimary, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ResetVideo(void) {
|
||||
ShowCursorAbs(1);
|
||||
KillBlitToHigh();
|
||||
if (lpDD7)
|
||||
if (mustrestore) {
|
||||
IDirectDraw7_RestoreDisplayMode(lpDD7); mustrestore = 0;
|
||||
}
|
||||
if (lpddpal) {
|
||||
IDirectDrawPalette_Release(lpddpal); lpddpal = 0;
|
||||
}
|
||||
if (lpDDSBack) {
|
||||
IDirectDrawSurface7_Release(lpDDSBack); lpDDSBack = 0;
|
||||
}
|
||||
if (lpDDSPrimary) {
|
||||
IDirectDrawSurface7_Release(lpDDSPrimary); lpDDSPrimary = 0;
|
||||
}
|
||||
if (lpClipper) {
|
||||
IDirectDrawClipper_Release(lpClipper); lpClipper = 0;
|
||||
}
|
||||
if (lpDD7) {
|
||||
IDirectDraw_Release(lpDD7); lpDD7 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int specialmlut[5] = { 1, 2, 2, 3, 3 };
|
||||
|
||||
static int RecalcCustom(void) {
|
||||
vmdef *cmode = &vmodes[0];
|
||||
|
||||
cmode->flags &= ~VMDF_DXBLT;
|
||||
|
||||
if (cmode->flags & VMDF_STRFS) {
|
||||
cmode->flags |= VMDF_DXBLT;
|
||||
} else if (cmode->xscale != 1 || cmode->yscale != 1 || cmode->special) {
|
||||
if (cmode->special) {
|
||||
int mult = specialmlut[cmode->special];
|
||||
|
||||
if (cmode->xscale < mult)
|
||||
cmode->xscale = mult;
|
||||
if (cmode->yscale < mult)
|
||||
cmode->yscale = mult;
|
||||
|
||||
if (cmode->xscale != mult || cmode->yscale != mult)
|
||||
cmode->flags |= VMDF_DXBLT;
|
||||
} else
|
||||
cmode->flags |= VMDF_DXBLT;
|
||||
|
||||
|
||||
if (VNSWID * cmode->xscale > cmode->x) {
|
||||
if (cmode->special) {
|
||||
FCEUD_PrintError("Scaled width is out of range.");
|
||||
return(0);
|
||||
} else {
|
||||
FCEUD_PrintError("Scaled width is out of range. Reverting to no horizontal scaling.");
|
||||
cmode->xscale = 1;
|
||||
}
|
||||
}
|
||||
if (totallines * cmode->yscale > cmode->y) {
|
||||
if (cmode->special) {
|
||||
FCEUD_PrintError("Scaled height is out of range.");
|
||||
return(0);
|
||||
} else {
|
||||
FCEUD_PrintError("Scaled height is out of range. Reverting to no vertical scaling.");
|
||||
cmode->yscale = 1;
|
||||
}
|
||||
}
|
||||
|
||||
cmode->srect.left = VNSCLIP;
|
||||
cmode->srect.top = srendline;
|
||||
cmode->srect.right = 256 - VNSCLIP;
|
||||
cmode->srect.bottom = erendline + 1;
|
||||
|
||||
cmode->drect.top = (cmode->y - (totallines * cmode->yscale)) >> 1;
|
||||
cmode->drect.bottom = cmode->drect.top + totallines * cmode->yscale;
|
||||
|
||||
cmode->drect.left = (cmode->x - (VNSWID * cmode->xscale)) >> 1;
|
||||
cmode->drect.right = cmode->drect.left + VNSWID * cmode->xscale;
|
||||
}
|
||||
|
||||
if ((cmode->special == 1 || cmode->special == 3) && cmode->bpp == 8) {
|
||||
cmode->bpp = 32;
|
||||
//FCEUD_PrintError("HQ2x/HQ3x requires 16bpp or 32bpp(best).");
|
||||
//return(0);
|
||||
}
|
||||
|
||||
if (cmode->x < VNSWID) {
|
||||
FCEUD_PrintError("Horizontal resolution is too low.");
|
||||
return(0);
|
||||
}
|
||||
if (cmode->y < totallines && !(cmode->flags & VMDF_STRFS)) {
|
||||
FCEUD_PrintError("Vertical resolution must not be less than the total number of drawn scanlines.");
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
BOOL SetDlgItemDouble(HWND hDlg, int item, double value) {
|
||||
char buf[8];
|
||||
sprintf(buf, "%.6f", value);
|
||||
SetDlgItemText(hDlg, item, buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
double GetDlgItemDouble(HWND hDlg, int item) {
|
||||
char buf[8];
|
||||
double ret = 0;
|
||||
|
||||
GetDlgItemText(hDlg, item, buf, 8);
|
||||
sscanf(buf, "%lf", &ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
static char *vmstr[11] = {
|
||||
"Custom",
|
||||
"320x240 Full Screen",
|
||||
"512x384 Centered",
|
||||
"640x480 Centered",
|
||||
"640x480 Scanlines",
|
||||
"640x480 \"4 per 1\"",
|
||||
"640x480 2x,2y",
|
||||
"1024x768 4x,3y",
|
||||
"1280x1024 5x,4y",
|
||||
"1600x1200 6x,5y",
|
||||
"800x600 Stretched"
|
||||
};
|
||||
int x;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
for (x = 0; x < 11; x++)
|
||||
SendDlgItemMessage(hwndDlg, 100, CB_ADDSTRING, 0, (LPARAM)(LPSTR)vmstr[x]);
|
||||
SendDlgItemMessage(hwndDlg, 100, CB_SETCURSEL, vmod, (LPARAM)(LPSTR)0);
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 202, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"8");
|
||||
SendDlgItemMessage(hwndDlg, 202, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"16");
|
||||
SendDlgItemMessage(hwndDlg, 202, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"24");
|
||||
SendDlgItemMessage(hwndDlg, 202, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"32");
|
||||
SendDlgItemMessage(hwndDlg, 202, CB_SETCURSEL, (vmodes[0].bpp >> 3) - 1, (LPARAM)(LPSTR)0);
|
||||
|
||||
SetDlgItemInt(hwndDlg, 200, vmodes[0].x, 0);
|
||||
SetDlgItemInt(hwndDlg, 201, vmodes[0].y, 0);
|
||||
|
||||
SetDlgItemInt(hwndDlg, 302, vmodes[0].xscale, 0);
|
||||
SetDlgItemInt(hwndDlg, 303, vmodes[0].yscale, 0);
|
||||
CheckRadioButton(hwndDlg, 300, 301, (vmodes[0].flags & VMDF_STRFS) ? 301 : 300);
|
||||
|
||||
{
|
||||
char *str[] = { "<none>", "hq2x", "Scale2x", "hq3x", "Scale3x" };
|
||||
int x;
|
||||
for (x = 0; x < 5; x++) {
|
||||
SendDlgItemMessage(hwndDlg, 304, CB_ADDSTRING, 0, (LPARAM)(LPSTR)str[x]);
|
||||
SendDlgItemMessage(hwndDlg, 406, CB_ADDSTRING, 0, (LPARAM)(LPSTR)str[x]);
|
||||
}
|
||||
}
|
||||
SendDlgItemMessage(hwndDlg, 304, CB_SETCURSEL, vmodes[0].special, (LPARAM)(LPSTR)0);
|
||||
SendDlgItemMessage(hwndDlg, 406, CB_SETCURSEL, winspecial, (LPARAM)(LPSTR)0);
|
||||
|
||||
if (eoptions & EO_FSAFTERLOAD)
|
||||
CheckDlgButton(hwndDlg, 102, BST_CHECKED);
|
||||
|
||||
if (eoptions & EO_CLIPSIDES)
|
||||
CheckDlgButton(hwndDlg, 106, BST_CHECKED);
|
||||
|
||||
if (disvaccel & 1)
|
||||
CheckDlgButton(hwndDlg, 130, BST_CHECKED);
|
||||
|
||||
if (disvaccel & 2)
|
||||
CheckDlgButton(hwndDlg, 131, BST_CHECKED);
|
||||
|
||||
if (eoptions & EO_FORCEISCALE)
|
||||
CheckDlgButton(hwndDlg, 402, BST_CHECKED);
|
||||
|
||||
if (eoptions & EO_FORCEASPECT)
|
||||
CheckDlgButton(hwndDlg, 403, BST_CHECKED);
|
||||
|
||||
SetDlgItemInt(hwndDlg, 500, srendlinen, 0);
|
||||
SetDlgItemInt(hwndDlg, 501, erendlinen, 0);
|
||||
|
||||
SetDlgItemInt(hwndDlg, 502, srendlinep, 0);
|
||||
SetDlgItemInt(hwndDlg, 503, erendlinep, 0);
|
||||
|
||||
|
||||
SetDlgItemDouble(hwndDlg, 400, winsizemulx);
|
||||
SetDlgItemDouble(hwndDlg, 401, winsizemuly);
|
||||
SetDlgItemDouble(hwndDlg, 404, saspectw);
|
||||
SetDlgItemDouble(hwndDlg, 405, saspecth);
|
||||
|
||||
//SetDlgI temInt(hwndDlg,103,winsizemul,0);
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 104, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"<none>");
|
||||
SendDlgItemMessage(hwndDlg, 105, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"<none>");
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 104, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Wait for VBlank");
|
||||
SendDlgItemMessage(hwndDlg, 104, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Lazy wait for VBlank");
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 105, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Wait for VBlank");
|
||||
SendDlgItemMessage(hwndDlg, 105, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Lazy wait for VBlank");
|
||||
SendDlgItemMessage(hwndDlg, 105, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Double Buffering");
|
||||
|
||||
SendDlgItemMessage(hwndDlg, 104, CB_SETCURSEL, winsync, (LPARAM)(LPSTR)0);
|
||||
SendDlgItemMessage(hwndDlg, 105, CB_SETCURSEL, fssync, (LPARAM)(LPSTR)0);
|
||||
|
||||
if (eoptions & EO_NOSPRLIM)
|
||||
CheckDlgButton(hwndDlg, 600, BST_CHECKED);
|
||||
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT: goto gornk;
|
||||
case WM_COMMAND:
|
||||
if (!(wParam >> 16))
|
||||
switch (wParam & 0xFFFF) {
|
||||
case 1:
|
||||
gornk:
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, 106) == BST_CHECKED)
|
||||
eoptions |= EO_CLIPSIDES;
|
||||
else
|
||||
eoptions &= ~EO_CLIPSIDES;
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, 600) == BST_CHECKED)
|
||||
eoptions |= EO_NOSPRLIM;
|
||||
else
|
||||
eoptions &= ~EO_NOSPRLIM;
|
||||
|
||||
srendlinen = GetDlgItemInt(hwndDlg, 500, 0, 0);
|
||||
erendlinen = GetDlgItemInt(hwndDlg, 501, 0, 0);
|
||||
srendlinep = GetDlgItemInt(hwndDlg, 502, 0, 0);
|
||||
erendlinep = GetDlgItemInt(hwndDlg, 503, 0, 0);
|
||||
|
||||
|
||||
if (erendlinen > 239) erendlinen = 239;
|
||||
if (srendlinen > erendlinen) srendlinen = erendlinen;
|
||||
|
||||
if (erendlinep > 239) erendlinep = 239;
|
||||
if (srendlinep > erendlinen) srendlinep = erendlinep;
|
||||
|
||||
UpdateRendBounds();
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, 301) == BST_CHECKED)
|
||||
vmodes[0].flags |= VMDF_STRFS;
|
||||
else
|
||||
vmodes[0].flags &= ~VMDF_STRFS;
|
||||
|
||||
vmod = SendDlgItemMessage(hwndDlg, 100, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
vmodes[0].x = GetDlgItemInt(hwndDlg, 200, 0, 0);
|
||||
vmodes[0].y = GetDlgItemInt(hwndDlg, 201, 0, 0);
|
||||
vmodes[0].bpp = (SendDlgItemMessage(hwndDlg, 202, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0) + 1) << 3;
|
||||
|
||||
vmodes[0].xscale = GetDlgItemInt(hwndDlg, 302, 0, 0);
|
||||
vmodes[0].yscale = GetDlgItemInt(hwndDlg, 303, 0, 0);
|
||||
vmodes[0].special = SendDlgItemMessage(hwndDlg, 304, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
|
||||
winspecial = SendDlgItemMessage(hwndDlg, 406, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
disvaccel = 0;
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, 130) == BST_CHECKED)
|
||||
disvaccel |= 1;
|
||||
if (IsDlgButtonChecked(hwndDlg, 131) == BST_CHECKED)
|
||||
disvaccel |= 2;
|
||||
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, 101) == BST_CHECKED)
|
||||
fullscreen = 1;
|
||||
else
|
||||
fullscreen = 0;
|
||||
if (IsDlgButtonChecked(hwndDlg, 102) == BST_CHECKED)
|
||||
eoptions |= EO_FSAFTERLOAD;
|
||||
else
|
||||
eoptions &= ~EO_FSAFTERLOAD;
|
||||
|
||||
eoptions &= ~(EO_FORCEISCALE | EO_FORCEASPECT);
|
||||
if (IsDlgButtonChecked(hwndDlg, 402) == BST_CHECKED)
|
||||
eoptions |= EO_FORCEISCALE;
|
||||
if (IsDlgButtonChecked(hwndDlg, 403) == BST_CHECKED)
|
||||
eoptions |= EO_FORCEASPECT;
|
||||
|
||||
|
||||
winsizemulx = GetDlgItemDouble(hwndDlg, 400);
|
||||
winsizemuly = GetDlgItemDouble(hwndDlg, 401);
|
||||
saspectw = GetDlgItemDouble(hwndDlg, 404);
|
||||
saspecth = GetDlgItemDouble(hwndDlg, 405);
|
||||
FixWXY(0);
|
||||
|
||||
winsync = SendDlgItemMessage(hwndDlg, 104, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
fssync = SendDlgItemMessage(hwndDlg, 105, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0);
|
||||
EndDialog(hwndDlg, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SetFSVideoMode(void) {
|
||||
changerecursive = 1;
|
||||
if (!SetVideoMode(1))
|
||||
SetVideoMode(0);
|
||||
changerecursive = 0;
|
||||
}
|
||||
|
||||
|
||||
void DoVideoConfigFix(void) {
|
||||
FCEUI_DisableSpriteLimitation(eoptions & EO_NOSPRLIM);
|
||||
UpdateRendBounds();
|
||||
}
|
||||
|
||||
void ConfigVideo(void) {
|
||||
DialogBox(fceu_hInstance, "VIDEOCONFIG", hAppWnd, VideoConCallB);
|
||||
DoVideoConfigFix();
|
||||
if (fullscreen)
|
||||
SetFSVideoMode();
|
||||
else {
|
||||
changerecursive = 1;
|
||||
SetVideoMode(0);
|
||||
changerecursive = 0;
|
||||
}
|
||||
//SetMainWindowStuff();
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
int CloseWave(void) {
|
||||
return(FCEUI_EndWaveRecord());
|
||||
}
|
||||
|
||||
int CreateSoundSave(void) {
|
||||
const char filter[] = "MS WAVE(*.wav)\0*.wav\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
FCEUI_EndWaveRecord();
|
||||
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hInstance = fceu_hInstance;
|
||||
ofn.lpstrTitle = "Log Sound As...";
|
||||
ofn.lpstrFilter = filter;
|
||||
nameo[0] = 0;
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if (GetSaveFileName(&ofn))
|
||||
return FCEUI_BeginWaveRecord(nameo);
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user