mirror of https://github.com/stella-emu/stella.git
Added fixes for WinCE port from Kostas Nakos. There may still be some
things missing though. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@815 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
b7d13671cd
commit
5ef87c8065
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferGL.hxx,v 1.24 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.25 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -37,7 +37,7 @@ class GUI::Font;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.24 2005-09-15 19:43:36 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.25 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -188,14 +188,6 @@ class FrameBufferGL : public FrameBuffer
|
|||
*/
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
|
||||
/**
|
||||
Returns the current line dimensions (width/height) used by
|
||||
hLine() and vLine().
|
||||
|
||||
@return The line width/height (both are the same)
|
||||
*/
|
||||
virtual uInt32 lineDim() { return 1; /* zooming done at hardware level */ }
|
||||
|
||||
private:
|
||||
bool createTextures();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.hxx,v 1.24 2005-09-18 14:38:52 optixx Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.25 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||
|
@ -35,7 +35,7 @@ class RectList;
|
|||
This class implements an SDL software framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.24 2005-09-18 14:38:52 optixx Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.25 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -186,14 +186,6 @@ class FrameBufferSoft : public FrameBuffer
|
|||
*/
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
|
||||
/**
|
||||
Returns the current line dimensions (width/height) used by
|
||||
hLine() and vLine().
|
||||
|
||||
@return The line width/height (both are the same)
|
||||
*/
|
||||
virtual uInt32 lineDim() { return theZoomLevel; }
|
||||
|
||||
protected:
|
||||
// Used in the dirty update of the SDL surface
|
||||
RectList* myRectList;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Cart3E.cxx,v 1.6 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: Cart3E.cxx,v 1.7 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -39,7 +39,7 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 32768; ++i)
|
||||
{
|
||||
myRam[i] = random.next();
|
||||
|
@ -199,6 +199,7 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
|
||||
uInt32 offset = bank * 1024;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt32 address;
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
System::PageAccess access;
|
||||
|
@ -206,7 +207,7 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
access.directPokeBase = 0;
|
||||
|
||||
// Map read-port RAM image into the system
|
||||
for(uInt32 address = 0x1000; address < 0x1400; address += (1 << shift))
|
||||
for(address = 0x1000; address < 0x1400; address += (1 << shift))
|
||||
{
|
||||
access.directPeekBase = &myRam[offset + (address & 0x03FF)];
|
||||
mySystem->setPageAccess(address >> shift, access);
|
||||
|
@ -215,7 +216,7 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
access.directPeekBase = 0;
|
||||
|
||||
// Map write-port RAM image into the system
|
||||
for(uInt32 address = 0x1400; address < 0x1800; address += (1 << shift))
|
||||
for(address = 0x1400; address < 0x1800; address += (1 << shift))
|
||||
{
|
||||
access.directPokeBase = &myRam[offset + (address & 0x03FF)];
|
||||
mySystem->setPageAccess(address >> shift, access);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartAR.cxx,v 1.10 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartAR.cxx,v 1.11 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -38,7 +38,7 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size)
|
|||
memcpy(myLoadImages, image, size);
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(i = 0; i < 6 * 1024; ++i)
|
||||
{
|
||||
myImage[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartCV.cxx,v 1.8 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartCV.cxx,v 1.9 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -37,7 +37,7 @@ CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 1024; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartDPC.cxx,v 1.12 2005-07-30 19:14:35 urchlay Exp $
|
||||
// $Id: CartDPC.cxx,v 1.13 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -593,15 +593,16 @@ bool CartridgeDPC::load(Deserializer& in)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8* CartridgeDPC::getImage(int& size) {
|
||||
uInt8* CartridgeDPC::getImage(int& size)
|
||||
{
|
||||
size = 8192 + 2048 + 255;
|
||||
|
||||
for(int i=0; i<8192; i++)
|
||||
int i;
|
||||
for(i = 0; i < 8192; i++)
|
||||
myImageCopy[i] = myProgramImage[i];
|
||||
|
||||
for(int i=0; i<2048; i++)
|
||||
for(i = 0; i < 2048; i++)
|
||||
myImageCopy[i + 8192] = myDisplayImage[i];
|
||||
|
||||
return &myImageCopy[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartE7.cxx,v 1.10 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartE7.cxx,v 1.11 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +34,7 @@ CartridgeE7::CartridgeE7(const uInt8* image)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 2048; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartF4SC.cxx,v 1.7 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartF4SC.cxx,v 1.8 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +34,7 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 128; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartF6SC.cxx,v 1.7 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartF6SC.cxx,v 1.8 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +34,7 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 128; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartF8SC.cxx,v 1.6 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartF8SC.cxx,v 1.7 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +34,7 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 128; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartFASC.cxx,v 1.6 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartFASC.cxx,v 1.7 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -34,7 +34,7 @@ CartridgeFASC::CartridgeFASC(const uInt8* image)
|
|||
}
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(uInt32 i = 0; i < 256; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CartMC.cxx,v 1.7 2005-07-30 16:58:22 urchlay Exp $
|
||||
// $Id: CartMC.cxx,v 1.8 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -37,7 +37,7 @@ CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size)
|
|||
myRAM = new uInt8[32 * 1024];
|
||||
|
||||
// Initialize RAM with random values
|
||||
Random random;
|
||||
class Random random;
|
||||
for(i = 0; i < 32 * 1024; ++i)
|
||||
{
|
||||
myRAM[i] = random.next();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventHandler.cxx,v 1.103 2005-10-02 19:10:39 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.104 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -69,6 +69,8 @@ EventHandler::EventHandler(OSystem* osystem)
|
|||
myPaddleMode(0),
|
||||
myMouseMove(3)
|
||||
{
|
||||
uInt32 i;
|
||||
|
||||
// Add this eventhandler object to the OSystem
|
||||
myOSystem->attach(this);
|
||||
|
||||
|
@ -76,14 +78,14 @@ EventHandler::EventHandler(OSystem* osystem)
|
|||
myEvent = new Event();
|
||||
|
||||
// Erase the KeyEvent arrays
|
||||
for(Int32 i = 0; i < SDLK_LAST; ++i)
|
||||
for(i = 0; i < SDLK_LAST; ++i)
|
||||
{
|
||||
myKeyTable[i] = Event::NoType;
|
||||
ourSDLMapping[i] = "";
|
||||
}
|
||||
|
||||
// Erase the JoyEvent array
|
||||
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||
for(i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||
myJoyTable[i] = Event::NoType;
|
||||
|
||||
// Erase the Message array
|
||||
|
@ -1133,10 +1135,12 @@ void EventHandler::setActionMappings()
|
|||
// Fill the ActionList with the current key and joystick mappings
|
||||
for(Int32 i = 0; i < 62; ++i)
|
||||
{
|
||||
uInt32 j;
|
||||
|
||||
Event::Type event = ourActionList[i].event;
|
||||
ourActionList[i].key = "None";
|
||||
string key = "";
|
||||
for(uInt32 j = 0; j < SDLK_LAST; ++j) // size of myKeyTable
|
||||
for(j = 0; j < SDLK_LAST; ++j) // size of myKeyTable
|
||||
{
|
||||
if(myKeyTable[j] == event)
|
||||
{
|
||||
|
@ -1146,7 +1150,7 @@ void EventHandler::setActionMappings()
|
|||
key = key + ", " + ourSDLMapping[j];
|
||||
}
|
||||
}
|
||||
for(uInt32 j = 0; j < kNumJoysticks * kNumJoyButtons; ++j)
|
||||
for(j = 0; j < kNumJoysticks * kNumJoyButtons; ++j)
|
||||
{
|
||||
if(myJoyTable[j] == event)
|
||||
{
|
||||
|
@ -1276,14 +1280,16 @@ void EventHandler::addJoyMapping(Event::Type event, uInt8 stick, uInt32 code)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::eraseMapping(Event::Type event)
|
||||
{
|
||||
uInt32 i;
|
||||
|
||||
// Erase the KeyEvent arrays
|
||||
for(Int32 i = 0; i < SDLK_LAST; ++i)
|
||||
for(i = 0; i < SDLK_LAST; ++i)
|
||||
if(myKeyTable[i] == event && i != SDLK_TAB && i != SDLK_ESCAPE)
|
||||
myKeyTable[i] = Event::NoType;
|
||||
saveKeyMapping();
|
||||
|
||||
// Erase the JoyEvent array
|
||||
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||
for(i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||
if(myJoyTable[i] == event)
|
||||
myJoyTable[i] = Event::NoType;
|
||||
saveJoyMapping();
|
||||
|
@ -1949,6 +1955,8 @@ void EventHandler::setSDLMappings()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// FIXME - this must be handled better in the future ///
|
||||
#ifndef _WIN32_WCE
|
||||
ActionList EventHandler::ourActionList[62] = {
|
||||
{ Event::ConsoleSelect, "Select", "" },
|
||||
{ Event::ConsoleReset, "Reset", "" },
|
||||
|
@ -2021,6 +2029,9 @@ ActionList EventHandler::ourActionList[62] = {
|
|||
{ Event::KeyboardOne0, "P2 GamePad 0", "" },
|
||||
{ Event::KeyboardOnePound, "P2 GamePad #", "" }
|
||||
};
|
||||
#else
|
||||
ActionList EventHandler::ourActionList[62];
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Event::Type EventHandler::Paddle_Resistance[4] = {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBuffer.hxx,v 1.57 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.58 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -52,7 +52,7 @@ enum FrameStyle {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.57 2005-09-15 19:43:36 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.58 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ class FrameBuffer
|
|||
|
||||
@param palette The array of colors
|
||||
*/
|
||||
void setPalette(const uInt32* palette);
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
|
||||
/**
|
||||
This method should be called to draw a rectangular box with sides
|
||||
|
@ -394,14 +394,6 @@ class FrameBuffer
|
|||
*/
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) = 0;
|
||||
|
||||
/**
|
||||
Returns the current line dimensions (width/height) used by
|
||||
hLine() and vLine().
|
||||
|
||||
@return The line width/height (both are the same)
|
||||
*/
|
||||
virtual uInt32 lineDim() = 0;
|
||||
|
||||
protected:
|
||||
// The parent system for the framebuffer
|
||||
OSystem* myOSystem;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: M6532.cxx,v 1.4 2005-06-16 00:55:58 stephena Exp $
|
||||
// $Id: M6532.cxx,v 1.5 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -31,7 +31,7 @@ M6532::M6532(const Console& console)
|
|||
: myConsole(console)
|
||||
{
|
||||
// Randomize the 128 bytes of memory
|
||||
Random random;
|
||||
class Random random;
|
||||
|
||||
for(uInt32 t = 0; t < 128; ++t)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ const char* M6532::name() const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6532::reset()
|
||||
{
|
||||
Random random;
|
||||
class Random random;
|
||||
|
||||
myTimer = 25 + (random.next() % 75);
|
||||
myIntervalShift = 6;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OSystem.cxx,v 1.40 2005-09-18 14:40:55 optixx Exp $
|
||||
// $Id: OSystem.cxx,v 1.41 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -22,27 +22,33 @@
|
|||
|
||||
#include "unzip.h"
|
||||
|
||||
// FIXME - clean up this mess of platform-specific ifdefs
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "FrameBufferSoft.hxx"
|
||||
#ifdef DISPLAY_OPENGL
|
||||
#include "FrameBufferGL.hxx"
|
||||
#endif
|
||||
|
||||
#if defined(PSP)
|
||||
#include "FrameBufferPSP.hxx"
|
||||
#elif defined (_WIN32_WCE)
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
#endif
|
||||
|
||||
#include "Sound.hxx"
|
||||
#include "SoundNull.hxx"
|
||||
#ifdef SOUND_SUPPORT
|
||||
#include "SoundSDL.hxx"
|
||||
#ifndef _WIN32_WCE
|
||||
#include "SoundSDL.hxx"
|
||||
#else
|
||||
#include "SoundWinCE.hxx"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef PSP
|
||||
#include "FrameBufferPSP.hxx"
|
||||
#endif
|
||||
|
||||
|
||||
#include "FSNode.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
|
@ -177,8 +183,10 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
string video = mySettings->getString("video");
|
||||
|
||||
if(video == "soft")
|
||||
#ifdef PSP
|
||||
#if defined (PSP)
|
||||
myFrameBuffer = new FrameBufferPSP(this);
|
||||
#elif defined (WIN32_WCE)
|
||||
myFrameBuffer = new FrameBufferWinCE(this);
|
||||
#else
|
||||
myFrameBuffer = new FrameBufferSoft(this);
|
||||
#endif
|
||||
|
@ -255,7 +263,11 @@ void OSystem::createSound()
|
|||
|
||||
// And recreate a new sound device
|
||||
#ifdef SOUND_SUPPORT
|
||||
mySound = new SoundSDL(this);
|
||||
#if defined (WIN32_WCE)
|
||||
mySound = new SoundWinCE(this);
|
||||
#else
|
||||
mySound = new SoundSDL(this);
|
||||
#endif
|
||||
#else
|
||||
mySettings->setBool("sound", false);
|
||||
mySound = new SoundNull(this);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIA.cxx,v 1.61 2005-09-25 20:18:46 urchlay Exp $
|
||||
// $Id: TIA.cxx,v 1.62 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -46,13 +46,15 @@ TIA::TIA(const Console& console, Settings& settings)
|
|||
myCOLUP0(myColor[2]),
|
||||
myCOLUP1(myColor[3])
|
||||
{
|
||||
uInt32 i;
|
||||
|
||||
// Allocate buffers for two frame buffers
|
||||
myCurrentFrameBuffer = new uInt8[160 * 300];
|
||||
myPreviousFrameBuffer = new uInt8[160 * 300];
|
||||
|
||||
myFrameGreyed = false;
|
||||
|
||||
for(uInt32 i = 0; i < 6; ++i)
|
||||
for(i = 0; i < 6; ++i)
|
||||
myBitEnabled[i] = true;
|
||||
|
||||
for(uInt16 x = 0; x < 2; ++x)
|
||||
|
@ -92,10 +94,8 @@ TIA::TIA(const Console& console, Settings& settings)
|
|||
}
|
||||
}
|
||||
|
||||
for(uInt32 i = 0; i < 640; ++i)
|
||||
{
|
||||
for(i = 0; i < 640; ++i)
|
||||
ourDisabledMaskTable[i] = 0;
|
||||
}
|
||||
|
||||
// Compute all of the mask tables
|
||||
computeBallMaskTable();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIASnd.cxx,v 1.2 2005-09-05 01:12:56 stephena Exp $
|
||||
// $Id: TIASnd.cxx,v 1.3 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "System.hxx"
|
||||
|
@ -371,3 +371,6 @@ void TIASound::process(uInt8* buffer, uInt32 samples)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const int TIASound::TIASoundFrequency = 31400;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIASnd.hxx,v 1.2 2005-09-05 01:12:56 stephena Exp $
|
||||
// $Id: TIASnd.hxx,v 1.3 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIASOUND_HXX
|
||||
|
@ -26,12 +26,12 @@
|
|||
hardware.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: TIASnd.hxx,v 1.2 2005-09-05 01:12:56 stephena Exp $
|
||||
@version $Id: TIASnd.hxx,v 1.3 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
class TIASound
|
||||
{
|
||||
public:
|
||||
static const int TIASoundFrequency = 31400;
|
||||
static const int TIASoundFrequency;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: bspf.hxx,v 1.10 2005-08-25 16:29:52 stephena Exp $
|
||||
// $Id: bspf.hxx,v 1.11 2005-10-09 17:31:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef BSPF_HXX
|
||||
|
@ -24,7 +24,7 @@
|
|||
that need to be defined for different operating systems.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: bspf.hxx,v 1.10 2005-08-25 16:29:52 stephena Exp $
|
||||
@version $Id: bspf.hxx,v 1.11 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
|
||||
// Types for 8-bit signed and unsigned integers
|
||||
|
@ -82,4 +82,9 @@ typedef unsigned int uInt32;
|
|||
#define IS_BLANK(c) isblank(c)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include "missing.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: GameInfoDialog.cxx,v 1.17 2005-10-02 19:10:39 stephena Exp $
|
||||
// $Id: GameInfoDialog.cxx,v 1.18 2005-10-09 17:31:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -496,7 +496,9 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME - the following should be handled in a better way
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
#ifndef _WIN32_WCE
|
||||
const PropType GameInfoDialog::ourControllerList[5] = {
|
||||
{ "Booster-Grip", "BOOSTER-GRIP" },
|
||||
{ "Driving", "DRIVING" },
|
||||
|
@ -504,8 +506,12 @@ const PropType GameInfoDialog::ourControllerList[5] = {
|
|||
{ "Paddles", "PADDLES" },
|
||||
{ "Joystick", "JOYSTICK" }
|
||||
};
|
||||
#else
|
||||
const PropType GameInfoDialog::ourControllerList[5];
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
#ifndef _WIN32_WCE
|
||||
const PropType GameInfoDialog::ourCartridgeList[21] = {
|
||||
{ "Auto-detect", "AUTO-DETECT" },
|
||||
{ "2K (2K Atari)", "2K" },
|
||||
|
@ -529,3 +535,6 @@ const PropType GameInfoDialog::ourCartridgeList[21] = {
|
|||
{ "MC (C. Wilkson Megacart)", "MC" },
|
||||
{ "UA (8K UA Ltd.)", "UA" }
|
||||
};
|
||||
#else
|
||||
const PropType GameInfoDialog::ourCartridgeList[21];
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $
|
||||
// $Id: GuiUtils.hxx,v 1.21 2005-10-09 17:31:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,7 +29,7 @@
|
|||
Probably not very neat, but at least it works ...
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $
|
||||
@version $Id: GuiUtils.hxx,v 1.21 2005-10-09 17:31:47 stephena Exp $
|
||||
*/
|
||||
|
||||
#define kFontHeight 10
|
||||
|
@ -70,7 +70,7 @@ enum Size {
|
|||
NextSize
|
||||
};
|
||||
|
||||
static const string& EmptyString("");
|
||||
static const string EmptyString("");
|
||||
|
||||
template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
|
||||
template<typename T> inline T ABS (T x) { return (x>=0) ? x : -x; }
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
//#include <direct.h>
|
||||
|
||||
#include "FSNode.hxx"
|
||||
|
||||
/*
|
||||
* Implementation of the Stella file system API based on Windows API.
|
||||
*/
|
||||
|
||||
class WindowsFilesystemNode : public AbstractFilesystemNode
|
||||
{
|
||||
public:
|
||||
WindowsFilesystemNode();
|
||||
WindowsFilesystemNode(const string &path);
|
||||
WindowsFilesystemNode(const WindowsFilesystemNode* node);
|
||||
|
||||
virtual string displayName() const { return _displayName; }
|
||||
virtual bool isValid() const { return _isValid; }
|
||||
virtual bool isDirectory() const { return _isDirectory; }
|
||||
virtual string path() const { return _path; }
|
||||
|
||||
virtual FSList listDir(ListMode) const;
|
||||
virtual AbstractFilesystemNode* parent() const;
|
||||
|
||||
protected:
|
||||
string _displayName;
|
||||
bool _isDirectory;
|
||||
bool _isValid;
|
||||
bool _isPseudoRoot;
|
||||
string _path;
|
||||
|
||||
private:
|
||||
static char* toAscii(TCHAR* x);
|
||||
static TCHAR* toUnicode(char* x);
|
||||
static void addFile (FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data);
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static const char* lastPathComponent(const string& str)
|
||||
{
|
||||
const char* start = str.c_str();
|
||||
const char* cur = start + str.size() - 2;
|
||||
|
||||
while (cur > start && *cur != '\\')
|
||||
--cur;
|
||||
|
||||
return cur + 1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
static string validatePath(const string& p)
|
||||
|
||||
{
|
||||
|
||||
string path = p;
|
||||
|
||||
/* if(p.size() < 2 || p[1] != ':')
|
||||
|
||||
path = "c:";
|
||||
*/
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
char* WindowsFilesystemNode::toAscii(TCHAR* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (char*)x;
|
||||
#else
|
||||
static char asciiString[MAX_PATH];
|
||||
WideCharToMultiByte(CP_ACP, 0, x, _tcslen(x) + 1, asciiString, sizeof(asciiString), NULL, NULL);
|
||||
return asciiString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TCHAR* WindowsFilesystemNode::toUnicode(char* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (TCHAR*)x;
|
||||
#else
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, x, strlen(x) + 1, unicodeString, sizeof(unicodeString));
|
||||
return unicodeString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void WindowsFilesystemNode::addFile(FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char* asciiName = toAscii(find_data->cFileName);
|
||||
bool isDirectory;
|
||||
|
||||
// Skip local directory (.) and parent (..)
|
||||
if (!strcmp(asciiName, ".") || !strcmp(asciiName, ".."))
|
||||
return;
|
||||
|
||||
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
||||
|
||||
if ((!isDirectory && mode == kListDirectoriesOnly) ||
|
||||
(isDirectory && mode == kListFilesOnly))
|
||||
return;
|
||||
|
||||
entry._isDirectory = isDirectory;
|
||||
entry._displayName = asciiName;
|
||||
entry._path = base;
|
||||
entry._path += asciiName;
|
||||
if (entry._isDirectory)
|
||||
entry._path += "\\";
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
|
||||
list.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getRoot()
|
||||
{
|
||||
return new WindowsFilesystemNode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path)
|
||||
{
|
||||
return new WindowsFilesystemNode(path);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode()
|
||||
{
|
||||
_isDirectory = true;
|
||||
|
||||
// Create a virtual root directory for standard Windows system
|
||||
_isValid = false;
|
||||
_path = "";
|
||||
_isPseudoRoot = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const string& path)
|
||||
{
|
||||
_path = validatePath(path);
|
||||
_displayName = lastPathComponent(_path);
|
||||
_isValid = true;
|
||||
_isDirectory = true;
|
||||
_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode* node)
|
||||
{
|
||||
_displayName = node->_displayName;
|
||||
_isDirectory = node->_isDirectory;
|
||||
_isValid = node->_isValid;
|
||||
_isPseudoRoot = node->_isPseudoRoot;
|
||||
_path = node->_path;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSList WindowsFilesystemNode::listDir(ListMode mode) const
|
||||
{
|
||||
assert(_isDirectory);
|
||||
|
||||
FSList myList;
|
||||
|
||||
if (_isPseudoRoot)
|
||||
{
|
||||
addFile(myList, mode, "\\", NULL);
|
||||
// Drives enumeration
|
||||
/* TCHAR drive_buffer[100];
|
||||
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
|
||||
|
||||
for (TCHAR *current_drive = drive_buffer; *current_drive;
|
||||
current_drive += _tcslen(current_drive) + 1)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char drive_name[2];
|
||||
|
||||
drive_name[0] = toAscii(current_drive)[0];
|
||||
drive_name[1] = '\0';
|
||||
entry._displayName = drive_name;
|
||||
entry._isDirectory = true;
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
entry._path = toAscii(current_drive);
|
||||
myList.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Files enumeration
|
||||
WIN32_FIND_DATA desc;
|
||||
HANDLE handle;
|
||||
char searchPath[MAX_PATH + 10];
|
||||
|
||||
sprintf(searchPath, "%s*", _path.c_str());
|
||||
|
||||
handle = FindFirstFile(toUnicode(searchPath), &desc);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return myList;
|
||||
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
while (FindNextFile(handle, &desc))
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
|
||||
FindClose(handle);
|
||||
}
|
||||
|
||||
return myList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* WindowsFilesystemNode::parent() const
|
||||
{
|
||||
assert(_isValid || _isPseudoRoot);
|
||||
if (_isPseudoRoot)
|
||||
return 0;
|
||||
|
||||
WindowsFilesystemNode* p = new WindowsFilesystemNode();
|
||||
if (_path.size() > 3)
|
||||
{
|
||||
const char *start = _path.c_str();
|
||||
const char *end = lastPathComponent(_path);
|
||||
|
||||
p = new WindowsFilesystemNode();
|
||||
p->_path = string(start, end - start);
|
||||
p->_isValid = true;
|
||||
p->_isDirectory = true;
|
||||
p->_displayName = lastPathComponent(p->_path);
|
||||
p->_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::fileExists(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && !(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::dirExists(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::makeDir(const string& path)
|
||||
|
||||
{
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
return CreateDirectory(unicodeString, NULL) != 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
string AbstractFilesystemNode::modTime(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
if(b == 0)
|
||||
|
||||
return "";
|
||||
|
||||
ostringstream buf;
|
||||
|
||||
buf << attr.ftLastWriteTime.dwHighDateTime << attr.ftLastWriteTime.dwLowDateTime;
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
#include <windows.h>
|
||||
#include <gx.h>
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Font.hxx"
|
||||
|
||||
FrameBufferWinCE::FrameBufferWinCE(OSystem *osystem)
|
||||
: FrameBuffer(osystem), myDstScreen(NULL), SubsystemInited(false), displacement(0)
|
||||
{
|
||||
}
|
||||
|
||||
FrameBufferWinCE::~FrameBufferWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setPalette(const uInt32* palette)
|
||||
{
|
||||
//setup palette
|
||||
GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
for (uInt16 i=0; i<256; i++)
|
||||
{
|
||||
uInt8 r = (uInt8) ((palette[i] & 0xFF0000) >> 16);
|
||||
uInt8 g = (uInt8) ((palette[i] & 0x00FF00) >> 8);
|
||||
uInt8 b = (uInt8) (palette[i] & 0x0000FF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return;
|
||||
}
|
||||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::initSubsystem()
|
||||
{
|
||||
GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
for (int i=0; i<kNumColors - 256; i++)
|
||||
{
|
||||
uInt8 r = (ourGUIColors[i][0] & 0xFF);
|
||||
uInt8 g = (ourGUIColors[i][1] & 0xFF);
|
||||
uInt8 b = (ourGUIColors[i][2] & 0xFF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
// screen extents
|
||||
//GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
pixelstep = gxdp.cbxPitch;
|
||||
linestep = gxdp.cbyPitch;
|
||||
scrwidth = gxdp.cxWidth;
|
||||
scrheight = gxdp.cyHeight;
|
||||
|
||||
SubsystemInited = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::lateinit(void)
|
||||
{
|
||||
myWidth = myOSystem->console().mediaSource().width();
|
||||
myHeight = myOSystem->console().mediaSource().height();
|
||||
if (scrwidth > myWidth)
|
||||
displacement = (scrwidth - myWidth) / 2 * pixelstep;
|
||||
else
|
||||
displacement = 0;
|
||||
if (scrheight > myHeight)
|
||||
displacement += (scrheight - myHeight) / 2 * linestep;
|
||||
|
||||
SubsystemInited = true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::preFrameUpdate()
|
||||
{
|
||||
myDstScreen = (uInt8 *) GXBeginDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawMediaSource()
|
||||
{
|
||||
uInt8 *sc, *sp;
|
||||
uInt8 *d, *pl;
|
||||
|
||||
if (!SubsystemInited)
|
||||
{
|
||||
lateinit();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (d = myDstScreen) == NULL )
|
||||
return;
|
||||
|
||||
d += displacement;
|
||||
pl = d;
|
||||
sc = myOSystem->console().mediaSource().currentFrameBuffer();
|
||||
sp = myOSystem->console().mediaSource().previousFrameBuffer();
|
||||
for (uInt16 y=0; y<myHeight; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += (pixelstep << 2);
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::postFrameUpdate()
|
||||
{
|
||||
GXEndDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color)
|
||||
{
|
||||
GUI::Font* myfont = (GUI::Font*)font;
|
||||
const FontDesc& desc = myfont->desc();
|
||||
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
|
||||
if(c < desc.firstchar || c >= desc.firstchar + desc.size)
|
||||
{
|
||||
if (c == ' ')
|
||||
return;
|
||||
c = desc.defaultchar;
|
||||
}
|
||||
|
||||
const Int32 w = myfont->getCharWidth(c);
|
||||
const Int32 h = myfont->getFontHeight();
|
||||
c -= desc.firstchar;
|
||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[c] : (c * h));
|
||||
|
||||
uInt8 *d = myDstScreen + (y/* >> 1*/) * linestep + (x >> 1) * pixelstep;
|
||||
uInt32 stride = (scrwidth - w) * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
|
||||
for(int y2 = 0; y2 < h; y2++)
|
||||
{
|
||||
const uInt16 buffer = *tmp++;
|
||||
uInt16 mask = 0x8000;
|
||||
|
||||
for(int x2 = 0; x2 < w; x2++, mask >>= 1)
|
||||
{
|
||||
if ((buffer & mask) != 0)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
}
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::scanline(uInt32 row, uInt8* data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setAspectRatio()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::createScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::toggleFilter()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kx2 = x2>> 1;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;kx < kx2; kx++)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int ky2 = y2>> 1;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;ky < ky2; ky++)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += linestep;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kw = (w >> 1) - 1; int kh = h /*>> 1*/;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
uInt32 stride = (scrwidth - kw - 1) * pixelstep;
|
||||
for (int h2 = kh; h2 >= 0; h2--)
|
||||
{
|
||||
for (int w2 = kw; w2>=0; w2--)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::translateCoords(Int32* x, Int32* y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef FRAMEBUFFER_WINCE_HXX
|
||||
#define FRAMEBUFFER_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class FrameBufferWinCE : public FrameBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
FrameBufferWinCE(OSystem *osystem);
|
||||
~FrameBufferWinCE();
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
virtual bool initSubsystem();
|
||||
virtual void setAspectRatio() ;
|
||||
virtual bool createScreen();
|
||||
virtual void toggleFilter();
|
||||
virtual void drawMediaSource();
|
||||
virtual void preFrameUpdate();
|
||||
virtual void postFrameUpdate();
|
||||
virtual void scanline(uInt32 row, uInt8* data);
|
||||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b);
|
||||
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color);
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
|
||||
virtual void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color);
|
||||
virtual void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color);
|
||||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h = 8);
|
||||
virtual void translateCoords(Int32* x, Int32* y);
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
|
||||
private:
|
||||
|
||||
void FrameBufferWinCE::lateinit(void);
|
||||
|
||||
// uInt32 myXstart, myYstart;
|
||||
// uInt8 *currentFrame, *previousFrame;
|
||||
uInt16 pal[256], myWidth, myHeight, guipal[kNumColors-256], scrwidth, scrheight;
|
||||
uInt32 pixelstep, linestep, displacement;
|
||||
bool SubsystemInited;
|
||||
uInt8 *myDstScreen;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SoundWinCE.hxx"
|
||||
//#include <sstream>
|
||||
extern void KeyCheck(void);
|
||||
int EventHandlerState;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::OSystemWinCE()
|
||||
{
|
||||
string basedir = ((string) getcwd()) + '\\';
|
||||
setBaseDir(basedir);
|
||||
|
||||
string stateDir = basedir + "state\\";
|
||||
setStateDir(stateDir);
|
||||
|
||||
setPropertiesDir(basedir, basedir);
|
||||
|
||||
string configFile = basedir + "stella.ini";
|
||||
setConfigFiles(configFile, configFile); // Input and output are the same
|
||||
|
||||
string cacheFile = basedir + "stella.cache";
|
||||
setCacheFile(cacheFile);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::~OSystemWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void OSystemWinCE::setFramerate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myTimePerFrame = (uInt32)(1000.0 / (double)myDisplayFrameRate);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemWinCE::mainLoop()
|
||||
{
|
||||
|
||||
// These variables are common to both timing options
|
||||
// and are needed to calculate the overall frames per second.
|
||||
uInt32 frameTime = 0, numberOfFrames = 0;
|
||||
|
||||
// Set up less accurate timing stuff
|
||||
uInt32 startTime, virtualTime, currentTime;
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = GetTickCount();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
MSG msg;
|
||||
for(;;)
|
||||
{
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
|
||||
if(myEventHandler->doQuit())
|
||||
break;
|
||||
|
||||
KeyCheck();
|
||||
|
||||
startTime = GetTickCount();
|
||||
|
||||
EventHandlerState = (int) myEventHandler->state();
|
||||
myEventHandler->poll(startTime);
|
||||
myFrameBuffer->update();
|
||||
((SoundWinCE *)mySound)->update();
|
||||
|
||||
currentTime = GetTickCount();
|
||||
virtualTime += myTimePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
Sleep(virtualTime - currentTime);
|
||||
|
||||
currentTime = GetTickCount() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
|
||||
/* {
|
||||
double executionTime = (double) frameTime / 1000000.0;
|
||||
double framesPerSecond = (double) numberOfFrames / executionTime;
|
||||
ostringstream a;
|
||||
a << endl;
|
||||
a << numberOfFrames << " total frames drawn\n";
|
||||
a << framesPerSecond << " frames/second\n";
|
||||
a << endl;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, a.str().c_str(), strlen(a.str().c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
MessageBox(GetDesktopWindow(),unicodeString, _T("..."),0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
uInt32 OSystemWinCE::getTicks(void)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef OSYSTEM_WINCE_HXX
|
||||
#define OSYSTEM_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class OSystemWinCE : public OSystem
|
||||
{
|
||||
public:
|
||||
OSystemWinCE();
|
||||
virtual ~OSystemWinCE();
|
||||
|
||||
public:
|
||||
virtual void mainLoop();
|
||||
virtual uInt32 getTicks(void);
|
||||
virtual void setFramerate(uInt32 framerate);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,161 @@
|
|||
#include <windows.h>
|
||||
#include <gx.h>
|
||||
#include "EventHandler.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "FSNode.hxx"
|
||||
|
||||
#define KEYSCHECK_ASYNC
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
extern key2event keycodes[2][MAX_KEYS];
|
||||
extern void KeySetup(void);
|
||||
|
||||
OSystemWinCE* theOSystem = (OSystemWinCE*) NULL;
|
||||
HWND hWnd;
|
||||
|
||||
void KeyCheck(void)
|
||||
{
|
||||
#ifdef KEYSCHECK_ASYNC
|
||||
if (GetAsyncKeyState(keycodes[0][K_QUIT].keycode) & 0x8000)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
return;
|
||||
}
|
||||
for (int i=0; i<MAX_KEYS-1; i++)
|
||||
keycodes[0][i].state = ((uInt16) GetAsyncKeyState(keycodes[0][i].keycode)) >> 15;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CleanUp(void)
|
||||
{
|
||||
if(theOSystem) delete theOSystem;
|
||||
GXCloseDisplay();
|
||||
GXCloseInput();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
uInt8 i;
|
||||
if (wParam == keycodes[K_QUIT].keycode)
|
||||
PostQuitMessage(0);
|
||||
else
|
||||
for (i=0; i<MAX_KEYS-1; i++)
|
||||
if (wParam == keycodes[i].keycode)
|
||||
{
|
||||
theConsole->eventHandler().event()->set(keycodes[i].event,1);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_KEYUP:
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
for (i=0; i<MAX_KEYS-1; i++)
|
||||
if (wParam == keycodes[i].keycode)
|
||||
{
|
||||
theConsole->eventHandler().event()->set(keycodes[i].event,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
case WM_ACTIVATE:
|
||||
GXSuspend();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
case WM_HIBERNATE:
|
||||
GXResume();
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
|
||||
}
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
|
||||
{
|
||||
LPTSTR wndname = _T("PocketStella");
|
||||
WNDCLASS wc = { CS_HREDRAW | CS_VREDRAW, WindowProc, 0, 0, hInstance, NULL, NULL,
|
||||
(HBRUSH)GetStockObject(BLACK_BRUSH), NULL, wndname};
|
||||
RegisterClass(&wc);
|
||||
hWnd = CreateWindow(wndname, wndname, WS_VISIBLE, 0, 0, GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
|
||||
if (!hWnd) return 1;
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
theOSystem = new OSystemWinCE();
|
||||
SettingsWinCE theSettings(theOSystem);
|
||||
theOSystem->settings().loadConfig();
|
||||
theOSystem->settings().validate();
|
||||
EventHandler theEventHandler(theOSystem);
|
||||
PropertiesSet propertiesSet;
|
||||
propertiesSet.load(theOSystem->systemProperties(), false);
|
||||
theOSystem->attach(&propertiesSet);
|
||||
|
||||
if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
KeySetup();
|
||||
|
||||
if(!theOSystem->createFrameBuffer())
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
theOSystem->createSound();
|
||||
|
||||
string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
|
||||
if (!FilesystemNode::fileExists(romfile))
|
||||
theOSystem->createLauncher();
|
||||
else
|
||||
{
|
||||
/*TCHAR tmp[200];
|
||||
MultiByteToWideChar(CP_ACP, 0, romfile.c_str(), strlen(romfile.c_str()) + 1, tmp, 200);
|
||||
MessageBox(hWnd, tmp, _T("..."),0);*/
|
||||
theOSystem->createConsole(romfile);
|
||||
}
|
||||
|
||||
theOSystem->mainLoop();
|
||||
|
||||
CleanUp();
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsWinCE::SettingsWinCE(OSystem* osystem) : Settings(osystem)
|
||||
{
|
||||
//set("GameFilename", "Mega Force (1982) (20th Century Fox).bin");
|
||||
//set("GameFilename", "Enduro (1983) (Activision).bin");
|
||||
//set("GameFilename", "Night Driver (1978) (Atari).bin");
|
||||
set("romdir", (string) getcwd() + '\\');
|
||||
}
|
||||
|
||||
SettingsWinCE::~SettingsWinCE()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef SETTINGS_WINCE_HXX
|
||||
#define SETTINGS_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
class SettingsWinCE : public Settings
|
||||
{
|
||||
public:
|
||||
SettingsWinCE(OSystem* osystem);
|
||||
virtual ~SettingsWinCE();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,378 @@
|
|||
#ifdef SOUND_SUPPORT
|
||||
|
||||
#include "TIASnd.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "System.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
#include "SoundWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::SoundWinCE(OSystem* osystem)
|
||||
: Sound(osystem),
|
||||
myIsEnabled(osystem->settings().getBool("sound")),
|
||||
myIsInitializedFlag(false),
|
||||
myLastRegisterSetCycle(0),
|
||||
myDisplayFrameRate(60),
|
||||
myNumChannels(1),
|
||||
myFragmentSizeLogBase2(0),
|
||||
myIsMuted(false),
|
||||
myVolume(100),
|
||||
myLatency(100), myMixRate(22050), myBuffnum(0)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::~SoundWinCE()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setEnabled(bool state)
|
||||
{
|
||||
myIsEnabled = state;
|
||||
myOSystem->settings().setBool("sound", state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::initialize()
|
||||
{
|
||||
if(!myIsEnabled)
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
myRegWriteQueue.clear();
|
||||
myTIASound.reset();
|
||||
|
||||
// init wave out
|
||||
WAVEFORMATEX wf;
|
||||
MMRESULT err;
|
||||
memset(&wf, 0, sizeof(wf));
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wf.nChannels = 1;
|
||||
wf.nSamplesPerSec = myMixRate;
|
||||
wf.nAvgBytesPerSec = myMixRate;
|
||||
wf.nBlockAlign = 2;
|
||||
wf.wBitsPerSample = 8;
|
||||
wf.cbSize = 0;
|
||||
err = waveOutOpen(&myWout, WAVE_MAPPER, &wf, NULL, NULL, CALLBACK_NULL);
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
|
||||
myBuffnum = ((wf.nAvgBytesPerSec * myLatency / 1000) >> 9) + 1;
|
||||
myBuffers = (WAVEHDR *) malloc(myBuffnum * sizeof(*myBuffers));
|
||||
for (int i = 0; i < myBuffnum; i++)
|
||||
{
|
||||
memset(&myBuffers[i], 0, sizeof (myBuffers[i]));
|
||||
if (!(myBuffers[i].lpData = (LPSTR) malloc(512)))
|
||||
return;
|
||||
memset(myBuffers[i].lpData, 128, 512);
|
||||
myBuffers[i].dwBufferLength = 512;
|
||||
err = waveOutPrepareHeader(myWout, &myBuffers[i], sizeof(myBuffers[i]));
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
myBuffers[i].dwFlags |= WHDR_DONE;
|
||||
}
|
||||
|
||||
myIsInitializedFlag = true;
|
||||
myIsMuted = false;
|
||||
|
||||
myTIASound.outputFrequency(myMixRate);
|
||||
myTIASound.channels(1);
|
||||
|
||||
for (i=0; i<myBuffnum; i++)
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::close()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
int flag;
|
||||
do
|
||||
{
|
||||
flag = true;
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (!(myBuffers[i].dwFlags & WHDR_DONE))
|
||||
{
|
||||
flag = false;
|
||||
Sleep(myLatency);
|
||||
}
|
||||
}
|
||||
} while (flag = false);
|
||||
|
||||
waveOutReset(myWout);
|
||||
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (waveOutUnprepareHeader(myWout, &myBuffers[i], sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
|
||||
return;
|
||||
free(myBuffers[i].lpData);
|
||||
}
|
||||
free(myBuffers);
|
||||
waveOutClose(myWout);
|
||||
|
||||
myIsInitializedFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::isSuccessfullyInitialized() const
|
||||
{
|
||||
return myIsInitializedFlag;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::mute(bool state)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if(myIsMuted == state)
|
||||
return;
|
||||
myIsMuted = state;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::reset()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
myIsMuted = false;
|
||||
myLastRegisterSetCycle = 0;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setVolume(Int32 percent)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if((percent >= 0) && (percent <= 100))
|
||||
{
|
||||
myOSystem->settings().setInt("volume", percent);
|
||||
myVolume = percent;
|
||||
myTIASound.volume(percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustVolume(Int8 direction)
|
||||
{
|
||||
Int32 percent = myVolume;
|
||||
|
||||
if(direction == -1)
|
||||
percent -= 2;
|
||||
else if(direction == 1)
|
||||
percent += 2;
|
||||
|
||||
if((percent < 0) || (percent > 100))
|
||||
return;
|
||||
|
||||
setVolume(percent);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustCycleCounter(Int32 amount)
|
||||
{
|
||||
myLastRegisterSetCycle += amount;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setChannels(uInt32 channels)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setFrameRate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myLastRegisterSetCycle = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::set(uInt16 addr, uInt8 value, Int32 cycle)
|
||||
{
|
||||
float delta = (((double)(cycle - myLastRegisterSetCycle)) / (1193191.66666667));
|
||||
delta = delta * (myDisplayFrameRate / (double)myOSystem->frameRate());
|
||||
RegWrite info;
|
||||
info.addr = addr;
|
||||
info.value = value;
|
||||
info.delta = delta;
|
||||
myRegWriteQueue.enqueue(info);
|
||||
myLastRegisterSetCycle = cycle;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::processFragment(uInt8* stream, Int32 length)
|
||||
{
|
||||
if(!myIsInitializedFlag)
|
||||
return;
|
||||
|
||||
float position = 0.0;
|
||||
float remaining = length;
|
||||
|
||||
while(remaining > 0.0)
|
||||
{
|
||||
if(myRegWriteQueue.size() == 0)
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position),length - (uInt32)position);
|
||||
myLastRegisterSetCycle = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
RegWrite& info = myRegWriteQueue.front();
|
||||
float duration = remaining / (float) myMixRate;
|
||||
if(info.delta <= duration)
|
||||
{
|
||||
if(info.delta > 0.0)
|
||||
{
|
||||
float samples = (myMixRate * info.delta);
|
||||
myTIASound.process(stream + ((uInt32)position),
|
||||
(uInt32)samples + (uInt32)(position + samples) -
|
||||
((uInt32)position + (uInt32)samples));
|
||||
position += samples;
|
||||
remaining -= samples;
|
||||
}
|
||||
myTIASound.set(info.addr, info.value);
|
||||
myRegWriteQueue.dequeue();
|
||||
}
|
||||
else
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position), length - (uInt32)position);
|
||||
info.delta -= duration;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/*void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance,
|
||||
DWORD dwParam1, DWORD dwParam2)
|
||||
{
|
||||
if (uMsg == WOM_DONE)
|
||||
{
|
||||
SoundWinCE *sound = (SoundWinCE *) dwInstance;
|
||||
sound->processFragment( (uInt8 *) ((WAVEHDR *) dwParam2)->lpData, 512);
|
||||
waveOutWrite(sound->myWout, (WAVEHDR *) dwParam2, sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
*/
|
||||
void SoundWinCE::update(void)
|
||||
{
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
if (myBuffers[i].dwFlags & WHDR_DONE)
|
||||
{
|
||||
processFragment((uInt8 *) myBuffers[i].lpData, 512);
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::load(Deserializer& in)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::save(Serializer& out)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::RegWriteQueue(uInt32 capacity)
|
||||
: myCapacity(capacity),
|
||||
myBuffer(0),
|
||||
mySize(0),
|
||||
myHead(0),
|
||||
myTail(0)
|
||||
{
|
||||
myBuffer = new RegWrite[myCapacity];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::~RegWriteQueue()
|
||||
{
|
||||
delete[] myBuffer;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::clear()
|
||||
{
|
||||
myHead = myTail = mySize = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::dequeue()
|
||||
{
|
||||
if(mySize > 0)
|
||||
{
|
||||
myHead = (myHead + 1) % myCapacity;
|
||||
--mySize;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
float SoundWinCE::RegWriteQueue::duration()
|
||||
{
|
||||
float duration = 0.0;
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
duration += myBuffer[(myHead + i) % myCapacity].delta;
|
||||
}
|
||||
return duration;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::enqueue(const RegWrite& info)
|
||||
{
|
||||
if(mySize == myCapacity)
|
||||
grow();
|
||||
myBuffer[myTail] = info;
|
||||
myTail = (myTail + 1) % myCapacity;
|
||||
++mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RegWrite& SoundWinCE::RegWriteQueue::front()
|
||||
{
|
||||
assert(mySize != 0);
|
||||
return myBuffer[myHead];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundWinCE::RegWriteQueue::size() const
|
||||
{
|
||||
return mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::grow()
|
||||
{
|
||||
RegWrite* buffer = new RegWrite[myCapacity * 2];
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
buffer[i] = myBuffer[(myHead + i) % myCapacity];
|
||||
}
|
||||
myHead = 0;
|
||||
myTail = mySize;
|
||||
myCapacity = myCapacity * 2;
|
||||
delete[] myBuffer;
|
||||
myBuffer = buffer;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,86 @@
|
|||
#ifndef SOUNDWINCE_HXX
|
||||
#define SOUNDWINCE_HXX
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "Sound.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "MediaSrc.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
struct RegWrite
|
||||
{
|
||||
uInt16 addr;
|
||||
uInt8 value;
|
||||
double delta;
|
||||
};
|
||||
|
||||
|
||||
class SoundWinCE : public Sound
|
||||
{
|
||||
public:
|
||||
SoundWinCE(OSystem* osystem);
|
||||
virtual ~SoundWinCE();
|
||||
void setEnabled(bool state);
|
||||
void adjustCycleCounter(Int32 amount);
|
||||
void setChannels(uInt32 channels);
|
||||
void setFrameRate(uInt32 framerate);
|
||||
void initialize();
|
||||
void close();
|
||||
bool isSuccessfullyInitialized() const;
|
||||
void mute(bool state);
|
||||
void reset();
|
||||
void set(uInt16 addr, uInt8 value, Int32 cycle);
|
||||
void setVolume(Int32 percent);
|
||||
void adjustVolume(Int8 direction);
|
||||
bool load(Deserializer& in);
|
||||
bool save(Serializer& out);
|
||||
void update(void);
|
||||
|
||||
protected:
|
||||
void processFragment(uInt8* stream, Int32 length);
|
||||
// Struct to hold information regarding a TIA sound register write
|
||||
class RegWriteQueue
|
||||
{
|
||||
public:
|
||||
RegWriteQueue(uInt32 capacity = 512);
|
||||
virtual ~RegWriteQueue();
|
||||
void clear();
|
||||
void dequeue();
|
||||
float duration();
|
||||
void enqueue(const RegWrite& info);
|
||||
RegWrite& front();
|
||||
uInt32 size() const;
|
||||
|
||||
private:
|
||||
void grow();
|
||||
|
||||
private:
|
||||
uInt32 myCapacity;
|
||||
RegWrite* myBuffer;
|
||||
uInt32 mySize;
|
||||
uInt32 myHead;
|
||||
uInt32 myTail;
|
||||
};
|
||||
|
||||
private:
|
||||
TIASound myTIASound;
|
||||
bool myIsEnabled;
|
||||
bool myIsInitializedFlag;
|
||||
Int32 myLastRegisterSetCycle;
|
||||
uInt32 myDisplayFrameRate;
|
||||
uInt32 myNumChannels;
|
||||
double myFragmentSizeLogBase2;
|
||||
bool myIsMuted;
|
||||
uInt32 myVolume;
|
||||
RegWriteQueue myRegWriteQueue;
|
||||
//static void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
|
||||
int myLatency, myMixRate, myBuffnum;
|
||||
WAVEHDR *myBuffers;
|
||||
HWAVEOUT myWout;
|
||||
};
|
||||
|
||||
#endif // SOUND_SUPPORT
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
#include "bspf.hxx"
|
||||
#include "SDL.h"
|
||||
#include "gx.h"
|
||||
|
||||
char *msg = NULL;
|
||||
extern int EventHandlerState;
|
||||
|
||||
int time(int dummy)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
||||
char *getcwd(void)
|
||||
{
|
||||
TCHAR fileUnc[MAX_PATH+1];
|
||||
static char cwd[MAX_PATH+1] = "";
|
||||
char *plast;
|
||||
|
||||
// if(cwd[0] == 0)
|
||||
// {
|
||||
GetModuleFileName(NULL, fileUnc, MAX_PATH);
|
||||
WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL);
|
||||
plast = strrchr(cwd, '\\');
|
||||
if(plast)
|
||||
*plast = 0;
|
||||
|
||||
// }
|
||||
|
||||
return cwd;
|
||||
}
|
||||
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
key2event keycodes[2][MAX_KEYS];
|
||||
|
||||
void KeySetup(void)
|
||||
{
|
||||
GXKeyList klist = GXGetDefaultKeys(GX_NORMALKEYS);
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
for (int j=0; j<MAX_KEYS; j++, keycodes[i][j].state = 0,
|
||||
keycodes[i][j].launcherkey = SDLK_UNKNOWN);
|
||||
|
||||
keycodes[i][K_UP].keycode = klist.vkUp;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkDown;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkLeft;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkRight;
|
||||
keycodes[i][K_FIRE].keycode = klist.vkA;
|
||||
keycodes[i][K_RESET].keycode = klist.vkStart;
|
||||
keycodes[i][K_SELECT].keycode = klist.vkB;
|
||||
keycodes[i][K_QUIT].keycode = klist.vkC;
|
||||
|
||||
keycodes[i][K_UP].sdlkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].sdlkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].sdlkey = SDLK_LEFT;
|
||||
keycodes[i][K_RIGHT].sdlkey = SDLK_RIGHT;
|
||||
keycodes[i][K_FIRE].sdlkey = SDLK_SPACE;
|
||||
keycodes[i][K_RESET].sdlkey = SDLK_F2;
|
||||
keycodes[i][K_SELECT].sdlkey = SDLK_F1;
|
||||
keycodes[i][K_QUIT].sdlkey = SDLK_q;
|
||||
|
||||
keycodes[i][K_UP].launcherkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].launcherkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].launcherkey = SDLK_LEFT;
|
||||
keycodes[i][K_RIGHT].launcherkey = SDLK_RIGHT;
|
||||
keycodes[i][K_RESET].launcherkey = SDLK_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// SDL
|
||||
DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags) { return 0xFFFFFFFF; }
|
||||
DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_Init(Uint32 flags) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_ShowCursor(int toggle) { return 1; }
|
||||
DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode) { return SDL_GRAB_ON; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon) { return; }
|
||||
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface) { return; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask) { return; }
|
||||
DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { return NULL; }
|
||||
DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y) { return; }
|
||||
|
||||
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
|
||||
{
|
||||
for (int i=0; i<MAX_KEYS; i++)
|
||||
{
|
||||
if (keycodes[0][i].state != keycodes[1][i].state)
|
||||
{
|
||||
keycodes[1][i].state = keycodes[0][i].state;
|
||||
if (keycodes[1][i].state == 1)
|
||||
event->type = event->key.type = SDL_KEYDOWN;
|
||||
else
|
||||
event->type = event->key.type = SDL_KEYUP;
|
||||
if (EventHandlerState == 0)
|
||||
event->key.keysym.sym = keycodes[0][i].sdlkey;
|
||||
else
|
||||
event->key.keysym.sym = keycodes[0][i].launcherkey;
|
||||
event->key.keysym.mod = (SDLMod) 0;
|
||||
event->key.keysym.unicode = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
event->type = SDL_NOEVENT;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef _WCE_MISSING_H_
|
||||
#define _WCE_MISSING_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* WCE 300 does not support exception handling well */
|
||||
#define try if (1)
|
||||
#define catch(a) else if (0)
|
||||
extern char *msg;
|
||||
#define throw //
|
||||
|
||||
#pragma warning(disable: 4800)
|
||||
#pragma warning(disable: 4244)
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
int time(int dummy);
|
||||
char *getcwd(void);
|
||||
|
||||
|
||||
#define MAX_KEYS 8
|
||||
enum key {K_UP = 0, K_DOWN, K_LEFT, K_RIGHT, K_FIRE, K_RESET, K_SELECT, K_QUIT};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue