mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 18:49:18 +01:00
minor changes
This commit is contained in:
parent
bf187a2087
commit
ad6f2134fc
@ -1,23 +1,3 @@
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||
// Copyright (C) 2007-2008 VBA-M development team
|
||||
// Copyright (C) 2007-2008 Shay Green (blargg)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "../gba/Sound.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// GB sound emulation
|
||||
#ifndef GBSOUND_H
|
||||
#define GBSOUND_H
|
||||
|
||||
#ifndef VBA_GBSOUND_H
|
||||
#define VBA_GBSOUND_H
|
||||
// GB sound emulation
|
||||
|
||||
// See Sound.h for sound setup/options
|
||||
|
||||
@ -75,4 +75,4 @@ extern int soundTicks; // Number of 16.8 MHz clocks until gbSoundTick()
|
||||
void gbSoundSaveGame( gzFile out );
|
||||
void gbSoundReadGame( int version, gzFile in );
|
||||
|
||||
#endif
|
||||
#endif // GBSOUND_H
|
||||
|
@ -1,21 +1,3 @@
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||
// Copyright (C) VBA-M development team
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@ -757,8 +739,13 @@ static bool CPUReadState(gzFile gzFile)
|
||||
soundReadGame(gzFile, version);
|
||||
|
||||
if(version > SAVE_GAME_VERSION_1) {
|
||||
if(skipSaveGameCheats) {
|
||||
// skip cheats list data
|
||||
cheatsReadGameSkip(gzFile, version);
|
||||
} else {
|
||||
cheatsReadGame(gzFile, version);
|
||||
}
|
||||
}
|
||||
if(version > SAVE_GAME_VERSION_6) {
|
||||
rtcReadGame(gzFile);
|
||||
}
|
||||
@ -791,7 +778,7 @@ static bool CPUReadState(gzFile gzFile)
|
||||
timer1Ticks = ((0x10000 - TM1D) << timer1ClockReload) - timer1Ticks;
|
||||
timer2Ticks = ((0x10000 - TM2D) << timer2ClockReload) - timer2Ticks;
|
||||
timer3Ticks = ((0x10000 - TM3D) << timer3ClockReload) - timer3Ticks;
|
||||
// interp_rate();
|
||||
interp_rate();
|
||||
}
|
||||
|
||||
// set pointers!
|
||||
@ -2355,25 +2342,28 @@ void CPUCheckDMA(int reason, int dmamask)
|
||||
|
||||
void CPUUpdateRegister(u32 address, u16 value)
|
||||
{
|
||||
switch(address) {
|
||||
case 0x00:
|
||||
switch(address)
|
||||
{
|
||||
if ((value & 7) >5)
|
||||
case 0x00:
|
||||
{ // we need to place the following code in { } because we declare & initialize variables in a case statement
|
||||
if((value & 7) > 5) {
|
||||
// display modes above 0-5 are prohibited
|
||||
DISPCNT = (value & 7);
|
||||
bool change = ((DISPCNT ^ value) & 0x80) ? true : false;
|
||||
bool changeBG = ((DISPCNT ^ value) & 0x0F00) ? true : false;
|
||||
u16 changeBGon = (((~DISPCNT) & value) & 0x0F00);
|
||||
DISPCNT = (value & 0xFFF7);
|
||||
}
|
||||
bool change = (0 != ((DISPCNT ^ value) & 0x80));
|
||||
bool changeBG = (0 != ((DISPCNT ^ value) & 0x0F00));
|
||||
u16 changeBGon = ((~DISPCNT) & value) & 0x0F00; // these layers are being activated
|
||||
|
||||
DISPCNT = (value & 0xFFF7); // bit 3 can only be accessed by the BIOS to enable GBC mode
|
||||
UPDATE_REG(0x00, DISPCNT);
|
||||
|
||||
if (changeBGon)
|
||||
{
|
||||
if(changeBGon) {
|
||||
layerEnableDelay = 4;
|
||||
layerEnable = layerSettings & value & (~changeBGon);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
layerEnable = layerSettings & value;
|
||||
// CPUUpdateTicks();
|
||||
}
|
||||
|
||||
windowOn = (layerEnable & 0x6000) ? true : false;
|
||||
if(change && !((value & 0x80))) {
|
||||
@ -2389,10 +2379,11 @@ void CPUUpdateRegister(u32 address, u16 value)
|
||||
}
|
||||
CPUUpdateRender();
|
||||
// we only care about changes in BG0-BG3
|
||||
if(changeBG)
|
||||
if(changeBG) {
|
||||
CPUUpdateRenderBuffers(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x04:
|
||||
DISPSTAT = (value & 0xFF38) | (DISPSTAT & 7);
|
||||
UPDATE_REG(0x04, DISPSTAT);
|
||||
@ -2740,7 +2731,7 @@ void CPUUpdateRegister(u32 address, u16 value)
|
||||
break;
|
||||
case 0x100:
|
||||
timer0Reload = value;
|
||||
// interp_rate();
|
||||
interp_rate();
|
||||
break;
|
||||
case 0x102:
|
||||
timer0Value = value;
|
||||
@ -2749,7 +2740,7 @@ void CPUUpdateRegister(u32 address, u16 value)
|
||||
break;
|
||||
case 0x104:
|
||||
timer1Reload = value;
|
||||
// interp_rate();
|
||||
interp_rate();
|
||||
break;
|
||||
case 0x106:
|
||||
timer1Value = value;
|
||||
@ -2912,7 +2903,7 @@ void applyTimer ()
|
||||
}
|
||||
timer0On = timer0Value & 0x80 ? true : false;
|
||||
TM0CNT = timer0Value & 0xC7;
|
||||
// interp_rate();
|
||||
interp_rate();
|
||||
UPDATE_REG(0x102, TM0CNT);
|
||||
// CPUUpdateTicks();
|
||||
}
|
||||
@ -2927,7 +2918,7 @@ void applyTimer ()
|
||||
}
|
||||
timer1On = timer1Value & 0x80 ? true : false;
|
||||
TM1CNT = timer1Value & 0xC7;
|
||||
// interp_rate();
|
||||
interp_rate();
|
||||
UPDATE_REG(0x106, TM1CNT);
|
||||
}
|
||||
if (timerOnOffDelay & 4)
|
||||
@ -3624,95 +3615,96 @@ void CPULoop(int ticks)
|
||||
case 16:
|
||||
{
|
||||
u16 *dest = (u16 *)pix + 242 * (VCOUNT+1);
|
||||
for(int x = -1; x < 240;) {
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
for(int x = 0; x < 240;) {
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[++x]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
*dest++ = systemColorMap16[lineMix[x++]&0xFFFF];
|
||||
}
|
||||
// for filters that read past the screen
|
||||
*dest = 0;
|
||||
*dest++ = 0;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
{
|
||||
u8 *dest = (u8 *)pix + 240 * VCOUNT * 3;
|
||||
for(int x = -1; x < 240;) {
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
for(int x = 0; x < 240;) {
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
dest += 3;
|
||||
*((u32 *)dest) = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
{
|
||||
u32 *dest = (u32 *)pix + 241 * (VCOUNT+1);
|
||||
for(int x = -1; x < 240; ) {
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
for(int x = 0; x < 240; ) {
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest = systemColorMap32[lineMix[++x] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
*dest++ = systemColorMap32[lineMix[x++] & 0xFFFF];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,24 +1,3 @@
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
// Copyright (C) 2004-2006 VBA development team
|
||||
// Copyright (C) 2007-2008 VBA-M development team
|
||||
// Copyright (C) 2007-2008 Shay Green (blargg)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Sound.h"
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef SOUND_H
|
||||
#define SOUND_H
|
||||
|
||||
// Sound emulation setup/options and GBA sound emulation
|
||||
|
||||
#ifndef VBA_SOUND_H
|
||||
#define VBA_SOUND_H
|
||||
|
||||
#include "System.h"
|
||||
#include "../System.h"
|
||||
|
||||
//// Setup/options (these affect GBA and GB sound)
|
||||
|
||||
@ -80,4 +80,4 @@ extern int soundTicks; // Number of 16.8 MHz clocks until soundTick() w
|
||||
void soundSaveGame( gzFile );
|
||||
void soundReadGame( gzFile, int version );
|
||||
|
||||
#endif // VBA_SOUND_H
|
||||
#endif // SOUND_H
|
||||
|
Loading…
Reference in New Issue
Block a user