WINCE: Run astyle over WinCE source files.
This commit is contained in:
parent
438f2b2e1b
commit
bd82ebd080
24 changed files with 298 additions and 303 deletions
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#define KEY_ALL_SKIP 3457
|
#define KEY_ALL_SKIP 3457
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Common::String pocketActionNames[] = {
|
const Common::String pocketActionNames[] = {
|
||||||
|
@ -85,14 +85,14 @@ int CEActionsPocket::version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CEActionsPocket::CEActionsPocket(const Common::String &gameid) :
|
CEActionsPocket::CEActionsPocket(const Common::String &gameid) :
|
||||||
GUI::Actions() {
|
GUI::Actions() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_right_click_needed = false;
|
_right_click_needed = false;
|
||||||
_hide_toolbar_needed = false;
|
_hide_toolbar_needed = false;
|
||||||
_zoom_needed = false;
|
_zoom_needed = false;
|
||||||
|
|
||||||
for (i=0; i<POCKET_ACTION_LAST; i++) {
|
for (i = 0; i < POCKET_ACTION_LAST; i++) {
|
||||||
_action_mapping[i] = 0;
|
_action_mapping[i] = 0;
|
||||||
_action_enabled[i] = false;
|
_action_enabled[i] = false;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ GUI::Actions() {
|
||||||
|
|
||||||
void CEActionsPocket::initInstanceMain(OSystem *mainSystem) {
|
void CEActionsPocket::initInstanceMain(OSystem *mainSystem) {
|
||||||
// Nothing generic to do for Pocket PC
|
// Nothing generic to do for Pocket PC
|
||||||
_CESystem = static_cast<OSystem_WINCE3*>(mainSystem);
|
_CESystem = static_cast<OSystem_WINCE3 *>(mainSystem);
|
||||||
GUI_Actions::initInstanceMain(mainSystem);
|
GUI_Actions::initInstanceMain(mainSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void CEActionsPocket::initInstanceGame() {
|
||||||
bool is_comi = (strncmp(gameid.c_str(), "comi", 4) == 0);
|
bool is_comi = (strncmp(gameid.c_str(), "comi", 4) == 0);
|
||||||
bool is_gob = (strncmp(gameid.c_str(), "gob", 3) == 0);
|
bool is_gob = (strncmp(gameid.c_str(), "gob", 3) == 0);
|
||||||
bool is_saga = (gameid == "saga");
|
bool is_saga = (gameid == "saga");
|
||||||
bool is_kyra = (strncmp(gameid.c_str(), "kyra",4) == 0);
|
bool is_kyra = (strncmp(gameid.c_str(), "kyra", 4) == 0);
|
||||||
bool is_samnmax = (gameid == "samnmax");
|
bool is_samnmax = (gameid == "samnmax");
|
||||||
bool is_cine = (gameid == "cine");
|
bool is_cine = (gameid == "cine");
|
||||||
bool is_touche = (gameid == "touche");
|
bool is_touche = (gameid == "touche");
|
||||||
|
@ -134,7 +134,7 @@ void CEActionsPocket::initInstanceGame() {
|
||||||
bool is_parallaction = (gameid == "parallaction");
|
bool is_parallaction = (gameid == "parallaction");
|
||||||
bool is_lure = (gameid == "lure");
|
bool is_lure = (gameid == "lure");
|
||||||
bool is_feeble = (gameid == "feeble");
|
bool is_feeble = (gameid == "feeble");
|
||||||
bool is_drascula = (strncmp(gameid.c_str(), "drascula",8) == 0);
|
bool is_drascula = (strncmp(gameid.c_str(), "drascula", 8) == 0);
|
||||||
bool is_tucker = (gameid == "tucker");
|
bool is_tucker = (gameid == "tucker");
|
||||||
bool is_groovie = (gameid == "groovie");
|
bool is_groovie = (gameid == "groovie");
|
||||||
bool is_tinsel = (gameid == "tinsel");
|
bool is_tinsel = (gameid == "tinsel");
|
||||||
|
@ -145,7 +145,7 @@ void CEActionsPocket::initInstanceGame() {
|
||||||
|
|
||||||
// See if a right click mapping could be needed
|
// See if a right click mapping could be needed
|
||||||
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel ||
|
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel ||
|
||||||
is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise)
|
is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise)
|
||||||
_right_click_needed = true;
|
_right_click_needed = true;
|
||||||
|
|
||||||
// See if a "hide toolbar" mapping could be needed
|
// See if a "hide toolbar" mapping could be needed
|
||||||
|
@ -187,7 +187,7 @@ void CEActionsPocket::initInstanceGame() {
|
||||||
if (!is_cine && !is_parallaction && !is_groovie && !is_cruise && !is_made)
|
if (!is_cine && !is_parallaction && !is_groovie && !is_cruise && !is_made)
|
||||||
_action_enabled[POCKET_ACTION_SKIP] = true;
|
_action_enabled[POCKET_ACTION_SKIP] = true;
|
||||||
if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel ||
|
if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel ||
|
||||||
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker)
|
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker)
|
||||||
_key_action[POCKET_ACTION_SKIP].setKey(VK_ESCAPE);
|
_key_action[POCKET_ACTION_SKIP].setKey(VK_ESCAPE);
|
||||||
else
|
else
|
||||||
_key_action[POCKET_ACTION_SKIP].setKey(KEY_ALL_SKIP);
|
_key_action[POCKET_ACTION_SKIP].setKey(KEY_ALL_SKIP);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
|
|
||||||
#define KEY_ALL_SKIP 3457
|
#define KEY_ALL_SKIP 3457
|
||||||
|
|
||||||
const String smartphoneActionNames[] = {
|
const String smartphoneActionNames[] = {
|
||||||
_s("Up"),
|
_s("Up"),
|
||||||
|
@ -79,10 +79,10 @@ int CEActionsSmartphone::version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CEActionsSmartphone::CEActionsSmartphone()
|
CEActionsSmartphone::CEActionsSmartphone()
|
||||||
: GUI::Actions() {
|
: GUI::Actions() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<SMARTPHONE_ACTION_LAST; i++) {
|
for (i = 0; i < SMARTPHONE_ACTION_LAST; i++) {
|
||||||
_action_mapping[i] = ACTIONS_SMARTPHONE_DEFAULT[i];
|
_action_mapping[i] = ACTIONS_SMARTPHONE_DEFAULT[i];
|
||||||
_action_enabled[i] = false;
|
_action_enabled[i] = false;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ CEActionsSmartphone::CEActionsSmartphone()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEActionsSmartphone::initInstanceMain(OSystem *mainSystem) {
|
void CEActionsSmartphone::initInstanceMain(OSystem *mainSystem) {
|
||||||
_CESystem = static_cast<OSystem_WINCE3*>(mainSystem);
|
_CESystem = static_cast<OSystem_WINCE3 *>(mainSystem);
|
||||||
|
|
||||||
GUI_Actions::initInstanceMain(mainSystem);
|
GUI_Actions::initInstanceMain(mainSystem);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void CEActionsSmartphone::initInstanceGame() {
|
||||||
bool is_comi = (strncmp(gameid.c_str(), "comi", 4) == 0);
|
bool is_comi = (strncmp(gameid.c_str(), "comi", 4) == 0);
|
||||||
bool is_gob = (strncmp(gameid.c_str(), "gob", 3) == 0);
|
bool is_gob = (strncmp(gameid.c_str(), "gob", 3) == 0);
|
||||||
bool is_saga = (gameid == "saga");
|
bool is_saga = (gameid == "saga");
|
||||||
bool is_kyra = (strncmp(gameid.c_str(), "kyra",4) == 0);
|
bool is_kyra = (strncmp(gameid.c_str(), "kyra", 4) == 0);
|
||||||
bool is_samnmax = (gameid == "samnmax");
|
bool is_samnmax = (gameid == "samnmax");
|
||||||
bool is_cine = (gameid == "cine");
|
bool is_cine = (gameid == "cine");
|
||||||
bool is_touche = (gameid == "touche");
|
bool is_touche = (gameid == "touche");
|
||||||
|
@ -125,7 +125,7 @@ void CEActionsSmartphone::initInstanceGame() {
|
||||||
bool is_parallaction = (gameid == "parallaction");
|
bool is_parallaction = (gameid == "parallaction");
|
||||||
bool is_lure = (gameid == "lure");
|
bool is_lure = (gameid == "lure");
|
||||||
bool is_feeble = (gameid == "feeble");
|
bool is_feeble = (gameid == "feeble");
|
||||||
bool is_drascula = (strncmp(gameid.c_str(), "drascula",8) == 0);
|
bool is_drascula = (strncmp(gameid.c_str(), "drascula", 8) == 0);
|
||||||
bool is_tucker = (gameid == "tucker");
|
bool is_tucker = (gameid == "tucker");
|
||||||
bool is_groovie = (gameid == "groovie");
|
bool is_groovie = (gameid == "groovie");
|
||||||
bool is_tinsel = (gameid == "tinsel");
|
bool is_tinsel = (gameid == "tinsel");
|
||||||
|
@ -136,7 +136,7 @@ void CEActionsSmartphone::initInstanceGame() {
|
||||||
|
|
||||||
// See if a right click mapping could be needed
|
// See if a right click mapping could be needed
|
||||||
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel ||
|
if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_tinsel ||
|
||||||
is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise)
|
is_samnmax || is_cine || is_touche || is_parallaction || is_drascula || is_cruise)
|
||||||
_right_click_needed = true;
|
_right_click_needed = true;
|
||||||
|
|
||||||
// Initialize keys for different actions
|
// Initialize keys for different actions
|
||||||
|
@ -168,8 +168,8 @@ void CEActionsSmartphone::initInstanceGame() {
|
||||||
// Skip
|
// Skip
|
||||||
_action_enabled[SMARTPHONE_ACTION_SKIP] = true;
|
_action_enabled[SMARTPHONE_ACTION_SKIP] = true;
|
||||||
if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel ||
|
if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel ||
|
||||||
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker ||
|
is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker ||
|
||||||
is_groovie || is_cruise || is_made)
|
is_groovie || is_cruise || is_made)
|
||||||
_key_action[SMARTPHONE_ACTION_SKIP].setKey(VK_ESCAPE);
|
_key_action[SMARTPHONE_ACTION_SKIP].setKey(VK_ESCAPE);
|
||||||
else
|
else
|
||||||
_key_action[SMARTPHONE_ACTION_SKIP].setKey(KEY_ALL_SKIP);
|
_key_action[SMARTPHONE_ACTION_SKIP].setKey(KEY_ALL_SKIP);
|
||||||
|
@ -204,92 +204,92 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
|
||||||
|
|
||||||
if (!pushed) {
|
if (!pushed) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SMARTPHONE_ACTION_RIGHTCLICK:
|
case SMARTPHONE_ACTION_RIGHTCLICK:
|
||||||
//_CESystem->add_right_click(false);
|
//_CESystem->add_right_click(false);
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_LEFTCLICK:
|
case SMARTPHONE_ACTION_LEFTCLICK:
|
||||||
//_CESystem->add_left_click(false);
|
//_CESystem->add_left_click(false);
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_SAVE:
|
case SMARTPHONE_ACTION_SAVE:
|
||||||
case SMARTPHONE_ACTION_SKIP:
|
case SMARTPHONE_ACTION_SKIP:
|
||||||
case SMARTPHONE_ACTION_MULTI:
|
case SMARTPHONE_ACTION_MULTI:
|
||||||
EventsBuffer::simulateKey(&_key_action[action], false);
|
EventsBuffer::simulateKey(&_key_action[action], false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SMARTPHONE_ACTION_SAVE:
|
case SMARTPHONE_ACTION_SAVE:
|
||||||
case SMARTPHONE_ACTION_SKIP:
|
case SMARTPHONE_ACTION_SKIP:
|
||||||
case SMARTPHONE_ACTION_MULTI:
|
case SMARTPHONE_ACTION_MULTI:
|
||||||
if (action == SMARTPHONE_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") {
|
if (action == SMARTPHONE_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") {
|
||||||
// FIXME: This is a temporary solution. The engine should handle its own menus.
|
// FIXME: This is a temporary solution. The engine should handle its own menus.
|
||||||
// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience
|
// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience
|
||||||
GUI::MessageDialog alert(_("Do you want to load or save the game?"), _("Load"), _("Save"));
|
GUI::MessageDialog alert(_("Do you want to load or save the game?"), _("Load"), _("Save"));
|
||||||
if (alert.runModal() == GUI::kMessageOK)
|
if (alert.runModal() == GUI::kMessageOK)
|
||||||
_key_action[action].setKey(SDLK_l);
|
_key_action[action].setKey(SDLK_l);
|
||||||
else
|
else
|
||||||
_key_action[action].setKey(SDLK_s);
|
_key_action[action].setKey(SDLK_s);
|
||||||
}
|
}
|
||||||
EventsBuffer::simulateKey(&_key_action[action], true);
|
EventsBuffer::simulateKey(&_key_action[action], true);
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_RIGHTCLICK:
|
case SMARTPHONE_ACTION_RIGHTCLICK:
|
||||||
//_CESystem->add_right_click(true);
|
//_CESystem->add_right_click(true);
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_LEFTCLICK:
|
case SMARTPHONE_ACTION_LEFTCLICK:
|
||||||
//_CESystem->add_left_click(true);
|
//_CESystem->add_left_click(true);
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_UP:
|
case SMARTPHONE_ACTION_UP:
|
||||||
//_CESystem->move_cursor_up();
|
//_CESystem->move_cursor_up();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_DOWN:
|
case SMARTPHONE_ACTION_DOWN:
|
||||||
//_CESystem->move_cursor_down();
|
//_CESystem->move_cursor_down();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_LEFT:
|
case SMARTPHONE_ACTION_LEFT:
|
||||||
//_CESystem->move_cursor_left();
|
//_CESystem->move_cursor_left();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_RIGHT:
|
case SMARTPHONE_ACTION_RIGHT:
|
||||||
//_CESystem->move_cursor_right();
|
//_CESystem->move_cursor_right();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_ZONE:
|
case SMARTPHONE_ACTION_ZONE:
|
||||||
//_CESystem->switch_zone();
|
//_CESystem->switch_zone();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_BINDKEYS:
|
case SMARTPHONE_ACTION_BINDKEYS:
|
||||||
if (!keydialogrunning) {
|
if (!keydialogrunning) {
|
||||||
keydialogrunning = true;
|
keydialogrunning = true;
|
||||||
GUI::KeysDialog *keysDialog = new GUI::KeysDialog();
|
GUI::KeysDialog *keysDialog = new GUI::KeysDialog();
|
||||||
keysDialog->runModal();
|
keysDialog->runModal();
|
||||||
delete keysDialog;
|
delete keysDialog;
|
||||||
keydialogrunning = false;
|
keydialogrunning = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_KEYBOARD:
|
case SMARTPHONE_ACTION_KEYBOARD:
|
||||||
//_CESystem->swap_smartphone_keyboard();
|
//_CESystem->swap_smartphone_keyboard();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_ROTATE:
|
case SMARTPHONE_ACTION_ROTATE:
|
||||||
//_CESystem->smartphone_rotate_display();
|
//_CESystem->smartphone_rotate_display();
|
||||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
|
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
|
||||||
return true;
|
return true;
|
||||||
case SMARTPHONE_ACTION_QUIT:
|
case SMARTPHONE_ACTION_QUIT:
|
||||||
if (!quitdialog) {
|
if (!quitdialog) {
|
||||||
quitdialog = true;
|
quitdialog = true;
|
||||||
GUI::MessageDialog alert(_(" Are you sure you want to quit ? "), _("Yes"), _("No"));
|
GUI::MessageDialog alert(_(" Are you sure you want to quit ? "), _("Yes"), _("No"));
|
||||||
if (alert.runModal() == GUI::kMessageOK)
|
if (alert.runModal() == GUI::kMessageOK)
|
||||||
_mainSystem->quit();
|
_mainSystem->quit();
|
||||||
quitdialog = false;
|
quitdialog = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,17 +29,17 @@
|
||||||
|
|
||||||
#include "backends/platform/wince/wince-sdl.h"
|
#include "backends/platform/wince/wince-sdl.h"
|
||||||
|
|
||||||
static void (WINAPI* _SHIdleTimerReset)(void) = NULL;
|
static void (WINAPI *_SHIdleTimerReset)(void) = NULL;
|
||||||
static HANDLE (WINAPI* _SetPowerRequirement)(PVOID,int,ULONG,PVOID,ULONG) = NULL;
|
static HANDLE(WINAPI *_SetPowerRequirement)(PVOID, int, ULONG, PVOID, ULONG) = NULL;
|
||||||
static DWORD (WINAPI* _ReleasePowerRequirement)(HANDLE) = NULL;
|
static DWORD (WINAPI *_ReleasePowerRequirement)(HANDLE) = NULL;
|
||||||
static HANDLE _hPowerManagement = NULL;
|
static HANDLE _hPowerManagement = NULL;
|
||||||
static DWORD _lastTime = 0;
|
static DWORD _lastTime = 0;
|
||||||
static DWORD REG_bat = 0, REG_ac = 0, REG_disp = 0, bat_timeout = 0;
|
static DWORD REG_bat = 0, REG_ac = 0, REG_disp = 0, bat_timeout = 0;
|
||||||
static bool REG_tampered = false;
|
static bool REG_tampered = false;
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
extern "C" void WINAPI SystemIdleTimerReset(void);
|
extern "C" void WINAPI SystemIdleTimerReset(void);
|
||||||
#define SPI_SETBATTERYIDLETIMEOUT 251
|
#define SPI_SETBATTERYIDLETIMEOUT 251
|
||||||
#define SPI_GETBATTERYIDLETIMEOUT 252
|
#define SPI_GETBATTERYIDLETIMEOUT 252
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TIMER_TRIGGER 9000
|
#define TIMER_TRIGGER 9000
|
||||||
|
@ -70,7 +70,7 @@ DWORD CEDevice::reg_access(const TCHAR *key, const TCHAR *val, DWORD data) {
|
||||||
void CEDevice::backlight_xchg() {
|
void CEDevice::backlight_xchg() {
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
|
||||||
REG_bat = reg_access(TEXT("ControlPanel\\BackLight"), (const TCHAR*)TEXT("BatteryTimeout"), REG_bat);
|
REG_bat = reg_access(TEXT("ControlPanel\\BackLight"), (const TCHAR *)TEXT("BatteryTimeout"), REG_bat);
|
||||||
REG_ac = reg_access(TEXT("ControlPanel\\BackLight"), TEXT("ACTimeout"), REG_ac);
|
REG_ac = reg_access(TEXT("ControlPanel\\BackLight"), TEXT("ACTimeout"), REG_ac);
|
||||||
REG_disp = reg_access(TEXT("ControlPanel\\Power"), TEXT("Display"), REG_disp);
|
REG_disp = reg_access(TEXT("ControlPanel\\Power"), TEXT("Display"), REG_disp);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void CEDevice::init() {
|
||||||
}
|
}
|
||||||
dll = LoadLibrary(TEXT("coredll.dll"));
|
dll = LoadLibrary(TEXT("coredll.dll"));
|
||||||
if (dll) {
|
if (dll) {
|
||||||
_SetPowerRequirement = (HANDLE (*)(PVOID,int,ULONG,PVOID,ULONG))GetProcAddress(dll, TEXT("SetPowerRequirement"));
|
_SetPowerRequirement = (HANDLE (*)(PVOID, int, ULONG, PVOID, ULONG))GetProcAddress(dll, TEXT("SetPowerRequirement"));
|
||||||
_ReleasePowerRequirement = (DWORD (*)(HANDLE))GetProcAddress(dll, TEXT("ReleasePowerRequirement"));
|
_ReleasePowerRequirement = (DWORD (*)(HANDLE))GetProcAddress(dll, TEXT("ReleasePowerRequirement"));
|
||||||
}
|
}
|
||||||
if (_SetPowerRequirement)
|
if (_SetPowerRequirement)
|
||||||
|
@ -97,7 +97,7 @@ void CEDevice::init() {
|
||||||
_lastTime = GetTickCount();
|
_lastTime = GetTickCount();
|
||||||
|
|
||||||
// older devices
|
// older devices
|
||||||
REG_bat = REG_ac = REG_disp = 2 * 60 * 60 * 1000; // 2hrs should do it
|
REG_bat = REG_ac = REG_disp = 2 * 60 * 60 * 1000; // 2hrs should do it
|
||||||
backlight_xchg();
|
backlight_xchg();
|
||||||
REG_tampered = true;
|
REG_tampered = true;
|
||||||
SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, (void *) &bat_timeout, 0);
|
SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, (void *) &bat_timeout, 0);
|
||||||
|
|
|
@ -36,7 +36,7 @@ void CEException::writeBreak(HANDLE file) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(tempo, 0, sizeof(tempo));
|
memset(tempo, 0, sizeof(tempo));
|
||||||
for (i=0; i<40; i++)
|
for (i = 0; i < 40; i++)
|
||||||
tempo[i] = '-';
|
tempo[i] = '-';
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
}
|
}
|
||||||
|
@ -51,23 +51,23 @@ void CEException::dumpContext(HANDLE file, HANDLE hProcess, CONTEXT *context) {
|
||||||
writeBreak(file);
|
writeBreak(file);
|
||||||
writeString(file, "Context dump");
|
writeString(file, "Context dump");
|
||||||
sprintf(tempo, "R0=%.8x R1=%.8x R2=%.8x R3=%.8x R4=%.8x", context->R0, context->R1,
|
sprintf(tempo, "R0=%.8x R1=%.8x R2=%.8x R3=%.8x R4=%.8x", context->R0, context->R1,
|
||||||
context->R2, context->R3, context->R4);
|
context->R2, context->R3, context->R4);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
sprintf(tempo, "R5=%.8x R6=%.8x R7=%.8x R8=%.8x R9=%.8x", context->R5, context->R6,
|
sprintf(tempo, "R5=%.8x R6=%.8x R7=%.8x R8=%.8x R9=%.8x", context->R5, context->R6,
|
||||||
context->R7, context->R8, context->R9);
|
context->R7, context->R8, context->R9);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
sprintf(tempo, "R10=%.8x R11=%.8x R12=%.8x", context->R10, context->R11,
|
sprintf(tempo, "R10=%.8x R11=%.8x R12=%.8x", context->R10, context->R11,
|
||||||
context->R12);
|
context->R12);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
sprintf(tempo, "Sp=%.8x Lr=%.8x Pc=%.8x Psr=%.8x", context->Sp, context->Lr,
|
sprintf(tempo, "Sp=%.8x Lr=%.8x Pc=%.8x Psr=%.8x", context->Sp, context->Lr,
|
||||||
context->Pc, context->Psr);
|
context->Pc, context->Psr);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
writeBreak(file);
|
writeBreak(file);
|
||||||
|
|
||||||
sprintf(tempo, "Memory dump at %.8x", context->Pc - (sizeof(memoryDump) / 2));
|
sprintf(tempo, "Memory dump at %.8x", context->Pc - (sizeof(memoryDump) / 2));
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
if (ReadProcessMemory(hProcess, (LPCVOID)(context->Pc - (sizeof(memoryDump) / 2)), memoryDump, sizeof(memoryDump), &size)) {
|
if (ReadProcessMemory(hProcess, (LPCVOID)(context->Pc - (sizeof(memoryDump) / 2)), memoryDump, sizeof(memoryDump), &size)) {
|
||||||
for (i=0; i<size; i+=8) {
|
for (i = 0; i < size; i += 8) {
|
||||||
int j;
|
int j;
|
||||||
char digit[4];
|
char digit[4];
|
||||||
int max;
|
int max;
|
||||||
|
@ -75,7 +75,7 @@ void CEException::dumpContext(HANDLE file, HANDLE hProcess, CONTEXT *context) {
|
||||||
if (max > 8)
|
if (max > 8)
|
||||||
max = 8;
|
max = 8;
|
||||||
tempo[0] = '\0';
|
tempo[0] = '\0';
|
||||||
for (j=0; j<max; j++) {
|
for (j = 0; j < max; j++) {
|
||||||
sprintf(digit, "%.2x ", memoryDump[i + j]);
|
sprintf(digit, "%.2x ", memoryDump[i + j]);
|
||||||
strcat(tempo, digit);
|
strcat(tempo, digit);
|
||||||
}
|
}
|
||||||
|
@ -121,10 +121,10 @@ void CEException::dumpException(HANDLE file, EXCEPTION_RECORD *exceptionRecord)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sprintf(tempo, "Exception %s Flags %.8x Address %.8x", exceptionName, exceptionRecord->ExceptionFlags,
|
sprintf(tempo, "Exception %s Flags %.8x Address %.8x", exceptionName, exceptionRecord->ExceptionFlags,
|
||||||
exceptionRecord->ExceptionAddress);
|
exceptionRecord->ExceptionAddress);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
if (exceptionRecord->NumberParameters) {
|
if (exceptionRecord->NumberParameters) {
|
||||||
for (i=0; i<exceptionRecord->NumberParameters; i++) {
|
for (i = 0; i < exceptionRecord->NumberParameters; i++) {
|
||||||
sprintf(tempo, "Parameter %d %.8x", i, exceptionRecord->ExceptionInformation[i]);
|
sprintf(tempo, "Parameter %d %.8x", i, exceptionRecord->ExceptionInformation[i]);
|
||||||
writeString(file, tempo);
|
writeString(file, tempo);
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,8 @@ bool CEException::writeException(TCHAR *path, EXCEPTION_POINTERS *exceptionPoint
|
||||||
|
|
||||||
GetSystemTime(&systemTime);
|
GetSystemTime(&systemTime);
|
||||||
wsprintf(dumpFileName, TEXT("%s_%.2d_%.2d_%.4d_%.2d_%.2d_%.2d.txt"),
|
wsprintf(dumpFileName, TEXT("%s_%.2d_%.2d_%.4d_%.2d_%.2d_%.2d.txt"),
|
||||||
path, systemTime.wDay, systemTime.wMonth, systemTime.wYear,
|
path, systemTime.wDay, systemTime.wMonth, systemTime.wYear,
|
||||||
systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
|
systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
|
||||||
dumpFile = CreateFile(dumpFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
dumpFile = CreateFile(dumpFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (dumpFile == INVALID_HANDLE_VALUE)
|
if (dumpFile == INVALID_HANDLE_VALUE)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -48,14 +48,14 @@ using namespace Common;
|
||||||
class CEAboutDialog : public Dialog {
|
class CEAboutDialog : public Dialog {
|
||||||
public:
|
public:
|
||||||
CEAboutDialog()
|
CEAboutDialog()
|
||||||
: Dialog(10, 60, 300, 77) {
|
: Dialog(10, 60, 300, 77) {
|
||||||
char tempo[100];
|
char tempo[100];
|
||||||
|
|
||||||
// FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
|
// FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
|
||||||
// needs fixing, or remove it!
|
// needs fixing, or remove it!
|
||||||
const int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
|
const int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
|
||||||
const int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
|
const int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
|
||||||
new ButtonWidget(this, (_w - buttonWidth) / 2, 45, buttonWidth, buttonHeight, _("OK"), 0, kCloseCmd, '\r'); // Close dialog - FIXME
|
new ButtonWidget(this, (_w - buttonWidth) / 2, 45, buttonWidth, buttonHeight, _("OK"), 0, kCloseCmd, '\r'); // Close dialog - FIXME
|
||||||
|
|
||||||
Common::String videoDriver(_("Using SDL driver "));
|
Common::String videoDriver(_("Using SDL driver "));
|
||||||
SDL_VideoDriverName(tempo, sizeof(tempo));
|
SDL_VideoDriverName(tempo, sizeof(tempo));
|
||||||
|
@ -106,14 +106,13 @@ void CELauncherDialog::addGame() {
|
||||||
MessageDialog alert(_("Do you want to perform an automatic scan ?"), _("Yes"), _("No"));
|
MessageDialog alert(_("Do you want to perform an automatic scan ?"), _("Yes"), _("No"));
|
||||||
if (alert.runModal() == kMessageOK && _browser->runModal() > 0) {
|
if (alert.runModal() == kMessageOK && _browser->runModal() > 0) {
|
||||||
// Clear existing domains
|
// Clear existing domains
|
||||||
ConfigManager::DomainMap &domains = (ConfigManager::DomainMap&)ConfMan.getGameDomains();
|
ConfigManager::DomainMap &domains = (ConfigManager::DomainMap &)ConfMan.getGameDomains();
|
||||||
domains.clear();
|
domains.clear();
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
automaticScanDirectory(_browser->getResult());
|
automaticScanDirectory(_browser->getResult());
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
updateListing();
|
updateListing();
|
||||||
draw();
|
draw();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
GUILauncherDialog::addGame();
|
GUILauncherDialog::addGame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
namespace CEGUI {
|
namespace CEGUI {
|
||||||
|
|
||||||
GUIElement::GUIElement(int x, int y, int width, int height) :
|
GUIElement::GUIElement(int x, int y, int width, int height) :
|
||||||
_background(0), _drawn(false), _visible(true), _x(x), _y(y), _width(width), _height(height) {
|
_background(0), _drawn(false), _visible(true), _x(x), _y(y), _width(width), _height(height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GUIElement::setBackground(WORD backgroundReference) {
|
bool GUIElement::setBackground(WORD backgroundReference) {
|
||||||
|
@ -45,9 +45,7 @@ bool GUIElement::setBackground(WORD backgroundReference) {
|
||||||
if (!_height && !_width) {
|
if (!_height && !_width) {
|
||||||
_height = _background->height();
|
_height = _background->height();
|
||||||
_width = _background->width();
|
_width = _background->width();
|
||||||
}
|
} else if (_background->height() != _height || _background->width() != _width) {
|
||||||
else
|
|
||||||
if (_background->height() != _height || _background->width() != _width) {
|
|
||||||
delete _background;
|
delete _background;
|
||||||
_background = NULL;
|
_background = NULL;
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,8 +72,7 @@ bool GUIElement::draw(SDL_Surface *surface) {
|
||||||
_drawn = true;
|
_drawn = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
namespace CEGUI {
|
namespace CEGUI {
|
||||||
|
|
||||||
ItemAction::ItemAction(WORD reference, GUI::ActionType action) :
|
ItemAction::ItemAction(WORD reference, GUI::ActionType action) :
|
||||||
PanelItem(reference) {
|
PanelItem(reference) {
|
||||||
_action = action;
|
_action = action;
|
||||||
if (!GUI::Actions::Instance()->isEnabled(_action))
|
if (!GUI::Actions::Instance()->isEnabled(_action))
|
||||||
_visible = false;
|
_visible = false;
|
||||||
|
|
|
@ -40,7 +40,7 @@ void ItemSwitch::init(WORD referenceTrue, WORD referenceFalse) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, bool *item) :
|
ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, bool *item) :
|
||||||
PanelItem(referenceTrue) {
|
PanelItem(referenceTrue) {
|
||||||
init(referenceTrue, referenceFalse);
|
init(referenceTrue, referenceFalse);
|
||||||
_item = item;
|
_item = item;
|
||||||
_itemmax = -1;
|
_itemmax = -1;
|
||||||
|
@ -49,8 +49,8 @@ PanelItem(referenceTrue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, int *item, int max) :
|
ItemSwitch::ItemSwitch(WORD referenceTrue, WORD referenceFalse, int *item, int max) :
|
||||||
PanelItem(referenceTrue) {
|
PanelItem(referenceTrue) {
|
||||||
init(referenceTrue, referenceFalse);
|
init(referenceTrue, referenceFalse);
|
||||||
_itemmultiple = item;
|
_itemmultiple = item;
|
||||||
_itemmax = max;
|
_itemmax = max;
|
||||||
if (!*item)
|
if (!*item)
|
||||||
|
|
|
@ -34,7 +34,7 @@ Panel::Panel(int interleave_first, int interleave) : Toolbar() {
|
||||||
|
|
||||||
|
|
||||||
bool Panel::add(const String &name, const PanelItem *item) {
|
bool Panel::add(const String &name, const PanelItem *item) {
|
||||||
_itemsMap[name] = (PanelItem*)item;
|
_itemsMap[name] = (PanelItem *)item;
|
||||||
_itemsMap[name]->move(_currentItem, _y + 10);
|
_itemsMap[name]->move(_currentItem, _y + 10);
|
||||||
_itemsMap[name]->setPanel(this);
|
_itemsMap[name]->setPanel(this);
|
||||||
_currentItem += _interleave;
|
_currentItem += _interleave;
|
||||||
|
@ -47,11 +47,10 @@ bool Panel::draw(SDL_Surface *surface) {
|
||||||
if (!_drawn && _visible) {
|
if (!_drawn && _visible) {
|
||||||
GUIElement::draw(surface);
|
GUIElement::draw(surface);
|
||||||
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator) {
|
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator) {
|
||||||
((GUIElement*)(iterator->_value))->draw(surface);
|
((GUIElement *)(iterator->_value))->draw(surface);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ void Panel::forceRedraw() {
|
||||||
ItemMap::const_iterator iterator;
|
ItemMap::const_iterator iterator;
|
||||||
GUIElement::forceRedraw();
|
GUIElement::forceRedraw();
|
||||||
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator)
|
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator)
|
||||||
((GUIElement*)(iterator->_value))->forceRedraw();
|
((GUIElement *)(iterator->_value))->forceRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Panel::action(int x, int y, bool pushed) {
|
bool Panel::action(int x, int y, bool pushed) {
|
||||||
|
@ -69,7 +68,7 @@ bool Panel::action(int x, int y, bool pushed) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (iterator = _itemsMap.begin(); !result && iterator != _itemsMap.end(); ++iterator)
|
for (iterator = _itemsMap.begin(); !result && iterator != _itemsMap.end(); ++iterator)
|
||||||
result = ((GUIElement*)(iterator->_value))->action(x, y, pushed);
|
result = ((GUIElement *)(iterator->_value))->action(x, y, pushed);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
virtual bool action(int x, int y, bool pushed);
|
virtual bool action(int x, int y, bool pushed);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef HashMap<String, PanelItem*, Common::IgnoreCase_Hash , Common::IgnoreCase_EqualTo> ItemMap;
|
typedef HashMap<String, PanelItem *, Common::IgnoreCase_Hash , Common::IgnoreCase_EqualTo> ItemMap;
|
||||||
|
|
||||||
ItemMap _itemsMap;
|
ItemMap _itemsMap;
|
||||||
int _interleave;
|
int _interleave;
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace CEGUI {
|
||||||
class Panel;
|
class Panel;
|
||||||
|
|
||||||
class PanelItem : public GUIElement {
|
class PanelItem : public GUIElement {
|
||||||
friend class Panel;
|
friend class Panel;
|
||||||
public:
|
public:
|
||||||
PanelItem(WORD reference);
|
PanelItem(WORD reference);
|
||||||
virtual ~PanelItem();
|
virtual ~PanelItem();
|
||||||
|
|
|
@ -30,8 +30,9 @@ namespace CEGUI {
|
||||||
|
|
||||||
const char KEYBOARD_MAPPING_ALPHA[][14] = { {"abcdefghijklm"}, {"nopqrstuvwxyz"} };
|
const char KEYBOARD_MAPPING_ALPHA[][14] = { {"abcdefghijklm"}, {"nopqrstuvwxyz"} };
|
||||||
const char KEYBOARD_MAPPING_NUMERIC[][6] = { {"12345"}, {"67890"} };
|
const char KEYBOARD_MAPPING_NUMERIC[][6] = { {"12345"}, {"67890"} };
|
||||||
const int KEYBOARD_MAPPING_SPECIAL[][3][2] = { { {1,SDLK_ESCAPE}, {224,SDLK_UP}, {32,SDLK_SPACE} },
|
const int KEYBOARD_MAPPING_SPECIAL[][3][2] = { { {1, SDLK_ESCAPE}, {224, SDLK_UP}, {32, SDLK_SPACE} },
|
||||||
{ {224,SDLK_LEFT}, {224,SDLK_DOWN}, {224,SDLK_RIGHT} } };
|
{ {224, SDLK_LEFT}, {224, SDLK_DOWN}, {224, SDLK_RIGHT} }
|
||||||
|
};
|
||||||
|
|
||||||
PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
|
PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
|
||||||
setBackground(reference);
|
setBackground(reference);
|
||||||
|
@ -51,21 +52,23 @@ bool PanelKeyboard::action(int x, int y, bool pushed) {
|
||||||
int keyCode = 0;
|
int keyCode = 0;
|
||||||
if (x < 185) {
|
if (x < 185) {
|
||||||
// Alpha selection
|
// Alpha selection
|
||||||
keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y+20][((x + 10) / 14) - 1];
|
keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y + 20][((x + 10) / 14) - 1];
|
||||||
} else if (x >= 186 && x <= 255) {
|
} else if (x >= 186 && x <= 255) {
|
||||||
// Numeric selection
|
// Numeric selection
|
||||||
keyCode = keyAscii = KEYBOARD_MAPPING_NUMERIC[y >= _y+20][((x - 187 + 10) / 14) - 1];
|
keyCode = keyAscii = KEYBOARD_MAPPING_NUMERIC[y >= _y + 20][((x - 187 + 10) / 14) - 1];
|
||||||
} else if (x >= 258 && x <= 300) {
|
} else if (x >= 258 && x <= 300) {
|
||||||
// Special keys
|
// Special keys
|
||||||
keyAscii = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][0];
|
keyAscii = KEYBOARD_MAPPING_SPECIAL[y >= _y + 20][((x - 259 + 10) / 14) - 1][0];
|
||||||
keyCode = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][1];
|
keyCode = KEYBOARD_MAPPING_SPECIAL[y >= _y + 20][((x - 259 + 10) / 14) - 1][1];
|
||||||
} else if (x >= 302 && x <= 316) {
|
} else if (x >= 302 && x <= 316) {
|
||||||
if (y < _y +20) {
|
if (y < _y + 20) {
|
||||||
// Backspace
|
// Backspace
|
||||||
keyAscii = VK_BACK; keyCode = keyAscii;
|
keyAscii = VK_BACK;
|
||||||
|
keyCode = keyAscii;
|
||||||
} else {
|
} else {
|
||||||
// Enter
|
// Enter
|
||||||
keyAscii = 13; keyCode = 13;
|
keyAscii = 13;
|
||||||
|
keyCode = 13;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ SDL_ImageResource::SDL_ImageResource() :
|
||||||
_surface(0) {
|
_surface(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface* SDL_ImageResource::load(WORD resourceID) {
|
SDL_Surface *SDL_ImageResource::load(WORD resourceID) {
|
||||||
HRSRC resource;
|
HRSRC resource;
|
||||||
HGLOBAL resourceGlobal;
|
HGLOBAL resourceGlobal;
|
||||||
LPVOID resourcePointer;
|
LPVOID resourcePointer;
|
||||||
|
@ -62,7 +62,7 @@ SDL_Surface* SDL_ImageResource::load(WORD resourceID) {
|
||||||
return _surface;
|
return _surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface* SDL_ImageResource::get() {
|
SDL_Surface *SDL_ImageResource::get() {
|
||||||
return _surface;
|
return _surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace CEGUI {
|
||||||
class SDL_ImageResource {
|
class SDL_ImageResource {
|
||||||
public:
|
public:
|
||||||
SDL_ImageResource();
|
SDL_ImageResource();
|
||||||
SDL_Surface* load(WORD resourceID);
|
SDL_Surface *load(WORD resourceID);
|
||||||
SDL_Surface* get();
|
SDL_Surface *get();
|
||||||
int height();
|
int height();
|
||||||
int width();
|
int width();
|
||||||
virtual ~SDL_ImageResource();
|
virtual ~SDL_ImageResource();
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
namespace CEGUI {
|
namespace CEGUI {
|
||||||
|
|
||||||
ToolbarHandler::ToolbarHandler():
|
ToolbarHandler::ToolbarHandler():
|
||||||
_current(""), _active(NULL) {
|
_current(""), _active(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ToolbarHandler::add(const String &name, const Toolbar &toolbar) {
|
bool ToolbarHandler::add(const String &name, const Toolbar &toolbar) {
|
||||||
_toolbarMap[name] = (Toolbar*)&toolbar;
|
_toolbarMap[name] = (Toolbar *)&toolbar;
|
||||||
|
|
||||||
if (!_active) {
|
if (!_active) {
|
||||||
_active = &((Toolbar&)toolbar);
|
_active = &((Toolbar &)toolbar);
|
||||||
_current = name;
|
_current = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ bool ToolbarHandler::setActive(const String &name) {
|
||||||
return false;
|
return false;
|
||||||
if (_current == name)
|
if (_current == name)
|
||||||
return true;
|
return true;
|
||||||
_active->action(0, 0, false); // make sure any items are unpushed when changing toolbars (e.g. forced VK->main panel)
|
_active->action(0, 0, false); // make sure any items are unpushed when changing toolbars (e.g. forced VK->main panel)
|
||||||
_current = name;
|
_current = name;
|
||||||
_active = _toolbarMap[name];
|
_active = _toolbarMap[name];
|
||||||
_active->forceRedraw();
|
_active->forceRedraw();
|
||||||
|
@ -67,8 +67,7 @@ bool ToolbarHandler::action(int x, int y, bool pushed) {
|
||||||
return _active->action(x / 2, (y - _offset) / 2, pushed);
|
return _active->action(x / 2, (y - _offset) / 2, pushed);
|
||||||
else
|
else
|
||||||
return _active->action(x, y - _offset, pushed);
|
return _active->action(x, y - _offset, pushed);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +117,7 @@ int ToolbarHandler::getOffset() {
|
||||||
return _offset;
|
return _offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbar* ToolbarHandler::active() {
|
Toolbar *ToolbarHandler::active() {
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
virtual ~ToolbarHandler();
|
virtual ~ToolbarHandler();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
HashMap<String, Toolbar*, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _toolbarMap;
|
HashMap<String, Toolbar *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _toolbarMap;
|
||||||
String _current;
|
String _current;
|
||||||
Toolbar *_active;
|
Toolbar *_active;
|
||||||
int _offset;
|
int _offset;
|
||||||
|
|
|
@ -29,55 +29,55 @@
|
||||||
|
|
||||||
namespace CEKEYS {
|
namespace CEKEYS {
|
||||||
|
|
||||||
bool EventsBuffer::simulateKey(GUI::Key *key, bool pushed) {
|
bool EventsBuffer::simulateKey(GUI::Key *key, bool pushed) {
|
||||||
SDL_Event ev = {0};
|
SDL_Event ev = {0};
|
||||||
|
|
||||||
if (!key->keycode())
|
if (!key->keycode())
|
||||||
key->setKey(key->ascii(), key->ascii());
|
key->setKey(key->ascii(), key->ascii());
|
||||||
else if (!key->ascii())
|
else if (!key->ascii())
|
||||||
key->setKey(key->keycode());
|
key->setKey(key->keycode());
|
||||||
|
|
||||||
ev.type = (pushed ? SDL_KEYDOWN : SDL_KEYUP);
|
ev.type = (pushed ? SDL_KEYDOWN : SDL_KEYUP);
|
||||||
ev.key.keysym.unicode = (SDLMod)key->flags(); // HACK: put the flags into the unused unicode field
|
ev.key.keysym.unicode = (SDLMod)key->flags(); // HACK: put the flags into the unused unicode field
|
||||||
ev.key.keysym.sym = (SDLKey)key->keycode();
|
ev.key.keysym.sym = (SDLKey)key->keycode();
|
||||||
ev.key.keysym.mod = KMOD_RESERVED;
|
ev.key.keysym.mod = KMOD_RESERVED;
|
||||||
return (SDL_PushEvent(&ev) == 0);
|
return (SDL_PushEvent(&ev) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventsBuffer::simulateMouseMove(int x, int y) {
|
bool EventsBuffer::simulateMouseMove(int x, int y) {
|
||||||
SDL_Event ev = {0};
|
SDL_Event ev = {0};
|
||||||
|
|
||||||
ev.type = SDL_MOUSEMOTION;
|
ev.type = SDL_MOUSEMOTION;
|
||||||
ev.motion.x = x;
|
ev.motion.x = x;
|
||||||
ev.motion.y = y;
|
ev.motion.y = y;
|
||||||
return (SDL_PushEvent(&ev) == 0);
|
return (SDL_PushEvent(&ev) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventsBuffer::simulateMouseLeftClick(int x, int y, bool pushed) {
|
bool EventsBuffer::simulateMouseLeftClick(int x, int y, bool pushed) {
|
||||||
SDL_Event ev = {0};
|
SDL_Event ev = {0};
|
||||||
static bool state = false;
|
static bool state = false;
|
||||||
|
|
||||||
if (pushed == state) return 0;
|
if (pushed == state) return 0;
|
||||||
state = pushed;
|
state = pushed;
|
||||||
ev.type = (pushed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP);
|
ev.type = (pushed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP);
|
||||||
ev.button.button = SDL_BUTTON_LEFT;
|
ev.button.button = SDL_BUTTON_LEFT;
|
||||||
ev.button.x = x;
|
ev.button.x = x;
|
||||||
ev.button.y = y;
|
ev.button.y = y;
|
||||||
return (SDL_PushEvent(&ev) == 0);
|
return (SDL_PushEvent(&ev) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventsBuffer::simulateMouseRightClick(int x, int y, bool pushed) {
|
bool EventsBuffer::simulateMouseRightClick(int x, int y, bool pushed) {
|
||||||
SDL_Event ev = {0};
|
SDL_Event ev = {0};
|
||||||
static bool state = false;
|
static bool state = false;
|
||||||
|
|
||||||
if (pushed == state) return 0;
|
if (pushed == state) return 0;
|
||||||
state = pushed;
|
state = pushed;
|
||||||
ev.type = (pushed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP);
|
ev.type = (pushed ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP);
|
||||||
ev.button.button = SDL_BUTTON_RIGHT;
|
ev.button.button = SDL_BUTTON_RIGHT;
|
||||||
ev.button.x = x;
|
ev.button.x = x;
|
||||||
ev.button.y = y;
|
ev.button.y = y;
|
||||||
return (SDL_PushEvent(&ev) == 0);
|
return (SDL_PushEvent(&ev) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,14 @@
|
||||||
|
|
||||||
namespace CEKEYS {
|
namespace CEKEYS {
|
||||||
|
|
||||||
class EventsBuffer {
|
class EventsBuffer {
|
||||||
public:
|
public:
|
||||||
static bool simulateKey(GUI::Key *key, bool pushed);
|
static bool simulateKey(GUI::Key *key, bool pushed);
|
||||||
static bool simulateMouseMove(int x, int y);
|
static bool simulateMouseMove(int x, int y);
|
||||||
static bool simulateMouseLeftClick(int x, int y, bool pushed);
|
static bool simulateMouseLeftClick(int x, int y, bool pushed);
|
||||||
static bool simulateMouseRightClick(int x, int y, bool pushed);
|
static bool simulateMouseRightClick(int x, int y, bool pushed);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#define strdup _strdup
|
#define strdup _strdup
|
||||||
|
|
||||||
#ifndef _FILE_DEFINED
|
#ifndef _FILE_DEFINED
|
||||||
typedef void FILE;
|
typedef void FILE;
|
||||||
#define _FILE_DEFINED
|
#define _FILE_DEFINED
|
||||||
#endif
|
#endif
|
||||||
FILE* wce_fopen(const char* fname, const char* fmode);
|
FILE *wce_fopen(const char *fname, const char *fmode);
|
||||||
#define fopen wce_fopen
|
#define fopen wce_fopen
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ char *strdup(const char *strSource);
|
||||||
// common missing functions required by both gcc and evc
|
// common missing functions required by both gcc and evc
|
||||||
|
|
||||||
void *bsearch(const void *key, const void *base, size_t nmemb,
|
void *bsearch(const void *key, const void *base, size_t nmemb,
|
||||||
size_t size, int (*compar)(const void *, const void *)) {
|
size_t size, int (*compar)(const void *, const void *)) {
|
||||||
// Perform binary search
|
// Perform binary search
|
||||||
size_t lo = 0;
|
size_t lo = 0;
|
||||||
size_t hi = nmemb;
|
size_t hi = nmemb;
|
||||||
|
@ -69,11 +69,11 @@ void *bsearch(const void *key, const void *base, size_t nmemb,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char cwd[MAX_PATH+1] = "";
|
static char cwd[MAX_PATH + 1] = "";
|
||||||
|
|
||||||
EXT_C char *getcwd(char *buffer, int maxlen) {
|
EXT_C char *getcwd(char *buffer, int maxlen) {
|
||||||
TCHAR fileUnc[MAX_PATH+1];
|
TCHAR fileUnc[MAX_PATH + 1];
|
||||||
char* plast;
|
char *plast;
|
||||||
|
|
||||||
if (cwd[0] == 0) {
|
if (cwd[0] == 0) {
|
||||||
GetModuleFileName(NULL, fileUnc, MAX_PATH);
|
GetModuleFileName(NULL, fileUnc, MAX_PATH);
|
||||||
|
@ -94,7 +94,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) {
|
||||||
#undef GetCurrentDirectory
|
#undef GetCurrentDirectory
|
||||||
#endif
|
#endif
|
||||||
EXT_C void GetCurrentDirectory(int len, char *buf) {
|
EXT_C void GetCurrentDirectory(int len, char *buf) {
|
||||||
getcwd(buf,len);
|
getcwd(buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -103,8 +103,8 @@ fully qualified paths refer to root folder rather
|
||||||
than current folder (concept not implemented in CE).
|
than current folder (concept not implemented in CE).
|
||||||
*/
|
*/
|
||||||
#undef fopen
|
#undef fopen
|
||||||
EXT_C FILE *wce_fopen(const char* fname, const char* fmode) {
|
EXT_C FILE *wce_fopen(const char *fname, const char *fmode) {
|
||||||
char fullname[MAX_PATH+1];
|
char fullname[MAX_PATH + 1];
|
||||||
|
|
||||||
if (!fname || fname[0] == '\0')
|
if (!fname || fname[0] == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -118,8 +118,8 @@ EXT_C FILE *wce_fopen(const char* fname, const char* fmode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove file by name */
|
/* Remove file by name */
|
||||||
int remove(const char* path) {
|
int remove(const char *path) {
|
||||||
TCHAR pathUnc[MAX_PATH+1];
|
TCHAR pathUnc[MAX_PATH + 1];
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH);
|
||||||
return !DeleteFile(pathUnc);
|
return !DeleteFile(pathUnc);
|
||||||
}
|
}
|
||||||
|
@ -128,15 +128,15 @@ int remove(const char* path) {
|
||||||
/* check out file access permissions */
|
/* check out file access permissions */
|
||||||
int _access(const char *path, int mode) {
|
int _access(const char *path, int mode) {
|
||||||
TCHAR fname[MAX_PATH];
|
TCHAR fname[MAX_PATH];
|
||||||
char fullname[MAX_PATH+1];
|
char fullname[MAX_PATH + 1];
|
||||||
|
|
||||||
if (path[0] != '\\' && path[0] != '/') {
|
if (path[0] != '\\' && path[0] != '/') {
|
||||||
getcwd(fullname, MAX_PATH);
|
getcwd(fullname, MAX_PATH);
|
||||||
strcat(fullname, "\\");
|
strcat(fullname, "\\");
|
||||||
strcat(fullname, path);
|
strcat(fullname, path);
|
||||||
MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname)/sizeof(TCHAR));
|
MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR));
|
||||||
} else
|
} else
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, fname, sizeof(fname)/sizeof(TCHAR));
|
MultiByteToWideChar(CP_ACP, 0, path, -1, fname, sizeof(fname) / sizeof(TCHAR));
|
||||||
|
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
HANDLE h = FindFirstFile(fname, &ffd);
|
HANDLE h = FindFirstFile(fname, &ffd);
|
||||||
|
@ -144,10 +144,10 @@ int _access(const char *path, int mode) {
|
||||||
|
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
// WORKAROUND: WinCE 3.0 doesn't find paths ending in '\'
|
// WORKAROUND: WinCE 3.0 doesn't find paths ending in '\'
|
||||||
if (path[strlen(path)-1] == '\\') {
|
if (path[strlen(path) - 1] == '\\') {
|
||||||
char p2[MAX_PATH];
|
char p2[MAX_PATH];
|
||||||
strncpy(p2, path, strlen(path)-1);
|
strncpy(p2, path, strlen(path) - 1);
|
||||||
p2[strlen(path) - 1]= '\0';
|
p2[strlen(path) - 1] = '\0';
|
||||||
return _access(p2, mode);
|
return _access(p2, mode);
|
||||||
} else
|
} else
|
||||||
return -1; //Can't find file
|
return -1; //Can't find file
|
||||||
|
@ -170,13 +170,13 @@ int _access(const char *path, int mode) {
|
||||||
return 0; //Always return success if target is directory and exists
|
return 0; //Always return success if target is directory and exists
|
||||||
}
|
}
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 00: //Check existence
|
case 00: //Check existence
|
||||||
return 0;
|
return 0;
|
||||||
case 06: //Check Read & Write permission
|
case 06: //Check Read & Write permission
|
||||||
case 02: //Check Write permission
|
case 02: //Check Write permission
|
||||||
return ffd.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? -1 : 0;
|
return ffd.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? -1 : 0;
|
||||||
case 04: //Check Read permission
|
case 04: //Check Read permission
|
||||||
return 0; //Assume always have read permission
|
return 0; //Assume always have read permission
|
||||||
}
|
}
|
||||||
//Bad mode value supplied, return failure
|
//Bad mode value supplied, return failure
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -188,7 +188,7 @@ int _access(const char *path, int mode) {
|
||||||
char *strdup(const char *strSource) {
|
char *strdup(const char *strSource) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
size_z len = strlen(strSource) + 1;
|
size_z len = strlen(strSource) + 1;
|
||||||
buffer = (char*)malloc(len);
|
buffer = (char *)malloc(len);
|
||||||
if (buffer)
|
if (buffer)
|
||||||
memcpy(buffer, strSource, len);
|
memcpy(buffer, strSource, len);
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -199,25 +199,25 @@ char *strdup(const char *strSource) {
|
||||||
|
|
||||||
#ifndef __MINGW32CE__
|
#ifndef __MINGW32CE__
|
||||||
int islower(int c) {
|
int islower(int c) {
|
||||||
return (c>='a' && c<='z');
|
return (c >= 'a' && c <= 'z');
|
||||||
}
|
}
|
||||||
|
|
||||||
int isspace(int c) {
|
int isspace(int c) {
|
||||||
return (c==' ' || c=='\f' || c=='\n' || c=='\r' || c=='\t' || c=='\v');
|
return (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v');
|
||||||
}
|
}
|
||||||
|
|
||||||
int isalpha(int c) {
|
int isalpha(int c) {
|
||||||
return ((c>='a' && c<='z') || (c>='A' && c<='Z'));
|
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
|
||||||
}
|
}
|
||||||
|
|
||||||
int isalnum(int c) {
|
int isalnum(int c) {
|
||||||
return ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9'));
|
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'));
|
||||||
}
|
}
|
||||||
|
|
||||||
int isprint(int c) {
|
int isprint(int c) {
|
||||||
//static const char punct[] = "!\"#%&'();<=>?[\\]*+,-./:^_{|}~";
|
//static const char punct[] = "!\"#%&'();<=>?[\\]*+,-./:^_{|}~";
|
||||||
//return (isalnum(c) || strchr(punct, c));
|
//return (isalnum(c) || strchr(punct, c));
|
||||||
return (32 <= c && c <= 126); // based on BSD manpage
|
return (32 <= c && c <= 126); // based on BSD manpage
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifndef __MINGW32CE__
|
#ifndef __MINGW32CE__
|
||||||
struct tm
|
struct tm {
|
||||||
{
|
|
||||||
short tm_year;
|
short tm_year;
|
||||||
short tm_mon;
|
short tm_mon;
|
||||||
short tm_mday;
|
short tm_mday;
|
||||||
|
@ -23,8 +22,8 @@ struct tm
|
||||||
#define EXT_C
|
#define EXT_C
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXT_C time_t time(time_t* dummy);
|
EXT_C time_t time(time_t *dummy);
|
||||||
EXT_C struct tm* localtime(time_t* dummy);
|
EXT_C struct tm *localtime(time_t *dummy);
|
||||||
|
|
||||||
unsigned int clock();
|
unsigned int clock();
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ int isprint(int c);
|
||||||
int isspace(int c);
|
int isspace(int c);
|
||||||
char *strrchr(const char *s, int c);
|
char *strrchr(const char *s, int c);
|
||||||
char *strdup(const char *s);
|
char *strdup(const char *s);
|
||||||
int _stricmp( const char *string1, const char *string2 );
|
int _stricmp(const char *string1, const char *string2);
|
||||||
int stricmp( const char *string1, const char *string2 );
|
int stricmp(const char *string1, const char *string2);
|
||||||
void assert( void* expression );
|
void assert(void *expression);
|
||||||
void assert( int expression );
|
void assert(int expression);
|
||||||
long int strtol(const char *nptr, char **endptr, int base);
|
long int strtol(const char *nptr, char **endptr, int base);
|
||||||
char *_strdup(const char *s);
|
char *_strdup(const char *s);
|
||||||
char *strpbrk(const char *s, const char *accept);
|
char *strpbrk(const char *s, const char *accept);
|
||||||
|
@ -47,20 +47,20 @@ char *strpbrk(const char *s, const char *accept);
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
void *bsearch(const void *, const void *, size_t, size_t, int (*x) (const void *, const void *));
|
void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
|
||||||
char *getcwd(char *buf, int size);
|
char *getcwd(char *buf, int size);
|
||||||
typedef int ptrdiff_t;
|
typedef int ptrdiff_t;
|
||||||
void GetCurrentDirectory(int len, char *buf);
|
void GetCurrentDirectory(int len, char *buf);
|
||||||
#define INVALID_FILE_ATTRIBUTES 0xffffffff
|
#define INVALID_FILE_ATTRIBUTES 0xffffffff
|
||||||
#else
|
#else
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#undef GetCurrentDirectory
|
#undef GetCurrentDirectory
|
||||||
extern "C" void GetCurrentDirectory(int len, char *buf);
|
extern "C" void GetCurrentDirectory(int len, char *buf);
|
||||||
#define stricmp _stricmp
|
#define stricmp _stricmp
|
||||||
#define strnicmp _strnicmp
|
#define strnicmp _strnicmp
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define strdup _strdup
|
#define strdup _strdup
|
||||||
#define fopen wce_fopen
|
#define fopen wce_fopen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -75,12 +75,12 @@ char *strpbrk(const char *s, const char *accept);
|
||||||
//#include <direct.h>
|
//#include <direct.h>
|
||||||
|
|
||||||
#ifdef __MINGW32CE__
|
#ifdef __MINGW32CE__
|
||||||
void *bsearch(const void *, const void *, size_t, size_t, int (*x) (const void *, const void *));
|
void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
|
||||||
#endif
|
#endif
|
||||||
int remove(const char *path);
|
int remove(const char *path);
|
||||||
int _access(const char *path, int mode);
|
int _access(const char *path, int mode);
|
||||||
|
|
||||||
void drawError(char*);
|
void drawError(char *);
|
||||||
|
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
extern "C" _CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
|
extern "C" _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace CEGUI;
|
using namespace CEGUI;
|
||||||
|
@ -99,7 +99,7 @@ bool isSmartphone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCHAR *ASCIItoUnicode(const char *str) {
|
const TCHAR *ASCIItoUnicode(const char *str) {
|
||||||
static TCHAR ustr[MAX_PATH]; // size good enough
|
static TCHAR ustr[MAX_PATH]; // size good enough
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, str, strlen(str) + 1, ustr, sizeof(ustr) / sizeof(TCHAR));
|
MultiByteToWideChar(CP_ACP, 0, str, strlen(str) + 1, ustr, sizeof(ustr) / sizeof(TCHAR));
|
||||||
return ustr;
|
return ustr;
|
||||||
|
@ -128,7 +128,7 @@ int SDL_main(int argc, char **argv) {
|
||||||
// thanks to joostp and DJWillis
|
// thanks to joostp and DJWillis
|
||||||
extern void (*__CTOR_LIST__)();
|
extern void (*__CTOR_LIST__)();
|
||||||
void (**constructor)() = &__CTOR_LIST__;
|
void (**constructor)() = &__CTOR_LIST__;
|
||||||
constructor++; // First item in list of constructors has special meaning (platform dependent), ignore it.
|
constructor++; // First item in list of constructors has special meaning (platform dependent), ignore it.
|
||||||
while (*constructor) {
|
while (*constructor) {
|
||||||
(*constructor)();
|
(*constructor)();
|
||||||
constructor++;
|
constructor++;
|
||||||
|
@ -193,10 +193,10 @@ int SDL_main(int argc, char **argv) {
|
||||||
res = scummvm_main(argc, argv);
|
res = scummvm_main(argc, argv);
|
||||||
|
|
||||||
// Free OSystem
|
// Free OSystem
|
||||||
delete (OSystem_WINCE3 *)g_system;
|
delete(OSystem_WINCE3 *)g_system;
|
||||||
#if !defined(DEBUG) && !defined(__GNUC__)
|
#if !defined(DEBUG) && !defined(__GNUC__)
|
||||||
}
|
}
|
||||||
__except (handleException(GetExceptionInformation())) {
|
__except(handleException(GetExceptionInformation())) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -219,22 +219,22 @@ int console_main(int argc, char *argv[]) {
|
||||||
char *bufp, *appname;
|
char *bufp, *appname;
|
||||||
|
|
||||||
appname = argv[0];
|
appname = argv[0];
|
||||||
if ( (bufp=strrchr(argv[0], '\\')) != NULL )
|
if ((bufp = strrchr(argv[0], '\\')) != NULL)
|
||||||
appname = bufp + 1;
|
appname = bufp + 1;
|
||||||
else if ( (bufp=strrchr(argv[0], '/')) != NULL )
|
else if ((bufp = strrchr(argv[0], '/')) != NULL)
|
||||||
appname = bufp + 1;
|
appname = bufp + 1;
|
||||||
|
|
||||||
if ( (bufp=strrchr(appname, '.')) == NULL )
|
if ((bufp = strrchr(appname, '.')) == NULL)
|
||||||
n = strlen(appname);
|
n = strlen(appname);
|
||||||
else
|
else
|
||||||
n = (bufp-appname);
|
n = (bufp - appname);
|
||||||
|
|
||||||
bufp = (char *) alloca(n + 1);
|
bufp = (char *) alloca(n + 1);
|
||||||
strncpy(bufp, appname, n);
|
strncpy(bufp, appname, n);
|
||||||
bufp[n] = '\0';
|
bufp[n] = '\0';
|
||||||
appname = bufp;
|
appname = bufp;
|
||||||
|
|
||||||
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
|
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
|
||||||
error("WinMain() error: %d", SDL_GetError());
|
error("WinMain() error: %d", SDL_GetError());
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -299,31 +299,31 @@ int dynamic_modules_main(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int
|
||||||
int nLen;
|
int nLen;
|
||||||
|
|
||||||
if (wcsncmp(szCmdLine, TEXT("\\"), 1)) {
|
if (wcsncmp(szCmdLine, TEXT("\\"), 1)) {
|
||||||
nLen = wcslen(szCmdLine)+128+1;
|
nLen = wcslen(szCmdLine) + 128 + 1;
|
||||||
bufp = (wchar_t *) alloca(nLen*2);
|
bufp = (wchar_t *) alloca(nLen * 2);
|
||||||
wcscpy (bufp, TEXT("\""));
|
wcscpy(bufp, TEXT("\""));
|
||||||
GetModuleFileName(NULL, bufp+1, 128-3);
|
GetModuleFileName(NULL, bufp + 1, 128 - 3);
|
||||||
wcscpy (bufp+wcslen(bufp), TEXT("\" "));
|
wcscpy(bufp + wcslen(bufp), TEXT("\" "));
|
||||||
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
|
wcsncpy(bufp + wcslen(bufp), szCmdLine, nLen - wcslen(bufp));
|
||||||
} else
|
} else
|
||||||
bufp = szCmdLine;
|
bufp = szCmdLine;
|
||||||
|
|
||||||
nLen = wcslen(bufp)+1;
|
nLen = wcslen(bufp) + 1;
|
||||||
cmdline = (char *) alloca(nLen);
|
cmdline = (char *) alloca(nLen);
|
||||||
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
|
||||||
|
|
||||||
// Parse command line into argv and argc
|
// Parse command line into argv and argc
|
||||||
argc = ParseCommandLine(cmdline, NULL);
|
argc = ParseCommandLine(cmdline, NULL);
|
||||||
argv = (char **) alloca((argc+1)*(sizeof *argv));
|
argv = (char **) alloca((argc + 1) * (sizeof * argv));
|
||||||
ParseCommandLine(cmdline, argv);
|
ParseCommandLine(cmdline, argv);
|
||||||
|
|
||||||
// fix gdb-emulator combo
|
// fix gdb-emulator combo
|
||||||
while (argc > 1 && !strstr(argv[0], ".exe")) {
|
while (argc > 1 && !strstr(argv[0], ".exe")) {
|
||||||
OutputDebugString(TEXT("SDL: gdb argv[0] fixup\n"));
|
OutputDebugString(TEXT("SDL: gdb argv[0] fixup\n"));
|
||||||
*(argv[1]-1) = ' ';
|
*(argv[1] - 1) = ' ';
|
||||||
int i;
|
int i;
|
||||||
for (i=1; i<argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
argv[i] = argv[i+1];
|
argv[i] = argv[i + 1];
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ void OSystem_WINCE3::initBackend() {
|
||||||
// We work around this by using the SetTimer function, since we only use
|
// We work around this by using the SetTimer function, since we only use
|
||||||
// one timer in scummvm (for the time being)
|
// one timer in scummvm (for the time being)
|
||||||
_timer = _int_timer = new DefaultTimerManager();
|
_timer = _int_timer = new DefaultTimerManager();
|
||||||
//_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
|
//_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
|
||||||
SDL_SetTimer(10, &timer_handler_wrapper);
|
SDL_SetTimer(10, &timer_handler_wrapper);
|
||||||
|
|
||||||
// Chain init
|
// Chain init
|
||||||
|
@ -393,9 +393,9 @@ void OSystem_WINCE3::initBackend() {
|
||||||
// Initialize global key mapping
|
// Initialize global key mapping
|
||||||
GUI::Actions::init();
|
GUI::Actions::init();
|
||||||
GUI_Actions::Instance()->initInstanceMain(this);
|
GUI_Actions::Instance()->initInstanceMain(this);
|
||||||
if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version
|
if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version
|
||||||
warning("Setting default action mappings");
|
warning("Setting default action mappings");
|
||||||
GUI_Actions::Instance()->saveMapping(); // write defaults
|
GUI_Actions::Instance()->saveMapping(); // write defaults
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call parent implementation of this method
|
// Call parent implementation of this method
|
||||||
|
@ -437,8 +437,7 @@ Common::String OSystem_WINCE3::getDefaultConfigFileName() {
|
||||||
|
|
||||||
|
|
||||||
OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
|
OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
|
||||||
_forcePanelInvisible(false)
|
_forcePanelInvisible(false) {
|
||||||
{
|
|
||||||
// Initialze File System Factory
|
// Initialze File System Factory
|
||||||
_fsFactory = new WindowsFilesystemFactory();
|
_fsFactory = new WindowsFilesystemFactory();
|
||||||
_mixer = 0;
|
_mixer = 0;
|
||||||
|
@ -458,8 +457,8 @@ void OSystem_WINCE3::swap_sound_master() {
|
||||||
|
|
||||||
//WINCESdlGraphicsManager _graphicsManager
|
//WINCESdlGraphicsManager _graphicsManager
|
||||||
|
|
||||||
if (((WINCESdlGraphicsManager*)_graphicsManager)->_toolbarHandler.activeName() == NAME_MAIN_PANEL)
|
if (((WINCESdlGraphicsManager *)_graphicsManager)->_toolbarHandler.activeName() == NAME_MAIN_PANEL)
|
||||||
((WINCESdlGraphicsManager*)_graphicsManager)->_toolbarHandler.forceRedraw(); // redraw sound icon
|
((WINCESdlGraphicsManager *)_graphicsManager)->_toolbarHandler.forceRedraw(); // redraw sound icon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,7 +479,7 @@ void OSystem_WINCE3::check_mappings() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GUI_Actions::Instance()->initInstanceGame();
|
GUI_Actions::Instance()->initInstanceGame();
|
||||||
instance = (CEActionsPocket*)GUI_Actions::Instance();
|
instance = (CEActionsPocket *)GUI_Actions::Instance();
|
||||||
|
|
||||||
// Some games need to map the right click button, signal it here if it wasn't done
|
// Some games need to map the right click button, signal it here if it wasn't done
|
||||||
if (instance->needsRightClickMapping()) {
|
if (instance->needsRightClickMapping()) {
|
||||||
|
@ -520,7 +519,7 @@ void OSystem_WINCE3::check_mappings() {
|
||||||
|
|
||||||
// Extra warning for Zak Mc Kracken
|
// Extra warning for Zak Mc Kracken
|
||||||
if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
|
if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
|
||||||
!GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
|
!GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
|
||||||
GUI::MessageDialog alert(_("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"));
|
GUI::MessageDialog alert(_("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"));
|
||||||
alert.runModal();
|
alert.runModal();
|
||||||
}
|
}
|
||||||
|
@ -570,12 +569,12 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
|
||||||
SYSTEMTIME systime;
|
SYSTEMTIME systime;
|
||||||
|
|
||||||
GetLocalTime(&systime);
|
GetLocalTime(&systime);
|
||||||
t.tm_year = systime.wYear - 1900;
|
t.tm_year = systime.wYear - 1900;
|
||||||
t.tm_mon = systime.wMonth - 1;
|
t.tm_mon = systime.wMonth - 1;
|
||||||
t.tm_mday = systime.wDay;
|
t.tm_mday = systime.wDay;
|
||||||
t.tm_hour = systime.wHour;
|
t.tm_hour = systime.wHour;
|
||||||
t.tm_min = systime.wMinute;
|
t.tm_min = systime.wMinute;
|
||||||
t.tm_sec = systime.wSecond;
|
t.tm_sec = systime.wSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OSystem_WINCE3::_platformScreenWidth;
|
int OSystem_WINCE3::_platformScreenWidth;
|
||||||
|
|
|
@ -70,8 +70,8 @@ public:
|
||||||
static void initScreenInfos();
|
static void initScreenInfos();
|
||||||
static bool isOzone();
|
static bool isOzone();
|
||||||
|
|
||||||
static bool _soundMaster; // turn off sound after all calculations
|
static bool _soundMaster; // turn off sound after all calculations
|
||||||
// static since needed by the SDL callback
|
// static since needed by the SDL callback
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initSDL();
|
void initSDL();
|
||||||
|
@ -82,11 +82,11 @@ protected:
|
||||||
private:
|
private:
|
||||||
void check_mappings();
|
void check_mappings();
|
||||||
|
|
||||||
bool _forcePanelInvisible; // force panel visibility for some cases
|
bool _forcePanelInvisible; // force panel visibility for some cases
|
||||||
|
|
||||||
static int _platformScreenWidth;
|
static int _platformScreenWidth;
|
||||||
static int _platformScreenHeight;
|
static int _platformScreenHeight;
|
||||||
static bool _isOzone; // true if running on Windows 2003 SE
|
static bool _isOzone; // true if running on Windows 2003 SE
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue