mirror of https://github.com/stella-emu/stella.git
OK, this is a BIG commit.
Added CRT simulation as described by Ian Bogost in the AtariAge thread 'CRT simulation for Stella. This is just the first pass, but things are working nicely so far (for those systems that can support it). It requires at least OpenGL 2.0 with GLSL (GL Shading language). Added the commandline arugments 'tv_tex', 'tv_bleed', 'tv_noise' and 'tv_phos' used to set these various effects, as well as the ability to set them within the Video Settings dialog. More documentation is forthcoming on this. All bankswitch modes that use SC RAM now act correctly when reading from the write port (the RAM is erased). Patching ROMs with bankswitch type 0840, SB, UA and X07 is now working. Went through all the bankswitch classes and converted multiplication/ division to shift operations whenever possible. It's a micro-optimization, but what the heck; every little bit of speed counts. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1739 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
54a3ddab7a
commit
79e4e42ae7
19
Changes.txt
19
Changes.txt
|
@ -12,6 +12,23 @@
|
|||
Release History
|
||||
===============================================================================
|
||||
|
||||
2.7.7 to 2.8: (June xx, 2009)
|
||||
|
||||
* Added CRT simulation effects as described in the AtariAge posting
|
||||
'CRT emulation for Stella'. For now, this requires OpenGL 2.0 or
|
||||
greater with support for GLSL (GL Shading Language).
|
||||
|
||||
* All bankswitching schemes which include SC extended RAM will now have
|
||||
memory erased if you attempt to read from the write port. Related to
|
||||
this, entering/exiting the debugger will no longer erase the extended
|
||||
RAM.
|
||||
|
||||
* Patching of ROM for bankswitch types '0840', 'SB', 'UA' and 'X07' is
|
||||
now implemented, but hasn't been extensively tested.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
2.7.6 to 2.7.7: (May 1, 2009)
|
||||
|
||||
* Corrected emulation of CPU opcodes involving 'decimal' mode (ADC/RRA
|
||||
|
@ -24,8 +41,6 @@
|
|||
* Changed internal sound frequency of Pitfall 2 from 15.75KHz to 20KHz,
|
||||
as this sounds much more authentic when compared to a real cartridge.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
2.7.5 to 2.7.6: (April 14, 2009)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,8 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
|
@ -156,8 +156,13 @@ class FrameBufferGL : public FrameBuffer
|
|||
private:
|
||||
bool loadFuncs();
|
||||
|
||||
/**
|
||||
Enable/disable texture effect.
|
||||
*/
|
||||
void enableTexture(bool enable);
|
||||
|
||||
private:
|
||||
// The lower-most base surface (will always be a TIA surface,
|
||||
// The lower-most base surface (will always be a TIA surface,
|
||||
// since Dialog surfaces are allocated by the Dialog class directly).
|
||||
FBSurfaceGL* myTiaSurface;
|
||||
|
||||
|
@ -179,6 +184,30 @@ class FrameBufferGL : public FrameBuffer
|
|||
// Indicates that the texture has been modified, and should be redrawn
|
||||
bool myDirtyFlag;
|
||||
|
||||
// Indicates whether or not color bleed filter is enabled
|
||||
bool myUseBleed;
|
||||
|
||||
// Indicates the quality of the color bleed filter to use
|
||||
int myBleedQuality;
|
||||
|
||||
// Indicates whether or not color texture filter is enabled
|
||||
bool myUseTexture;
|
||||
|
||||
// Indicates whetehr or not color texture filter is staggered
|
||||
bool myTextureStag;
|
||||
|
||||
// Indicates whether or not the noise filter is enabled
|
||||
bool myUseNoise;
|
||||
|
||||
// Indicates the quality of the noise filter to use
|
||||
int myNoiseQuality;
|
||||
|
||||
// Indicates whether or not the phosphor filter is enabled
|
||||
bool myUseGLPhosphor;
|
||||
|
||||
// Indicates the OpenGL version found (0 indicates none)
|
||||
static float myGLVersion;
|
||||
|
||||
// Indicates if the OpenGL library has been properly loaded
|
||||
static bool myLibraryLoaded;
|
||||
};
|
||||
|
@ -196,7 +225,8 @@ class FBSurfaceGL : public FBSurface
|
|||
public:
|
||||
FBSurfaceGL(FrameBufferGL& buffer,
|
||||
uInt32 baseWidth, uInt32 baseHeight,
|
||||
uInt32 scaleWidth, uInt32 scaleHeight);
|
||||
uInt32 scaleWidth, uInt32 scaleHeight,
|
||||
bool allowFiltering = false);
|
||||
virtual ~FBSurfaceGL();
|
||||
|
||||
void hLine(uInt32 x, uInt32 y, uInt32 x2, uInt32 color);
|
||||
|
@ -221,6 +251,54 @@ class FBSurfaceGL : public FBSurface
|
|||
private:
|
||||
void setFilter(const string& name);
|
||||
|
||||
/**
|
||||
This method generates an OpenGL shader program from a fragment shader.
|
||||
|
||||
@param fragment The filename of the fragment shader (not including location)
|
||||
|
||||
@return The generated shader program
|
||||
*/
|
||||
enum ShaderType {
|
||||
SHADER_BLEED, SHADER_TEX, SHADER_NOISE, SHADER_PHOS, SHADER_TEXNOISE
|
||||
};
|
||||
GLuint genShader(ShaderType type);
|
||||
|
||||
/**
|
||||
This method performs the final steps of rendering a single texture filter:
|
||||
passing the previously rendered screen to the given program and drawing
|
||||
to the screen. It does not include setting the program through
|
||||
p_glUseProgram() because this needs to be done before the custom program
|
||||
variables are set.
|
||||
|
||||
@param program The program to use to render the filter
|
||||
@param firstRender True if this is the first render for this frame, false if not
|
||||
*/
|
||||
void renderTexture(GLuint program, bool firstRender);
|
||||
|
||||
/**
|
||||
This method performs the final steps of rendering a two-texture filter:
|
||||
passing the previously rendered screen to the given program and drawing
|
||||
the previous texture and mask texture to the screen. It does not include
|
||||
setting the program through p_glUseProgram() because this needs to be
|
||||
done before the mask texture and custom program variables are set.
|
||||
|
||||
@param program The program to use to render the filter
|
||||
@param firstRender True if this is the first render for this frame, false if not
|
||||
*/
|
||||
void renderTwoTexture(GLuint program, bool firstRender);
|
||||
|
||||
/**
|
||||
This method performs the final steps of rendering a three-texture filter:
|
||||
passing the previously rendered screen to the given program and drawing
|
||||
the previous texture and two mask textures to the screen. It does not include
|
||||
setting the program through p_glUseProgram() because this needs to be
|
||||
done before the mask texture and custom program variables are set.
|
||||
|
||||
@param program The program to use to render the filter
|
||||
@param firstRender True if this is the first render for this frame, false if not
|
||||
*/
|
||||
void renderThreeTexture(GLuint program, bool firstRender);
|
||||
|
||||
inline void* pixels() const { return myTexture->pixels; }
|
||||
inline uInt32 pitch() const { return myPitch; }
|
||||
|
||||
|
@ -242,9 +320,43 @@ class FBSurfaceGL : public FBSurface
|
|||
GLsizei myTexHeight;
|
||||
GLfloat myTexCoord[4];
|
||||
|
||||
// The filter texture is what is used to hold data from screen after one
|
||||
// filter has been used. Needed since more than one filter is being used.
|
||||
// The size and texture coordinates are also used for the other filter
|
||||
// textures: mySubMaskTexID and myNoiseTexID
|
||||
GLuint myFilterTexID;
|
||||
GLsizei myFilterTexWidth;
|
||||
GLsizei myFilterTexHeight;
|
||||
GLfloat myFilterTexCoord[4];
|
||||
|
||||
// The subpixel texture used for the texture filter
|
||||
GLuint mySubMaskTexID;
|
||||
// The noise textures used for the noise filter
|
||||
GLuint* myNoiseMaskTexID;
|
||||
// The past texture used for the phosphor filter
|
||||
GLuint myPhosphorTexID;
|
||||
|
||||
// Surface for the subpixel texture filter mask
|
||||
SDL_Surface* mySubpixelTexture;
|
||||
// Surfaces for noise filter mask (array of pointers)
|
||||
SDL_Surface** myNoiseTexture;
|
||||
|
||||
uInt32 myXOrig, myYOrig, myWidth, myHeight;
|
||||
bool mySurfaceIsDirty;
|
||||
uInt32 myPitch;
|
||||
|
||||
// OpenGL shader programs
|
||||
GLuint myBleedProgram; // Shader for color bleed filter
|
||||
GLuint myTextureProgram; // Shader for color texture filter
|
||||
GLuint myNoiseProgram; // Shader for noise filter
|
||||
GLuint myPhosphorProgram; // Shader for the phosphor filter
|
||||
GLuint myTextureNoiseProgram; // Shader for both color texture and noise filters
|
||||
|
||||
// Used to save the number of noise textures to use at game launch
|
||||
int myNoiseNum;
|
||||
|
||||
// Specifies whether the TV filters can be applied to this surface
|
||||
bool myTvFiltersEnabled;
|
||||
};
|
||||
|
||||
#endif // DISPLAY_OPENGL
|
||||
|
|
|
@ -142,7 +142,6 @@ class FrameBufferSoft : public FrameBuffer
|
|||
string about() const;
|
||||
|
||||
private:
|
||||
int myZoomLevel;
|
||||
int myBytesPerPixel;
|
||||
int myBaseOffset;
|
||||
int myPitch;
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
#ifndef GL_SHADER_PROGS_HXX
|
||||
#define GL_SHADER_PROGS_HXX
|
||||
|
||||
/**
|
||||
This code is generated using the 'create_shaders.pl' script,
|
||||
located in the src/tools directory.
|
||||
*/
|
||||
|
||||
namespace GLShader {
|
||||
|
||||
static const char* bleed_frag[] = {
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform float pH;\n"
|
||||
"uniform float pW;\n"
|
||||
"uniform float pWx2;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" // Save current color\n"
|
||||
" vec4 current = texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t));\n"
|
||||
"\n"
|
||||
" // Box filter\n"
|
||||
" // Comments for position are given in (x,y) coordinates with the current pixel as the origin\n"
|
||||
" vec4 color = ( \n"
|
||||
" // (-1,1)\n"
|
||||
" texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t+pH))\n"
|
||||
" // (0,1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t+pH))\n"
|
||||
" // (1,1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t+pH))\n"
|
||||
" // (-1,0)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t))\n"
|
||||
" // (0,0)\n"
|
||||
" + current\n"
|
||||
" // (1,0)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t))\n"
|
||||
" // (-1,-1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t-pH))\n"
|
||||
" // (0,-1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t-pH))\n"
|
||||
" // (1,-1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t-pH))\n"
|
||||
"\n"
|
||||
" // Make it wider\n"
|
||||
" // (-2,1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t+pH))\n"
|
||||
" // (-2,0)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t))\n"
|
||||
" // (-2,-1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t-pH))\n"
|
||||
" // (2,1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t+pH))\n"
|
||||
" // (2,0)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t))\n"
|
||||
" // (2,-1)\n"
|
||||
" + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t-pH))\n"
|
||||
" ) / 15.0;\n"
|
||||
"\n"
|
||||
" // Make darker colors not bleed over lighter colors (act like light)\n"
|
||||
" color = vec4(max(current.x, color.x), max(current.y, color.y), max(current.z, color.z), 1.0);\n"
|
||||
"\n"
|
||||
" gl_FragColor = color;\n"
|
||||
"}\n"
|
||||
"\0"
|
||||
};
|
||||
|
||||
static const char* noise_frag[] = {
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform sampler2D mask;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor =\n"
|
||||
" texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
|
||||
" + texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
|
||||
" ;\n"
|
||||
"}\n"
|
||||
"\0"
|
||||
};
|
||||
|
||||
static const char* phosphor_frag[] = {
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform sampler2D mask;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor =\n"
|
||||
" 0.65 * texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
|
||||
" + 0.35 * texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
|
||||
" ;\n"
|
||||
"}\n"
|
||||
"\0"
|
||||
};
|
||||
|
||||
static const char* texture_frag[] = {
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform sampler2D mask;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor =\n"
|
||||
" texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
|
||||
" * texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
|
||||
" * 1.05\n"
|
||||
" + 0.07\n"
|
||||
" ;\n"
|
||||
"}\n"
|
||||
"\0"
|
||||
};
|
||||
|
||||
static const char* texture_noise_frag[] = {
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform sampler2D texMask;\n"
|
||||
"uniform sampler2D noiseMask;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor =\n"
|
||||
" // Texture part\n"
|
||||
" texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
|
||||
" * texture2D(texMask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
|
||||
" * 1.05\n"
|
||||
" + 0.07\n"
|
||||
" // Noise part\n"
|
||||
" + texture2D(noiseMask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
|
||||
" ;\n"
|
||||
"}\n"
|
||||
"\0"
|
||||
};
|
||||
|
||||
} // namespace GLShader
|
||||
|
||||
#endif
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Cart0840.hxx"
|
||||
|
@ -25,10 +26,7 @@
|
|||
Cartridge0840::Cartridge0840(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 8192; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 8192);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -149,7 +147,7 @@ void Cartridge0840::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
|
@ -181,10 +179,7 @@ int Cartridge0840::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge0840::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address &= 0x0fff;
|
||||
myImage[myCurrentBank * 4096] = value;
|
||||
bank(myCurrentBank); // TODO: see if this is really necessary
|
||||
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0fff)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Cart2K.hxx"
|
||||
|
@ -25,10 +26,7 @@
|
|||
Cartridge2K::Cartridge2K(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 2048; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 2048);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -97,9 +97,9 @@ uInt8 Cartridge3E::peek(uInt16 address)
|
|||
if(address < 0x0800)
|
||||
{
|
||||
if(myCurrentBank < 256)
|
||||
return myImage[(address & 0x07FF) + myCurrentBank * 2048];
|
||||
return myImage[(address & 0x07FF) + (myCurrentBank << 11)];
|
||||
else
|
||||
return myRam[(address & 0x03FF) + (myCurrentBank - 256) * 1024];
|
||||
return myRam[(address & 0x03FF) + ((myCurrentBank - 256) << 10)];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
if(bank < 256)
|
||||
{
|
||||
// Make sure the bank they're asking for is reasonable
|
||||
if((uInt32)bank * 2048 < mySize)
|
||||
if(((uInt32)bank << 11) < uInt32(mySize))
|
||||
{
|
||||
myCurrentBank = bank;
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
{
|
||||
// Oops, the bank they're asking for isn't valid so let's wrap it
|
||||
// around to a valid bank number
|
||||
myCurrentBank = bank % (mySize / 2048);
|
||||
myCurrentBank = bank % (mySize >> 11);
|
||||
}
|
||||
|
||||
uInt32 offset = myCurrentBank * 2048;
|
||||
uInt32 offset = myCurrentBank << 11;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
|
@ -170,7 +170,7 @@ void Cartridge3E::bank(uInt16 bank)
|
|||
bank %= 32;
|
||||
myCurrentBank = bank + 256;
|
||||
|
||||
uInt32 offset = bank * 1024;
|
||||
uInt32 offset = bank << 10;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt32 address;
|
||||
|
||||
|
@ -217,9 +217,9 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value)
|
|||
if(address < 0x0800)
|
||||
{
|
||||
if(myCurrentBank < 256)
|
||||
myImage[(address & 0x07FF) + myCurrentBank * 2048] = value;
|
||||
myImage[(address & 0x07FF) + (myCurrentBank << 11)] = value;
|
||||
else
|
||||
myRam[(address & 0x03FF) + (myCurrentBank - 256) * 1024] = value;
|
||||
myRam[(address & 0x03FF) + ((myCurrentBank - 256) << 10)] = value;
|
||||
}
|
||||
else
|
||||
myImage[(address & 0x07FF) + mySize - 2048] = value;
|
||||
|
|
|
@ -90,7 +90,7 @@ uInt8 Cartridge3F::peek(uInt16 address)
|
|||
|
||||
if(address < 0x0800)
|
||||
{
|
||||
return myImage[(address & 0x07FF) + myCurrentBank * 2048];
|
||||
return myImage[(address & 0x07FF) + (myCurrentBank << 11)];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void Cartridge3F::bank(uInt16 bank)
|
|||
if(myBankLocked) return;
|
||||
|
||||
// Make sure the bank they're asking for is reasonable
|
||||
if((uInt32)bank * 2048 < mySize)
|
||||
if(((uInt32)bank << 11) < mySize)
|
||||
{
|
||||
myCurrentBank = bank;
|
||||
}
|
||||
|
@ -130,10 +130,10 @@ void Cartridge3F::bank(uInt16 bank)
|
|||
{
|
||||
// Oops, the bank they're asking for isn't valid so let's wrap it
|
||||
// around to a valid bank number
|
||||
myCurrentBank = bank % (mySize / 2048);
|
||||
myCurrentBank = bank % (mySize >> 11);
|
||||
}
|
||||
|
||||
uInt32 offset = myCurrentBank * 2048;
|
||||
uInt32 offset = myCurrentBank << 11;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
|
@ -158,7 +158,7 @@ int Cartridge3F::bank()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Cartridge3F::bankCount()
|
||||
{
|
||||
return mySize / 2048;
|
||||
return mySize >> 11;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -167,7 +167,7 @@ bool Cartridge3F::patch(uInt16 address, uInt8 value)
|
|||
address &= 0x0FFF;
|
||||
|
||||
if(address < 0x0800)
|
||||
myImage[(address & 0x07FF) + myCurrentBank * 2048] = value;
|
||||
myImage[(address & 0x07FF) + (myCurrentBank << 11)] = value;
|
||||
else
|
||||
myImage[(address & 0x07FF) + mySize - 2048] = value;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Cart4K.hxx"
|
||||
|
@ -25,10 +26,7 @@
|
|||
Cartridge4K::Cartridge4K(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 4096; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 4096);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -440,7 +440,7 @@ int CartridgeAR::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeAR::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
// myImage[address & 0x0FFF] = value;
|
||||
// TODO - add support for debugger
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "System.hxx"
|
||||
|
@ -25,30 +26,19 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size)
|
||||
{
|
||||
uInt32 addr;
|
||||
|
||||
// Make a copy of the entire image as-is, for use by getImage()
|
||||
// (this wastes 12K of RAM, should be controlled by a #ifdef)
|
||||
for(addr = 0; addr < size; ++addr)
|
||||
myImageCopy[addr] = image[addr];
|
||||
memcpy(myImageCopy, image, size);
|
||||
|
||||
// Copy the program ROM image into my buffer
|
||||
for(addr = 0; addr < 8192; ++addr)
|
||||
{
|
||||
myProgramImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myProgramImage, image, 8192);
|
||||
|
||||
// Copy the display ROM image into my buffer
|
||||
for(addr = 0; addr < 2048; ++addr)
|
||||
{
|
||||
myDisplayImage[addr] = image[8192 + addr];
|
||||
}
|
||||
memcpy(myDisplayImage, image + 8192, 2048);
|
||||
|
||||
// Initialize the DPC data fetcher registers
|
||||
for(uInt16 i = 0; i < 8; ++i)
|
||||
{
|
||||
myTops[i] = myBottoms[i] = myCounters[i] = myFlags[i] = 0;
|
||||
}
|
||||
|
||||
// None of the data fetchers are in music mode
|
||||
myMusicMode[0] = myMusicMode[1] = myMusicMode[2] = false;
|
||||
|
@ -460,8 +450,7 @@ int CartridgeDPC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeDPC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myProgramImage[myCurrentBank * 4096 + address] = value;
|
||||
myProgramImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ int CartridgeE0::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeE0::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
address &= 0x0FFF;
|
||||
myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,6 @@ bool CartridgeE7::patch(uInt16 address, uInt8 value)
|
|||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[(myCurrentSlice[address >> 11] << 11) + (address & 0x07FF)] = value;
|
||||
bank(myCurrentSlice[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ uInt8 CartridgeEF::peek(uInt16 address)
|
|||
if((address >= 0x0FE0) && (address <= 0x0FEF))
|
||||
bank(address - 0x0FE0);
|
||||
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -94,7 +94,7 @@ void CartridgeEF::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -127,8 +127,7 @@ int CartridgeEF::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEF::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,10 +98,16 @@ uInt8 CartridgeEFSC::peek(uInt16 address)
|
|||
if((address >= 0x0FE0) && (address <= 0x0FEF))
|
||||
bank(address - 0x0FE0);
|
||||
|
||||
// NOTE: This does not handle accessing RAM, however, this function
|
||||
// should never be called for RAM because of the way page accessing
|
||||
// has been setup
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
// Reading from the write port triggers an unwanted write
|
||||
// The value written to RAM is somewhat undefined, so we use 0
|
||||
// Thanks to Kroko of AtariAge for this advice and code idea
|
||||
if(address < 0x0080) // Write port is at 0xF000 - 0xF080 (128 bytes)
|
||||
{
|
||||
if(myBankLocked) return 0;
|
||||
else return myRAM[address] = 0;
|
||||
}
|
||||
else
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -125,7 +131,7 @@ void CartridgeEFSC::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -158,8 +164,7 @@ int CartridgeEFSC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEFSC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Random.hxx"
|
||||
#include "System.hxx"
|
||||
|
@ -26,10 +27,7 @@
|
|||
CartridgeF4::CartridgeF4(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 32768; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 32768);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -79,7 +77,7 @@ uInt8 CartridgeF4::peek(uInt16 address)
|
|||
bank(address - 0x0FF4);
|
||||
}
|
||||
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -101,7 +99,7 @@ void CartridgeF4::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -134,8 +132,7 @@ int CartridgeF4::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,14 +96,24 @@ uInt8 CartridgeF4SC::peek(uInt16 address)
|
|||
|
||||
// Switch banks if necessary
|
||||
if((address >= 0x0FF4) && (address <= 0x0FFB))
|
||||
{
|
||||
bank(address - 0x0FF4);
|
||||
}
|
||||
|
||||
// Reading from the write port triggers an unwanted write
|
||||
// The value written to RAM is somewhat undefined, so we use 0
|
||||
// Thanks to Kroko of AtariAge for this advice and code idea
|
||||
if(address < 0x0080) // Write port is at 0xF000 - 0xF080 (128 bytes)
|
||||
{
|
||||
if(myBankLocked) return 0;
|
||||
else return myRAM[address] = 0;
|
||||
}
|
||||
else
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
|
||||
|
||||
// NOTE: This does not handle accessing RAM, however, this function
|
||||
// should never be called for RAM because of the way page accessing
|
||||
// has been setup
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -113,9 +123,7 @@ void CartridgeF4SC::poke(uInt16 address, uInt8)
|
|||
|
||||
// Switch banks if necessary
|
||||
if((address >= 0x0FF4) && (address <= 0x0FFB))
|
||||
{
|
||||
bank(address - 0x0FF4);
|
||||
}
|
||||
|
||||
// NOTE: This does not handle accessing RAM, however, this function
|
||||
// should never be called for RAM because of the way page accessing
|
||||
|
@ -129,7 +137,7 @@ void CartridgeF4SC::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -162,8 +170,7 @@ int CartridgeF4SC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4SC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Serializer.hxx"
|
||||
|
@ -27,10 +28,7 @@
|
|||
CartridgeF6::CartridgeF6(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 16384; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 16384);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -101,7 +99,7 @@ uInt8 CartridgeF6::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -144,7 +142,7 @@ void CartridgeF6::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -177,8 +175,7 @@ int CartridgeF6::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,10 +121,16 @@ uInt8 CartridgeF6SC::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
// NOTE: This does not handle accessing RAM, however, this function
|
||||
// should never be called for RAM because of the way page accessing
|
||||
// has been setup
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
// Reading from the write port triggers an unwanted write
|
||||
// The value written to RAM is somewhat undefined, so we use 0
|
||||
// Thanks to Kroko of AtariAge for this advice and code idea
|
||||
if(address < 0x0080) // Write port is at 0xF000 - 0xF080 (128 bytes)
|
||||
{
|
||||
if(myBankLocked) return 0;
|
||||
else return myRAM[address] = 0;
|
||||
}
|
||||
else
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -171,7 +177,7 @@ void CartridgeF6SC::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -204,8 +210,7 @@ int CartridgeF6SC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6SC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ uInt8 CartridgeF8::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -124,7 +124,7 @@ void CartridgeF8::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -157,9 +157,7 @@ int CartridgeF8::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address &= 0xfff;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
bank(myCurrentBank);
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,10 +111,16 @@ uInt8 CartridgeF8SC::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
// NOTE: This does not handle accessing RAM, however, this function
|
||||
// should never be called for RAM because of the way page accessing
|
||||
// has been setup
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
// Reading from the write port triggers an unwanted write
|
||||
// The value written to RAM is somewhat undefined, so we use 0
|
||||
// Thanks to Kroko of AtariAge for this advice and code idea
|
||||
if(address < 0x0080) // Write port is at 0xF000 - 0xF080 (128 bytes)
|
||||
{
|
||||
if(myBankLocked) return 0;
|
||||
else return myRAM[address] = 0;
|
||||
}
|
||||
else
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -184,8 +190,7 @@ int CartridgeF8SC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8SC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,14 +117,16 @@ uInt8 CartridgeFASC::peek(uInt16 address)
|
|||
}
|
||||
|
||||
// Reading from the write port triggers an unwanted write
|
||||
// The value written to RAM is somewhat undefined, so we use 0
|
||||
// Thanks to Kroko of AtariAge for this advice and code idea
|
||||
if(address < 0x0100) // Write port is at 0xF000 - 0xF100 (256 bytes)
|
||||
{
|
||||
return myRAM[address & 0x00FF] = 0;
|
||||
if(myBankLocked) return 0;
|
||||
else return myRAM[address] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +169,7 @@ void CartridgeFASC::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -200,8 +202,7 @@ int CartridgeFASC::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeFASC::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "CartFE.hxx"
|
||||
|
@ -25,10 +26,7 @@
|
|||
CartridgeFE::CartridgeFE(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 8192; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 8192);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "CartMB.hxx"
|
||||
|
@ -25,10 +26,7 @@
|
|||
CartridgeMB::CartridgeMB(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 65536; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 65536);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -75,9 +73,10 @@ uInt8 CartridgeMB::peek(uInt16 address)
|
|||
address &= 0x0FFF;
|
||||
|
||||
// Switch to next bank
|
||||
if(address == 0x0FF0) incbank();
|
||||
if(address == 0x0FF0)
|
||||
incbank();
|
||||
|
||||
return myImage[myCurrentBank * 4096 + address];
|
||||
return myImage[(myCurrentBank << 12) + address];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -86,7 +85,8 @@ void CartridgeMB::poke(uInt16 address, uInt8)
|
|||
address &= 0x0FFF;
|
||||
|
||||
// Switch to next bank
|
||||
if(address == 0x0FF0) incbank();
|
||||
if(address == 0x0FF0)
|
||||
incbank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -97,7 +97,7 @@ void CartridgeMB::incbank()
|
|||
// Remember what bank we're in
|
||||
myCurrentBank ++;
|
||||
myCurrentBank &= 0x0F;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
uInt16 mask = mySystem->pageMask();
|
||||
|
||||
|
@ -120,7 +120,7 @@ void CartridgeMB::bank(uInt16 bank)
|
|||
{
|
||||
if(myBankLocked) return;
|
||||
|
||||
myCurrentBank = (bank - 1);
|
||||
myCurrentBank = bank - 1;
|
||||
incbank();
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,7 @@ int CartridgeMB::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeMB::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & 0x0FFF;
|
||||
myImage[myCurrentBank * 4096 + address] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ uInt8 CartridgeMC::peek(uInt16 address)
|
|||
if(block & 0x80)
|
||||
{
|
||||
// ROM access
|
||||
return myImage[(uInt32)(block & 0x7F) * 1024 + (address & 0x03FF)];
|
||||
return myImage[(uInt32)((block & 0x7F) << 10) + (address & 0x03FF)];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -136,12 +136,12 @@ uInt8 CartridgeMC::peek(uInt16 address)
|
|||
if(address & 0x0200)
|
||||
{
|
||||
// Reading from the read port of the RAM block
|
||||
return myRAM[(uInt32)(block & 0x3F) * 512 + (address & 0x01FF)];
|
||||
return myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Oops, reading from the write port of the RAM block!
|
||||
myRAM[(uInt32)(block & 0x3F) * 512 + (address & 0x01FF)] = 0;
|
||||
myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)] = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void CartridgeMC::poke(uInt16 address, uInt8 value)
|
|||
if(!(block & 0x80) && !(address & 0x0200))
|
||||
{
|
||||
// Handle the write to RAM
|
||||
myRAM[(uInt32)(block & 0x3F) * 512 + (address & 0x01FF)] = value;
|
||||
myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "CartSB.hxx"
|
||||
|
@ -24,14 +25,13 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size)
|
||||
: mySize(size),
|
||||
myLastBank((mySize>>12)-1)
|
||||
myLastBank((mySize >> 12) - 1)
|
||||
{
|
||||
// Allocate array for the ROM image
|
||||
myImage = new uInt8[mySize];
|
||||
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < mySize; ++addr)
|
||||
myImage[addr] = image[addr];
|
||||
memcpy(myImage, image, mySize);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -85,7 +85,7 @@ void CartridgeSB::install(System& system)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeSB::peek(uInt16 address)
|
||||
{
|
||||
address = address & (0x17FF+(mySize>>12));
|
||||
address = address & (0x17FF + (mySize >> 12));
|
||||
|
||||
// Switch banks if necessary
|
||||
if ((address & 0x1800) == 0x0800)
|
||||
|
@ -105,7 +105,7 @@ uInt8 CartridgeSB::peek(uInt16 address)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CartridgeSB::poke(uInt16 address, uInt8 value)
|
||||
{
|
||||
address = address & (0x17FF+(mySize>>12));
|
||||
address = address & (0x17FF + (mySize >> 12));
|
||||
|
||||
// Switch banks if necessary
|
||||
if((address & 0x1800) == 0x0800)
|
||||
|
@ -127,7 +127,7 @@ void CartridgeSB::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt32 offset = myCurrentBank * 4096;
|
||||
uInt32 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
|
@ -152,15 +152,13 @@ int CartridgeSB::bank()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int CartridgeSB::bankCount()
|
||||
{
|
||||
return mySize>>12;
|
||||
return mySize >> 12;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeSB::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address &= 0x0fff;
|
||||
myImage[myCurrentBank * 4096] = value;
|
||||
bank(myCurrentBank); // TODO: see if this is really necessary
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ void CartridgeUA::install(System& system)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 CartridgeUA::peek(uInt16 address)
|
||||
{
|
||||
// address &= 0x1FFF; TODO - is this needed here?
|
||||
|
||||
// Switch banks if necessary
|
||||
switch(address)
|
||||
{
|
||||
|
@ -132,9 +134,8 @@ void CartridgeUA::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = bank;
|
||||
uInt16 offset = myCurrentBank * 4096;
|
||||
uInt16 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
// uInt16 mask = mySystem->pageMask();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
System::PageAccess access;
|
||||
|
@ -164,8 +165,7 @@ int CartridgeUA::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeUA::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address &= 0x0fff;
|
||||
myImage[myCurrentBank * 4096] = value;
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id:
|
||||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "M6532.hxx"
|
||||
|
@ -27,10 +28,7 @@
|
|||
CartridgeX07::CartridgeX07(const uInt8* image)
|
||||
{
|
||||
// Copy the ROM image into my buffer
|
||||
for(uInt32 addr = 0; addr < 65536; ++addr)
|
||||
{
|
||||
myImage[addr] = image[addr];
|
||||
}
|
||||
memcpy(myImage, image, 65536);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -84,7 +82,8 @@ uInt8 CartridgeX07::peek(uInt16 address)
|
|||
value = mySystem->tia().peek(address);
|
||||
|
||||
// Switch banks if necessary
|
||||
if((address & 0x180f) == 0x080d) bank((address & 0xf0) >> 4);
|
||||
if((address & 0x180f) == 0x080d)
|
||||
bank((address & 0xf0) >> 4);
|
||||
else if((address & 0x1880) == 0)
|
||||
{
|
||||
if((myCurrentBank & 0xe) == 0xe)
|
||||
|
@ -105,7 +104,8 @@ void CartridgeX07::poke(uInt16 address, uInt8 value)
|
|||
mySystem->tia().poke(address, value);
|
||||
|
||||
// Switch banks if necessary
|
||||
if((address & 0x180f) == 0x080d) bank((address & 0xf0) >> 4);
|
||||
if((address & 0x180f) == 0x080d)
|
||||
bank((address & 0xf0) >> 4);
|
||||
else if((address & 0x1880) == 0)
|
||||
{
|
||||
if((myCurrentBank & 0xe) == 0xe)
|
||||
|
@ -120,7 +120,7 @@ void CartridgeX07::bank(uInt16 bank)
|
|||
|
||||
// Remember what bank we're in
|
||||
myCurrentBank = (bank & 0x0f);
|
||||
uInt32 offset = myCurrentBank * 4096;
|
||||
uInt32 offset = myCurrentBank << 12;
|
||||
uInt16 shift = mySystem->pageShift();
|
||||
|
||||
// Setup the page access methods for the current bank
|
||||
|
@ -151,9 +151,7 @@ int CartridgeX07::bankCount()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeX07::patch(uInt16 address, uInt8 value)
|
||||
{
|
||||
address &= 0x0fff;
|
||||
myImage[myCurrentBank * 4096] = value;
|
||||
bank(myCurrentBank); // TODO: see if this is really necessary
|
||||
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#ifndef CARTRIDGEX07_HXX
|
||||
|
@ -39,7 +39,7 @@ class System;
|
|||
Note that the latter will hit on almost any TIA access.
|
||||
|
||||
@author Eckhard Stolberg
|
||||
@version $Id:
|
||||
@version $Id$
|
||||
*/
|
||||
class CartridgeX07 : public Cartridge
|
||||
{
|
||||
|
|
|
@ -270,6 +270,11 @@ class FrameBuffer
|
|||
*/
|
||||
void stateChanged(EventHandler::State state);
|
||||
|
||||
/**
|
||||
Get the zoom level.
|
||||
*/
|
||||
uInt32 getZoomLevel() { return myZoomLevel; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// The following methods are system-specific and must be implemented
|
||||
// in derived classes.
|
||||
|
@ -436,6 +441,9 @@ class FrameBuffer
|
|||
// Names of the TIA filters that can be used for this framebuffer
|
||||
StringMap myTIAFilters;
|
||||
|
||||
// Holds the zoom level being used
|
||||
uInt32 myZoomLevel;
|
||||
|
||||
private:
|
||||
/**
|
||||
Set the icon for the main SDL window.
|
||||
|
|
|
@ -58,6 +58,13 @@ Settings::Settings(OSystem* osystem)
|
|||
setInternal("colorloss", "false");
|
||||
setInternal("timing", "sleep");
|
||||
|
||||
// TV filter options
|
||||
setInternal("tv_tex", "off");
|
||||
setInternal("tv_bleed", "off");
|
||||
setInternal("tv_noise", "off");
|
||||
// setInternal("tv_curve", "false"); // not yet implemented
|
||||
setInternal("tv_phos", "false");
|
||||
|
||||
// Sound options
|
||||
setInternal("sound", "true");
|
||||
setInternal("fragsize", "512");
|
||||
|
@ -218,50 +225,37 @@ void Settings::validate()
|
|||
int i;
|
||||
|
||||
s = getString("video");
|
||||
if(s != "soft" && s != "gl")
|
||||
setInternal("video", "soft");
|
||||
if(s != "soft" && s != "gl") setInternal("video", "soft");
|
||||
|
||||
s = getString("timing");
|
||||
if(s != "sleep" && s != "busy")
|
||||
setInternal("timing", "sleep");
|
||||
if(s != "sleep" && s != "busy") setInternal("timing", "sleep");
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
s = getString("gl_filter");
|
||||
if(s != "linear" && s != "nearest")
|
||||
setInternal("gl_filter", "nearest");
|
||||
if(s != "linear" && s != "nearest") setInternal("gl_filter", "nearest");
|
||||
|
||||
i = getInt("gl_aspectn");
|
||||
if(i < 80 || i > 120)
|
||||
setInternal("gl_aspectn", "100");
|
||||
|
||||
if(i < 80 || i > 120) setInternal("gl_aspectn", "100");
|
||||
i = getInt("gl_aspectp");
|
||||
if(i < 80 || i > 120)
|
||||
setInternal("gl_aspectp", "100");
|
||||
if(i < 80 || i > 120) setInternal("gl_aspectp", "100");
|
||||
#endif
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
i = getInt("volume");
|
||||
if(i < 0 || i > 100)
|
||||
setInternal("volume", "100");
|
||||
if(i < 0 || i > 100) setInternal("volume", "100");
|
||||
i = getInt("freq");
|
||||
if(i < 0 || i > 48000)
|
||||
setInternal("freq", "31400");
|
||||
if(i < 0 || i > 48000) setInternal("freq", "31400");
|
||||
i = getInt("tiafreq");
|
||||
if(i < 0 || i > 48000)
|
||||
setInternal("tiafreq", "31400");
|
||||
if(i < 0 || i > 48000) setInternal("tiafreq", "31400");
|
||||
#endif
|
||||
|
||||
i = getInt("joydeadzone");
|
||||
if(i < 0)
|
||||
setInternal("joydeadzone", "0");
|
||||
else if(i > 29)
|
||||
setInternal("joydeadzone", "29");
|
||||
if(i < 0) setInternal("joydeadzone", "0");
|
||||
else if(i > 29) setInternal("joydeadzone", "29");
|
||||
|
||||
i = getInt("pspeed");
|
||||
if(i < 1)
|
||||
setInternal("pspeed", "1");
|
||||
else if(i > 15)
|
||||
setInternal("pspeed", "15");
|
||||
if(i < 1) setInternal("pspeed", "1");
|
||||
else if(i > 15) setInternal("pspeed", "15");
|
||||
|
||||
s = getString("palette");
|
||||
if(s != "standard" && s != "z26" && s != "user")
|
||||
|
@ -272,10 +266,20 @@ void Settings::validate()
|
|||
setInternal("launcherfont", "medium");
|
||||
|
||||
i = getInt("romviewer");
|
||||
if(i < 0)
|
||||
setInternal("romviewer", "0");
|
||||
else if(i > 2)
|
||||
setInternal("romviewer", "2");
|
||||
if(i < 0) setInternal("romviewer", "0");
|
||||
else if(i > 2) setInternal("romviewer", "2");
|
||||
|
||||
s = getString("tv_tex");
|
||||
if(s != "normal" && s != "stag")
|
||||
setInternal("tv_tex", "off");
|
||||
|
||||
s = getString("tv_bleed");
|
||||
if(s != "low" && s != "medium" && s != "high")
|
||||
setInternal("tv_bleed", "off");
|
||||
|
||||
s = getString("tv_noise");
|
||||
if(s != "low" && s != "medium" && s != "high")
|
||||
setInternal("tv_noise", "off");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -306,6 +310,18 @@ void Settings::usage()
|
|||
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
|
||||
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n"
|
||||
// << " -gl_accel <1|0> Enable SDL_GL_ACCELERATED_VISUAL\n"
|
||||
<< " -tv_tex <off|type> TV texturing, type is one of the following:\n"
|
||||
<< " normal TODO - document\n"
|
||||
<< " stag TODO - document\n"
|
||||
<< " -tv_bleed <off|type> TV color bleed, type is one of the following:\n"
|
||||
<< " low TODO - document\n"
|
||||
<< " medium TODO - document\n"
|
||||
<< " high TODO - document\n"
|
||||
<< " -tv_noise <off|type> TV noise, type is one of the following:\n"
|
||||
<< " low TODO - document\n"
|
||||
<< " medium TODO - document\n"
|
||||
<< " high TODO - document\n"
|
||||
<< " -tv_phos <1|0> TV phosphor burn-off\n"
|
||||
<< endl
|
||||
#endif
|
||||
<< " -tia_filter <filter> Use the specified filter in emulation mode\n"
|
||||
|
@ -339,7 +355,7 @@ void Settings::usage()
|
|||
<< " -audiofirst <1|0> Initial audio before video (required for some ATI video cards)\n"
|
||||
<< " -ssdir <path> The directory to save snapshot files to\n"
|
||||
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
|
||||
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling)\n"
|
||||
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n"
|
||||
<< endl
|
||||
<< " -rominfo <rom> Display detailed information for the given ROM\n"
|
||||
<< " -listrominfo Display contents of stella.pro, one line per ROM entry\n"
|
||||
|
@ -347,7 +363,7 @@ void Settings::usage()
|
|||
<< " -launcherfont <small|medium| Use the specified font in the ROM launcher\n"
|
||||
<< " large>\n"
|
||||
<< " -launcherexts <allfiles| Show files with the given extensions in ROM launcher\n"
|
||||
<< " allroms| (exts is a ':' separated list of extensions\n"
|
||||
<< " allroms| (exts is a ':' separated list of extensions)\n"
|
||||
<< " exts\n"
|
||||
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM launcher (0 for off)\n"
|
||||
<< " -uipalette <1|2> Used the specified palette for UI elements\n"
|
||||
|
|
|
@ -55,10 +55,11 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
|
|||
mySystemCyclesPerProcessorCycle;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
debugStream << "( Fm Ln Cyc Clk) ( P0 P1 M0 M1 BL) "
|
||||
<< "flags A X Y SP Code Disasm" << endl
|
||||
<< endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "Settings.hxx"
|
||||
#include "StringList.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
|
||||
#include "VideoDialog.hxx"
|
||||
|
||||
|
@ -46,7 +47,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
fontHeight = font.getFontHeight(),
|
||||
buttonWidth = font.getStringWidth("Defaults") + 20,
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos;
|
||||
int xpos, ypos, tabID;
|
||||
int lwidth = font.getStringWidth("GL Aspect (P): "),
|
||||
pwidth = font.getStringWidth("1920x1200"),
|
||||
fwidth = font.getStringWidth("Renderer: ");
|
||||
|
@ -54,15 +55,24 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
StringMap items;
|
||||
|
||||
// Set real dimensions
|
||||
_w = 48 * fontWidth + 10;
|
||||
_h = 13 * (lineHeight + 4) + 10;
|
||||
_w = 49 * fontWidth + 10;
|
||||
_h = 15 * (lineHeight + 4) + 10;
|
||||
|
||||
xpos = 5; ypos = 10;
|
||||
// The tab widget
|
||||
xpos = ypos = 5;
|
||||
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - buttonHeight - 20);
|
||||
addTabWidget(myTab);
|
||||
addFocusWidget(myTab);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// 1) General options
|
||||
wid.clear();
|
||||
tabID = myTab->addTab(" General ");
|
||||
|
||||
// Video renderer
|
||||
new StaticTextWidget(this, font, xpos + (lwidth-fwidth), ypos, fwidth,
|
||||
new StaticTextWidget(myTab, font, xpos + (lwidth-fwidth), ypos, fwidth,
|
||||
fontHeight, "Renderer:", kTextAlignLeft);
|
||||
myRenderer = new EditTextWidget(this, font, xpos+lwidth, ypos,
|
||||
myRenderer = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
|
||||
pwidth, fontHeight, "");
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
|
@ -71,14 +81,14 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
#ifdef DISPLAY_OPENGL
|
||||
items.push_back("OpenGL", "gl");
|
||||
#endif
|
||||
myRendererPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
myRendererPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "(*) ", lwidth);
|
||||
wid.push_back(myRendererPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// TIA filters (will be dynamically filled later)
|
||||
items.clear();
|
||||
myTIAFilterPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
myTIAFilterPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
|
||||
lineHeight, items, "TIA Filter: ", lwidth);
|
||||
wid.push_back(myTIAFilterPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -88,7 +98,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
items.push_back("Standard", "standard");
|
||||
items.push_back("Z26", "z26");
|
||||
items.push_back("User", "user");
|
||||
myTIAPalettePopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
myTIAPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
|
||||
lineHeight, items, "TIA Palette: ", lwidth);
|
||||
wid.push_back(myTIAPalettePopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -99,7 +109,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i)
|
||||
items.push_back(instance().supportedResolutions()[i].name,
|
||||
instance().supportedResolutions()[i].name);
|
||||
myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
myFSResPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
|
||||
lineHeight, items, "FS Res: ", lwidth);
|
||||
wid.push_back(myFSResPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -108,7 +118,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
items.clear();
|
||||
items.push_back("Sleep", "sleep");
|
||||
items.push_back("Busy-wait", "busy");
|
||||
myFrameTimingPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
myFrameTimingPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "Timing (*): ", lwidth);
|
||||
wid.push_back(myFrameTimingPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -117,100 +127,160 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
items.clear();
|
||||
items.push_back("Linear", "linear");
|
||||
items.push_back("Nearest", "nearest");
|
||||
myGLFilterPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
myGLFilterPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "GL Filter: ", lwidth);
|
||||
wid.push_back(myGLFilterPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// GL aspect ratio (NTSC mode)
|
||||
myNAspectRatioSlider =
|
||||
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
"GL Aspect (N): ", lwidth, kNAspectRatioChanged);
|
||||
myNAspectRatioSlider->setMinValue(80); myNAspectRatioSlider->setMaxValue(120);
|
||||
wid.push_back(myNAspectRatioSlider);
|
||||
myNAspectRatioLabel =
|
||||
new StaticTextWidget(this, font, xpos + myNAspectRatioSlider->getWidth() + 4,
|
||||
new StaticTextWidget(myTab, font, xpos + myNAspectRatioSlider->getWidth() + 4,
|
||||
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
|
||||
myNAspectRatioLabel->setFlags(WIDGET_CLEARBG);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// GL aspect ratio (PAL mode)
|
||||
myPAspectRatioSlider =
|
||||
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
"GL Aspect (P): ", lwidth, kPAspectRatioChanged);
|
||||
myPAspectRatioSlider->setMinValue(80); myPAspectRatioSlider->setMaxValue(120);
|
||||
wid.push_back(myPAspectRatioSlider);
|
||||
myPAspectRatioLabel =
|
||||
new StaticTextWidget(this, font, xpos + myPAspectRatioSlider->getWidth() + 4,
|
||||
new StaticTextWidget(myTab, font, xpos + myPAspectRatioSlider->getWidth() + 4,
|
||||
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
|
||||
myPAspectRatioLabel->setFlags(WIDGET_CLEARBG);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Framerate
|
||||
myFrameRateSlider =
|
||||
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
"Framerate: ", lwidth, kFrameRateChanged);
|
||||
myFrameRateSlider->setMinValue(0); myFrameRateSlider->setMaxValue(300);
|
||||
wid.push_back(myFrameRateSlider);
|
||||
myFrameRateLabel =
|
||||
new StaticTextWidget(this, font, xpos + myFrameRateSlider->getWidth() + 4,
|
||||
new StaticTextWidget(myTab, font, xpos + myFrameRateSlider->getWidth() + 4,
|
||||
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
|
||||
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
// Add message concerning usage
|
||||
ypos += (lineHeight + 4) * 2;
|
||||
lwidth = font.getStringWidth("(*) Requires application restart");
|
||||
new StaticTextWidget(myTab, font, 10, ypos, lwidth, fontHeight,
|
||||
"(*) Requires application restart",
|
||||
kTextAlignLeft);
|
||||
|
||||
// Move over to the next column
|
||||
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth();
|
||||
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 10;
|
||||
ypos = 10;
|
||||
|
||||
// Fullscreen
|
||||
myFullscreenCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myFullscreenCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Fullscreen mode", kFullScrChanged);
|
||||
wid.push_back(myFullscreenCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// PAL color-loss effect
|
||||
myColorLossCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myColorLossCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"PAL color-loss");
|
||||
wid.push_back(myColorLossCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// GL FS stretch
|
||||
myGLStretchCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myGLStretchCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"GL FS Stretch");
|
||||
wid.push_back(myGLStretchCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use sync to vblank in OpenGL
|
||||
myUseVSyncCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myUseVSyncCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"GL VSync");
|
||||
wid.push_back(myUseVSyncCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Grab mouse (in windowed mode)
|
||||
myGrabmouseCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myGrabmouseCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Grab mouse");
|
||||
wid.push_back(myGrabmouseCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Center window (in windowed mode)
|
||||
myCenterCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||
myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Center window (*)");
|
||||
wid.push_back(myCenterCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Add message concerning usage
|
||||
lwidth = font.getStringWidth("(*) Requires application restart");
|
||||
new StaticTextWidget(this, font, 10, _h - 2*buttonHeight - 10, lwidth, fontHeight,
|
||||
"(*) Requires application restart",
|
||||
kTextAlignLeft);
|
||||
// Add items for tab 0
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// 2) TV effects options
|
||||
wid.clear();
|
||||
tabID = myTab->addTab(" TV Effects ");
|
||||
xpos = ypos = 8;
|
||||
lwidth = font.getStringWidth("TV Color Texture: ");
|
||||
pwidth = font.getStringWidth("Staggered");
|
||||
|
||||
// Use TV color texture effect
|
||||
items.clear();
|
||||
items.push_back("Off", "off");
|
||||
items.push_back("Normal", "normal");
|
||||
items.push_back("Staggered", "stag");
|
||||
myTexturePopup =
|
||||
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
||||
"TV Color Texture: ", lwidth);
|
||||
wid.push_back(myTexturePopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use color bleed effect
|
||||
items.clear();
|
||||
items.push_back("Off", "off");
|
||||
items.push_back("Low", "low");
|
||||
items.push_back("Medium", "medium");
|
||||
items.push_back("High", "high");
|
||||
myBleedPopup =
|
||||
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
||||
"TV Color Bleed: ", lwidth);
|
||||
wid.push_back(myBleedPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use image noise effect
|
||||
items.clear();
|
||||
items.push_back("Off", "off");
|
||||
items.push_back("Low", "low");
|
||||
items.push_back("Medium", "medium");
|
||||
items.push_back("High", "high");
|
||||
myNoisePopup =
|
||||
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
|
||||
"TV Image Noise: ", lwidth);
|
||||
wid.push_back(myNoisePopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use phosphor burn-off effect
|
||||
ypos += 4;
|
||||
myPhosphorCheckbox =
|
||||
new CheckboxWidget(myTab, font, xpos, ypos, "TV Phosphor Burn-off");
|
||||
wid.push_back(myPhosphorCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Add items for tab 2
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
// Activate the first tab
|
||||
myTab->setActiveTab(0);
|
||||
|
||||
// Add Defaults, OK and Cancel buttons
|
||||
wid.clear();
|
||||
ButtonWidget* b;
|
||||
b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10,
|
||||
buttonWidth, buttonHeight, "Defaults", kDefaultsCmd);
|
||||
wid.push_back(b);
|
||||
addOKCancelBGroup(wid, font);
|
||||
|
||||
addToFocusList(wid);
|
||||
addBGroupToFocusList(wid);
|
||||
|
||||
// Disable certain functions when we know they aren't present
|
||||
#ifndef DISPLAY_GL
|
||||
|
@ -221,6 +291,11 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myPAspectRatioLabel->clearFlags(WIDGET_ENABLED);
|
||||
myGLStretchCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
|
||||
myTexturePopup->clearFlags(WIDGET_ENABLED);
|
||||
myBleedPopup->clearFlags(WIDGET_ENABLED);
|
||||
myNoisePopup->clearFlags(WIDGET_ENABLED);
|
||||
myPhosphorCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
#ifndef WINDOWED_SUPPORT
|
||||
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
|
||||
|
@ -306,6 +381,24 @@ void VideoDialog::loadConfig()
|
|||
|
||||
// Center window
|
||||
myCenterCheckbox->setState(instance().settings().getBool("center"));
|
||||
|
||||
// TV color texture effect
|
||||
myTexturePopup->setSelected(instance().settings().getString("tv_tex"), "off");
|
||||
myTexturePopup->setEnabled(gl);
|
||||
|
||||
// TV color bleed effect
|
||||
myBleedPopup->setSelected(instance().settings().getString("tv_bleed"), "off");
|
||||
myBleedPopup->setEnabled(gl);
|
||||
|
||||
// TV random noise effect
|
||||
myNoisePopup->setSelected(instance().settings().getString("tv_noise"), "off");
|
||||
myNoisePopup->setEnabled(gl);
|
||||
|
||||
// TV phosphor burn-off effect
|
||||
myPhosphorCheckbox->setState(instance().settings().getBool("tv_phos"));
|
||||
myPhosphorCheckbox->setEnabled(gl);
|
||||
|
||||
myTab->loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -362,6 +455,18 @@ void VideoDialog::saveConfig()
|
|||
// Center window
|
||||
instance().settings().setBool("center", myCenterCheckbox->getState());
|
||||
|
||||
// TV color texture effect
|
||||
instance().settings().setString("tv_tex", myTexturePopup->getSelectedTag());
|
||||
|
||||
// TV color bleed effect
|
||||
instance().settings().setString("tv_bleed", myBleedPopup->getSelectedTag());
|
||||
|
||||
// TV image noise effect
|
||||
instance().settings().setString("tv_noise", myNoisePopup->getSelectedTag());
|
||||
|
||||
// TV phosphor burn-off effect
|
||||
instance().settings().setBool("tv_phos", myPhosphorCheckbox->getState());
|
||||
|
||||
// Finally, issue a complete framebuffer re-initialization
|
||||
instance().createFrameBuffer();
|
||||
}
|
||||
|
@ -390,6 +495,11 @@ void VideoDialog::setDefaults()
|
|||
myGrabmouseCheckbox->setState(false);
|
||||
myCenterCheckbox->setState(true);
|
||||
|
||||
myTexturePopup->setSelected("off", "");
|
||||
myBleedPopup->setSelected("off", "");
|
||||
myNoisePopup->setSelected("off", "");
|
||||
myPhosphorCheckbox->setState(false);
|
||||
|
||||
// Make sure that mutually-exclusive items are not enabled at the same time
|
||||
handleFullscreenChange(false);
|
||||
}
|
||||
|
|
|
@ -23,12 +23,13 @@
|
|||
#define VIDEO_DIALOG_HXX
|
||||
|
||||
class CommandSender;
|
||||
class CheckboxWidget;
|
||||
class DialogContainer;
|
||||
class EditTextWidget;
|
||||
class PopUpWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
class CheckboxWidget;
|
||||
class TabWidget;
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Dialog.hxx"
|
||||
|
@ -49,6 +50,9 @@ class VideoDialog : public Dialog
|
|||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
private:
|
||||
TabWidget* myTab;
|
||||
|
||||
// General options
|
||||
EditTextWidget* myRenderer;
|
||||
PopUpWidget* myRendererPopup;
|
||||
PopUpWidget* myTIAFilterPopup;
|
||||
|
@ -70,6 +74,12 @@ class VideoDialog : public Dialog
|
|||
CheckboxWidget* myCenterCheckbox;
|
||||
CheckboxWidget* myGrabmouseCheckbox;
|
||||
|
||||
// TV effects options
|
||||
PopUpWidget* myTexturePopup;
|
||||
PopUpWidget* myBleedPopup;
|
||||
PopUpWidget* myNoisePopup;
|
||||
CheckboxWidget* myPhosphorCheckbox;
|
||||
|
||||
enum {
|
||||
kNAspectRatioChanged = 'VDan',
|
||||
kPAspectRatioChanged = 'VDap',
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use File::Basename;
|
||||
|
||||
usage() if @ARGV < 2;
|
||||
|
||||
$numfiles = @ARGV;
|
||||
$outfile = $ARGV[$numfiles-1];
|
||||
|
||||
# Construct the output file in C++ format
|
||||
# Walk the ARGV list and convert each item
|
||||
open(OUTFILE, ">$outfile");
|
||||
|
||||
print OUTFILE "#ifndef GL_SHADER_PROGS_HXX\n";
|
||||
print OUTFILE "#define GL_SHADER_PROGS_HXX\n";
|
||||
print OUTFILE "\n";
|
||||
print OUTFILE "/**\n";
|
||||
print OUTFILE " This code is generated using the 'create_shaders.pl' script,\n";
|
||||
print OUTFILE " located in the src/tools directory.\n";
|
||||
print OUTFILE "*/\n";
|
||||
print OUTFILE "\n";
|
||||
print OUTFILE "namespace GLShader {\n\n";
|
||||
|
||||
for ($i = 0; $i < $numfiles - 1; $i++)
|
||||
{
|
||||
open(INFILE, "$ARGV[$i]");
|
||||
|
||||
($base,$path,$type) = fileparse($ARGV[$i]);
|
||||
$base =~ s/\./_/g;
|
||||
|
||||
print OUTFILE "static const char* " . $base . "[] = {\n";
|
||||
foreach $line (<INFILE>)
|
||||
{
|
||||
chomp($line);
|
||||
print OUTFILE "\"" . $line . "\\n\"\n";
|
||||
}
|
||||
print OUTFILE "\"\\0\"\n";
|
||||
print OUTFILE "};\n\n";
|
||||
|
||||
close(INFILE);
|
||||
}
|
||||
|
||||
print OUTFILE "} // namespace GLShader\n\n";
|
||||
print OUTFILE "#endif\n";
|
||||
|
||||
close(OUTFILE);
|
||||
|
||||
|
||||
sub usage {
|
||||
print "create_shaders.pl <shader programs> <OUTPUT C++ header>\n";
|
||||
exit(0);
|
||||
}
|
Loading…
Reference in New Issue