#floppyImage1 = ./disks/bt1_boot.dsk
# Yes
#floppyImage1 = ./disks/bt2_boot.dsk
-# No (PRODOS 8 V1.4 - UNABLE TO LOAD ATINIT FILE)
+# Yes (but segfaults in the timer routine in the title screen)
floppyImage1 = ./disks/bt3_boot_fixed.dsk
-#floppyImage1 = ./disks/Bard's Tale III - The Thief of Fate (Boot) (Disk 1 of 4).dsk
+floppyImage2 = ./disks/bt3_character_fixed.dsk
# Yes
#floppyImage1 = ./disks/Sabotage.dsk
# ??? (//c or //e w/128K required)
#floppyImage1 = ./disks/wolfenstein_dos32.nib
# Yes, keys???
#floppyImage1 = ./disks/MidnightMagic_etc.dsk
-# ??? (PRODOS 8 V1.4 - UNABLE TO LOAD ATINIT FILE)
+# ??? Loads, then dumps to monitor (This is IIe or IIc only)
#floppyImage1 = ./disks/battle_chess_1.dsk
# Yes
#floppyImage1 = ./disks/MoebiusI-1.dsk
-# Yes, but crashes on the attract mode
+#floppyImage2 = ./disks/MoebiusI-2.dsk
+# Yes, but crashes on the attract mode (does the same in AppleWin)
+# Also, has keyboard troubles... no, write problems
+#floppyImage1 = ./disks/moebiusiia.dsk
#floppyImage1 = ./disks/MoebiusIIA.dsk
-# Yes
+#floppyImage2 = ./disks/MoebiusIIB.dsk
+# Yes, but segfaults on title screen
#floppyImage1 = ./disks/wind_walker_1.dsk
# Yes
#floppyImage1 = ./disks/dino_eggs.dsk
# Yes, autoloads!
#floppyImage1 = ./disks/u2prog-patched.dsk
#floppyImage2 = ./disks/u2player-jlh.dsk
+# Yes
+#floppyImage1 = ./disks/TheHeist.dsk
# OpenGL options: 1 - use OpenGL rendering, 0 - use old style rendering
-useOpenGL = 1
+useOpenGL = 0
# OpenGL filtering type: 1 - blurry, 0 - sharp
{
//Actually, according to the A2 ref, this should do nothing since a write
//is immediately preceded by a read leaving it in the same state it was...
-// keyDown = false;
+//But leaving this out seems to fuck up the key handling of some games...
+ keyDown = false;
}
else if (addr == 0xC050)
{
//Load up disk image from config file (for now)...
floppyDrive.LoadImage(settings.diskImagePath1, 0);
-// floppyDrive.LoadImage(settings.diskImagePath2, 1);
+ floppyDrive.LoadImage(settings.diskImagePath2, 1);
// floppyDrive.LoadImage("./disks/temp.nib", 1); // Load temp .nib file into second drive...
//Kill the DOS ROM in slot 6 for now...
SoundInit();
SDL_EnableUNICODE(1); // Needed to do key translation shit
- gui = new GUI(surface); // Set up the GUI system object...
+// gui = new GUI(surface); // Set up the GUI system object...
+ gui = new GUI(mainSurface); // Set up the GUI system object...
gui->AddMenuTitle("Apple2");
gui->AddMenuItem("Test!", TestWindow/*, hotkey*/);
gui->AddMenuItem("");
{
uint8 scrByte = ram[lineAddrLoRes[y] + (displayPage2 ? 0x0400 : 0x0000) + x];
uint32 pixel = palette[scrByte & 0x0F];
-
+
for(int cy=0; cy<4; cy++)
for(int cx=0; cx<14; cx++)
scrBuffer[((x * 14) + cx) + (((y * 8) + cy) * VIRTUAL_SCREEN_WIDTH)] = pixel;
-
+
pixel = palette[scrByte >> 4];
-
+
for(int cy=4; cy<8; cy++)
for(int cx=0; cx<14; cx++)
scrBuffer[(x * 14) + (y * VIRTUAL_SCREEN_WIDTH * 8) + cx + (cy * VIRTUAL_SCREEN_WIDTH)] = pixel;
static void RenderHiRes(uint16 toLine/*= 192*/)
{
-// NOTE: Not endian safe. !!! FIX !!!
+// NOTE: Not endian safe. !!! FIX !!! [DONE]
#if 0
uint32 pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61);
#else
extents.h = h;
coverList.push_back(extents);
+#if 0
// This *should* allow us to store our colors in an endian safe way... :-/
uint8 * c = (uint8 *)&fgColor;
c[0] = fgR, c[1] = fgG, c[2] = fgB, c[3] = fgA;
c = (uint8 *)&bgColor;
c[0] = bgR, c[1] = bgG, c[2] = bgB, c[3] = bgA;
+#else
+ fgColor = SDL_MapRGBA(screen->format, fgR, fgG, fgB, fgA);
+ bgColor = SDL_MapRGBA(screen->format, bgR, bgG, bgB, bgA);
+#endif
}
Element::~Element()
#include "video.h"
// Debug support
-
//#define DEBUG_MAIN_LOOP
+// New main screen buffering
+// This works, but the colors are rendered incorrectly. Also, it seems that there's
+// fullscreen blitting still going on--dragging the disk is fast at first but then
+// gets painfully slow. Not sure what's going on there.
+#define USE_NEW_MAINBUFFERING
+
//#ifdef DEBUG_MAIN_LOOP
#include "log.h"
//#endif
-GUI::GUI(SDL_Surface * mainSurface): menuItem(new MenuItems())
+GUI::GUI(SDL_Surface * surface): menuItem(new MenuItems())
{
- windowList.push_back(new Menu());
- Element::SetScreen(mainSurface);
+ Element::SetScreen(surface);
+// windowList.push_back(new Menu());
+
+// Create drive windows, and config windows here...
+
}
GUI::~GUI()
for(i=windowList.begin(); i!=windowList.end(); i++)
(*i)->Draw();
+#ifndef USE_NEW_MAINBUFFERING
RenderScreenBuffer();
+#else
+ FlipMainScreen();
+#endif
// Main loop
while (!exitGUI)
{
- if (SDL_PollEvent(&event))
+// if (SDL_PollEvent(&event))
+ if (SDL_WaitEvent(&event))
{
#ifdef DEBUG_MAIN_LOOP
WriteLog("An event was found!");
//Dirty rectangle is also possible...
else if (event.user.code == SCREEN_REFRESH_NEEDED)
+#ifndef USE_NEW_MAINBUFFERING
RenderScreenBuffer();
+#else
+ FlipMainScreen();
+#endif
}
else if (event.type == SDL_ACTIVEEVENT)
{
if (event.active.state == SDL_APPMOUSEFOCUS)
showMouse = (event.active.gain ? true : false);
+#ifndef USE_NEW_MAINBUFFERING
RenderScreenBuffer();
+#else
+ FlipMainScreen();
+#endif
}
else if (event.type == SDL_KEYDOWN)
{
if (Element::ScreenNeedsRefreshing())
{
+#ifndef USE_NEW_MAINBUFFERING
#ifdef DEBUG_MAIN_LOOP
WriteLog("Screen refresh called!\n");
#endif
RenderScreenBuffer();
Element::ScreenWasRefreshed();
+#else
+ FlipMainScreen();
+ Element::ScreenWasRefreshed();
+#endif
}
}
+//hm. Works, but slows things way down.
+//Now we use WaitEvents() instead. Yay!
+//SDL_Delay(10);
}
SDL_EnableKeyRepeat(0, 0);
SDL_Rect rect;
rect.x = x, rect.y = y;
+//bleh
+uint8 r1, g1, b1, a1;
+SDL_GetRGBA(color, screen->format, &r1, &g1, &b1, &a1);
+color = SDL_MapRGBA(chr->format, r1, g1, b1, a1);
+//helb
+
for(uint32 i=0; i<length; i++)
{
uint8 c = string[i];
SDL_Rect rect;
rect.x = x, rect.y = y;
+//bleh (we have to map colors from the HW surface to the SW surface)
+uint8 r1, g1, b1, a1;
+SDL_GetRGBA(fg, screen->format, &r1, &g1, &b1, &a1);
+fg = SDL_MapRGBA(chr->format, r1, g1, b1, a1);
+SDL_GetRGBA(bg, screen->format, &r1, &g1, &b1, &a1);
+bg = SDL_MapRGBA(chr->format, r1, g1, b1, a1);
+//helb
+
for(uint32 i=0; i<length; i++)
{
uint8 c = string[i];
activatedSave(false), clickedSave(false),
insideSave(0), insidePopupSave(0), menuChosenSave(-1), menuItemChosenSave(-1)
{
+#if 0
// This *should* allow us to store our colors in an endian safe way... :-/
+ // Nope. Only on SW surfaces. With HW, all bets are off. :-(
uint8 * c = (uint8 *)&fgColorHL;
c[0] = fgchR, c[1] = fgchG, c[2] = fgchB, c[3] = fgchA;
c = (uint8 *)&bgColorHL;
c[0] = bgchR, c[1] = bgchG, c[2] = bgchB, c[3] = bgchA;
+#else
+ fgColorHL = SDL_MapRGBA(screen->format, fgchR, fgchG, fgchB, fgchA);
+ bgColorHL = SDL_MapRGBA(screen->format, bgchR, bgchG, bgchB, bgchA);
+#endif
}
Menu::~Menu()
#define SAMPLES_PER_FRAME (SAMPLE_RATE / 60.0)
#define CYCLES_PER_SAMPLE (1024000.0 / SAMPLE_RATE)
#define SOUND_BUFFER_SIZE (8192)
-#define AMPLITUDE (32) // -32 - +32 seems to be plenty loud!
+//#define AMPLITUDE (16) // -32 - +32 seems to be plenty loud!
// Global variables
static SDL_cond * conditional = NULL;
static SDL_mutex * mutex = NULL;
static SDL_mutex * mutex2 = NULL;
+static uint8 ampPtr = 5;
+static uint16 amplitude[17] = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
+ 4096, 8192, 16384, 32768 };
// Private function prototypes
//
void SoundInit(void)
{
-// To weed out problems for now...
#if 0
+// To weed out problems for now...
return;
#endif
buffer[i] = soundBuffer[i];
// Fill buffer with last value
- memset(buffer + soundBufferPos, (uint8)(speakerState ? AMPLITUDE : -AMPLITUDE), length - soundBufferPos);
+ memset(buffer + soundBufferPos, (uint8)(speakerState ? amplitude[ampPtr] : -amplitude[ampPtr]), length - soundBufferPos);
soundBufferPos = 0; // Reset soundBufferPos to start of buffer...
sampleBase = 0; // & sampleBase...
//Ick. This should never happen!
#endif
}
- int8 sample = (speakerState ? AMPLITUDE : -AMPLITUDE);
+ int8 sample = (speakerState ? amplitude[ampPtr] : -amplitude[ampPtr]);
while (soundBufferPos < currentPos)
soundBuffer[soundBufferPos++] = (uint8)sample;
void (* timerCallback)(void);
};
+//let's try +1... nope.
static Event eventList[EVENT_LIST_SIZE];
static uint32 nextEvent;
// increasing time, we have to search through the list for the lowest one.
//ALSO: There's a bug here--nextEvent is getting a bogus value/getting clobbered...
+// Seems like it's getting clobbered somewhere other than here...
double time = 0;
bool firstTime = true;
if (time == 0)
WriteLog("TIMING: GetTimeToNextEvent() failed to find next event!\n");
+ if (nextEvent >= EVENT_LIST_SIZE)
+ WriteLog("TIMING: GetTimeToNextEvent() has bad nextEvent (=%u)!\n", nextEvent);
+
return time;
}
SDL_Surface * surface, * mainSurface, * someAlphaSurface;
Uint32 mainSurfaceFlags;
//uint32 scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT];
-uint32 * scrBuffer = NULL;
+uint32 * scrBuffer = NULL, * mainScrBuffer = NULL;
SDL_Joystick * joystick;
//
scrBuffer = (uint32 *)surface->pixels; // Kludge--And shouldn't have to lock since it's a software surface...
//needed? Dunno. Mebbe an SDL function instead?
// memset(scrBuffer, 0x00, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32));
+ // Set up the mainScrBuffer
+ mainScrBuffer = (uint32 *)mainSurface->pixels; // May need to lock...
#ifdef TEST_ALPHA_BLENDING
//Here's some code to test alpha blending...
}
}
+// Is this even necessary? (Could call SDL_Flip directly...)
+void FlipMainScreen(void)
+{
+#ifdef TEST_ALPHA_BLENDING
+SDL_Rect dstRect = { 100, 100, 30, 30 };
+SDL_BlitSurface(someAlphaSurface, NULL, mainSurface, &dstRect);
+#endif
+
+ if (settings.useOpenGL)
+ sdlemu_draw_texture(mainSurface, surface, 1/*1=GL_QUADS*/);
+ else
+ SDL_Flip(mainSurface);
+}
+
/*
//
// Resize the main SDL screen & scrBuffer
void VideoDone(void);
//void RenderBackbuffer(void);
void RenderScreenBuffer(void);
+void FlipMainScreen(void);
//void ResizeScreen(uint32 width, uint32 height);
//uint32 GetSDLScreenPitch(void);
//void ToggleFullscreen(void);
//extern uint32 scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT];
extern uint32 * scrBuffer;
+extern uint32 * mainScrBuffer;
extern SDL_Surface * surface;
+extern SDL_Surface * mainSurface;
#endif // __VIDEO_H__