mirror of https://github.com/stella-emu/stella.git
sync with 2.3.5 release
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1293 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
27050e2695
commit
429c03130d
|
@ -8,12 +8,13 @@
|
|||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2006 by Bradford W. Mott and the Stella team
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: FrameBufferWinCE.cpp,v 1.10 2007-01-18 16:26:04 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -86,15 +87,14 @@ void FrameBufferWinCE::GetDeviceProperties(void)
|
|||
devres = QVGA;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setPalette(const uInt32* palette)
|
||||
void FrameBufferWinCE::setTIAPalette(const uInt32* palette)
|
||||
{
|
||||
//setup palette
|
||||
GetDeviceProperties();
|
||||
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);
|
||||
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)
|
||||
|
@ -106,22 +106,28 @@ void FrameBufferWinCE::setPalette(const uInt32* palette)
|
|||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::initSubsystem()
|
||||
void FrameBufferWinCE::setUIPalette(const uInt32* palette)
|
||||
{
|
||||
GetDeviceProperties();
|
||||
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);
|
||||
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+256] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
pal[i+256] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return false;
|
||||
return;
|
||||
paldouble[i+256] = pal[i+256] | (pal[i+256] << 16);
|
||||
}
|
||||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::initSubsystem()
|
||||
{
|
||||
GetDeviceProperties();
|
||||
// screen extents
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
{
|
||||
|
@ -643,7 +649,7 @@ void FrameBufferWinCE::drawChar(const GUI::Font* myfont, uInt8 c, uInt32 x, uInt
|
|||
c -= desc.firstchar;
|
||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[c] : (c * h));
|
||||
|
||||
if (x<0 || y<0 || (x>>1)+w>scrwidth || y+h>scrheight) return;
|
||||
if ((Int32)x<0 || (Int32)y<0 || (x>>1)+w>scrwidth || y+h>scrheight) return;
|
||||
|
||||
uInt8 *d;
|
||||
uInt32 stride;
|
||||
|
@ -757,7 +763,7 @@ void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, int color)
|
|||
if (devres == SM_LOW)
|
||||
{
|
||||
int kx = x >> 1; int ky = y; int kx2 = x2>> 1;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0; if (ky>scrheight-1) return; if (kx2>scrwidth-1) kx2=scrwidth-1;
|
||||
if ((Int32)kx<0) kx=0; if ((Int32)ky<0) ky=0; if (ky>scrheight-1) return; if (kx2>scrwidth-1) kx2=scrwidth-1;
|
||||
PlothLine(kx, ky, kx2, color);
|
||||
}
|
||||
else if (devres == QVGA)
|
||||
|
@ -792,7 +798,7 @@ void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, int color)
|
|||
if (devres == SM_LOW)
|
||||
{
|
||||
int kx = x >> 1; int ky = y; int ky2 = y2;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0; if (kx>scrwidth-1) return; if (ky>scrheight-1) ky=scrheight-1; if (ky2>scrheight-1) ky2=scrheight-1;
|
||||
if ((Int32)kx<0) kx=0; if ((Int32)ky<0) ky=0; if (kx>scrwidth-1) return; if (ky>scrheight-1) ky=scrheight-1; if (ky2>scrheight-1) ky2=scrheight-1;
|
||||
PlotvLine(kx, ky, ky2, color);
|
||||
}
|
||||
else if (devres == QVGA)
|
||||
|
@ -829,7 +835,7 @@ void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int colo
|
|||
{
|
||||
int kx = x >> 1; int ky = y; int kw = (w >> 1); int kh = h;
|
||||
if (ky>scrheight-1) return; if (kx>scrwidth-1) return;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0;if (kw<0) kw=0; if (kh<0) kh=0;
|
||||
if ((Int32)kx<0) kx=0; if ((Int32)ky<0) ky=0;if ((Int32)kw<0) kw=0; if ((Int32)kh<0) kh=0;
|
||||
if (kx+kw>scrwidth-1) kw=scrwidth-kx-1; if (ky+kh>scrheight-1) kh=scrheight-ky-1;
|
||||
PlotfillRect(kx, ky, kw, kh, color);
|
||||
}
|
||||
|
@ -980,4 +986,12 @@ uInt32 FrameBufferWinCE::lineDim()
|
|||
return 1;
|
||||
}
|
||||
|
||||
string FrameBufferWinCE::about()
|
||||
{
|
||||
string id = "Video rendering: ";
|
||||
id += (issmartphone ? "SM " : "PPC ");
|
||||
id += (legacygapi ? "GAPI " : "Direct ");
|
||||
id += (devres == SM_LOW ? "176x220\n" : (devres == QVGA ? "240x320\n" : "480x640\n"));
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: FrameBufferWinCE.hxx,v 1.11 2007-01-18 16:26:05 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_WINCE_HXX
|
||||
|
@ -32,6 +33,7 @@
|
|||
#define FORMAT_555 2
|
||||
#define FORMAT_OTHER 3
|
||||
|
||||
#if _WIN32_WCE <= 300
|
||||
typedef struct _RawFrameBufferInfo
|
||||
{
|
||||
WORD wFormat;
|
||||
|
@ -42,7 +44,7 @@ typedef struct _RawFrameBufferInfo
|
|||
int cxPixels;
|
||||
int cyPixels;
|
||||
} RawFrameBufferInfo;
|
||||
|
||||
#endif
|
||||
|
||||
class FrameBufferWinCE : public FrameBuffer
|
||||
{
|
||||
|
@ -50,10 +52,11 @@ class FrameBufferWinCE : public FrameBuffer
|
|||
|
||||
FrameBufferWinCE(OSystem *osystem);
|
||||
~FrameBufferWinCE();
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
virtual void setTIAPalette(const uInt32* palette);
|
||||
virtual void setUIPalette(const uInt32* palette);
|
||||
virtual bool initSubsystem();
|
||||
virtual BufferType type() { return kSoftBuffer; }
|
||||
virtual void setAspectRatio() ;
|
||||
virtual void setAspectRatio() ;
|
||||
virtual bool createScreen();
|
||||
virtual void toggleFilter();
|
||||
virtual void drawMediaSource();
|
||||
|
@ -70,6 +73,8 @@ class FrameBufferWinCE : public FrameBuffer
|
|||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
virtual void enablePhosphor(bool enable, int blend) { return; };
|
||||
virtual uInt32 lineDim();
|
||||
virtual string about();
|
||||
virtual void setScaler(Scaler scaler) { return; };
|
||||
void wipescreen(void);
|
||||
void setmode(uInt8 mode);
|
||||
uInt8 rotatedisplay(void);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: OSystemWinCE.cxx,v 1.10 2007-01-18 16:26:05 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -33,15 +34,11 @@ extern bool RequestRefresh;
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::OSystemWinCE(const string& path) : OSystem()
|
||||
{
|
||||
string basedir = ((string) getcwd()) + '\\';
|
||||
setBaseDir(basedir);
|
||||
|
||||
setStateDir(basedir);
|
||||
|
||||
setPropertiesDir(basedir);
|
||||
setConfigFile(basedir + "stella.ini");
|
||||
|
||||
setCacheFile(basedir + "stella.cache");
|
||||
setBaseDir(path);
|
||||
setStateDir(path);
|
||||
setPropertiesDir(path);
|
||||
setConfigFile(path + "stella.ini");
|
||||
setCacheFile(path + "stella.cache");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -87,7 +84,7 @@ void OSystemWinCE::mainLoop()
|
|||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
|
||||
if(myEventHandler->doQuit())
|
||||
if(myQuitLoop)
|
||||
break;
|
||||
|
||||
KeyCheck();
|
||||
|
|
|
@ -8,20 +8,20 @@
|
|||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2006 by Bradford W. Mott and the Stella team
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: PocketStella.cpp,v 1.7 2007-01-18 16:26:05 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <windows.h>
|
||||
#include "FSNode.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
|
||||
#define KEYSCHECK_ASYNC
|
||||
|
@ -120,21 +120,19 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
|
||||
case WM_SETFOCUS:
|
||||
case WM_ACTIVATE:
|
||||
if (theOSystem)
|
||||
{
|
||||
if (theOSystem->eventHandler().isPaused())
|
||||
theOSystem->eventHandler().handleEvent(Event::Pause, theOSystem->eventHandler().state());
|
||||
theOSystem->frameBuffer().refresh();
|
||||
}
|
||||
GXResume();
|
||||
if (theOSystem)
|
||||
theOSystem->frameBuffer().refresh();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
case WM_HIBERNATE:
|
||||
if (theOSystem)
|
||||
if (!theOSystem->eventHandler().isPaused())
|
||||
theOSystem->eventHandler().handleEvent(Event::Pause, theOSystem->eventHandler().state());
|
||||
GXSuspend();
|
||||
if (theOSystem)
|
||||
if (((FrameBufferWinCE &)theOSystem->frameBuffer()).IsSmartphoneLowRes())
|
||||
theOSystem->eventHandler().handleEvent(Event::LauncherMode, theOSystem->eventHandler().state());
|
||||
else
|
||||
theOSystem->eventHandler().enterMenuMode(EventHandler::S_MENU);
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
|
@ -237,14 +235,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin
|
|||
ReleaseDC(hWnd, hDC);
|
||||
DeleteObject(hFnt);
|
||||
|
||||
theOSystem = new OSystemWinCE();
|
||||
theOSystem = new OSystemWinCE(((string) getcwd()) + '\\');
|
||||
SettingsWinCE theSettings(theOSystem);
|
||||
theOSystem->settings().loadConfig();
|
||||
theOSystem->settings().validate();
|
||||
theOSystem->create();
|
||||
EventHandler theEventHandler(theOSystem);
|
||||
PropertiesSet propertiesSet(theOSystem);
|
||||
theOSystem->attach(&propertiesSet);
|
||||
|
||||
if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
|
||||
{
|
||||
|
@ -253,14 +248,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin
|
|||
}
|
||||
KeySetup();
|
||||
|
||||
if(!theOSystem->createFrameBuffer())
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
|
||||
theOSystem->createSound();
|
||||
|
||||
paddlespeed = theSettings.getInt("wce_smartphone_paddlespeed");
|
||||
|
||||
string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: SoundWinCE.cxx,v 1.6 2007-01-18 16:26:05 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
@ -60,6 +61,8 @@ void SoundWinCE::setEnabled(bool state)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::initialize()
|
||||
{
|
||||
int i;
|
||||
|
||||
if(!myIsEnabled)
|
||||
{
|
||||
close();
|
||||
|
@ -86,7 +89,7 @@ void SoundWinCE::initialize()
|
|||
|
||||
myBuffnum = ((wf.nAvgBytesPerSec * myLatency / 1000) >> 9) + 1;
|
||||
myBuffers = (WAVEHDR *) malloc(myBuffnum * sizeof(*myBuffers));
|
||||
for (int i = 0; i < myBuffnum; i++)
|
||||
for (i = 0; i < myBuffnum; i++)
|
||||
{
|
||||
memset(&myBuffers[i], 0, sizeof (myBuffers[i]));
|
||||
if (!(myBuffers[i].lpData = (LPSTR) malloc(512)))
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2006 by Bradford W. Mott and the Stella team
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: missing.cpp,v 1.7 2007-01-18 16:26:05 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -138,6 +139,8 @@ 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 void SDL_Delay(Uint32 ms) { Sleep(ms); }
|
||||
|
||||
|
||||
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue