even more beautiful code

This commit is contained in:
spacy51 2008-10-27 18:23:21 +00:00
parent abb71b9b39
commit ec3e07d6a8
35 changed files with 159 additions and 158 deletions

View File

@ -1,5 +1,5 @@
#ifndef VBA_CHEATSEARCH_H
#define VBA_CHEATSEARCH_H
#ifndef CHEATSEARCH_H
#define CHEATSEARCH_H
#include "System.h"
@ -41,14 +41,14 @@ enum {
(bits)[(off) >> 3] & (1 << ((off) & 7))
extern CheatSearchData cheatSearchData;
extern void cheatSearchCleanup(CheatSearchData *cs);
extern void cheatSearchStart(const CheatSearchData *cs);
extern void cheatSearch(const CheatSearchData *cs, int compare, int size,
bool isSigned);
extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size,
bool isSigned, u32 value);
extern int cheatSearchGetCount(const CheatSearchData *cs, int size);
extern void cheatSearchUpdateValues(const CheatSearchData *cs);
extern s32 cheatSearchSignedRead(u8 *data, int off, int size);
extern u32 cheatSearchRead(u8 *data, int off, int size);
#endif
void cheatSearchCleanup(CheatSearchData *cs);
void cheatSearchStart(const CheatSearchData *cs);
void cheatSearch(const CheatSearchData *cs, int compare, int size, bool isSigned);
void cheatSearchValue(const CheatSearchData *cs, int compare, int size, bool isSigned, u32 value);
int cheatSearchGetCount(const CheatSearchData *cs, int size);
void cheatSearchUpdateValues(const CheatSearchData *cs);
s32 cheatSearchSignedRead(u8 *data, int off, int size);
u32 cheatSearchRead(u8 *data, int off, int size);
#endif // CHEATSEARCH_H

View File

@ -1,5 +1,5 @@
#ifndef GBA_CHEATS_H
#define GBA_CHEATS_H
#ifndef CHEATS_H
#define CHEATS_H
struct CheatsData {
int code;
@ -35,4 +35,4 @@ int cheatsCheckKeys(u32 keys, u32 extended);
extern int cheatsNumber;
extern CheatsData cheatsList[100];
#endif // GBA_CHEATS_H
#endif // CHEATS_H

View File

@ -185,4 +185,3 @@ void eepromWrite(u32 /* address */, u8 value)
break;
}
}

View File

@ -1,5 +1,5 @@
#ifndef VBA_EEPROM_H
#define VBA_EEPROM_H
#ifndef EEPROM_H
#define EEPROM_H
extern void eepromSaveGame(gzFile _gzFile);
extern void eepromReadGame(gzFile _gzFile, int version);
@ -18,4 +18,4 @@ extern int eepromSize;
#define EEPROM_READDATA2 3
#define EEPROM_WRITEDATA 4
#endif // VBA_EEPROM_H
#endif // EEPROM_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_FLASH_H
#define VBA_FLASH_H
#ifndef FLASH_H
#define FLASH_H
extern void flashSaveGame(gzFile _gzFile);
extern void flashReadGame(gzFile _gzFile, int version);
@ -14,4 +14,5 @@ extern void flashSetSize(int size);
extern void flashInit();
extern int flashSize;
#endif // VBA_FLASH_H
#endif // FLASH_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_GLOBALS_H
#define VBA_GLOBALS_H
#ifndef GLOBALS_H
#define GLOBALS_H
#include "agb/GBA.h"
@ -132,4 +132,4 @@ extern u16 IE;
extern u16 IF;
extern u16 IME;
#endif // VBA_GLOBALS_H
#endif // GLOBALS_H

View File

@ -1,8 +1,8 @@
#ifndef VBA_PATCH_H
#define VBA_PATCH_H
#ifndef PATCH_H
#define PATCH_H
#include "System.h"
bool applyPatch(const char *patchname, u8 **rom, int *size);
#endif
#endif // PATCH_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_PORT_H
#define VBA_PORT_H
#ifndef PORT_H
#define PORT_H
// swaps a 16-bit value
static inline u16 swap16(u16 v)
@ -53,4 +53,4 @@ static inline u32 swap32(u32 v)
*((u32 *)x) = (v)
#endif
#endif
#endif // PORT_H

View File

@ -1,12 +1,13 @@
#ifndef VBA_RTC_H
#define VBA_RTC_H
extern u16 rtcRead(u32 address);
extern bool rtcWrite(u32 address, u16 value);
extern void rtcEnable(bool);
extern bool rtcIsEnabled();
extern void rtcReset();
#ifndef RTC_H
#define RTC_H
extern void rtcReadGame(gzFile gzFile);
extern void rtcSaveGame(gzFile gzFile);
u16 rtcRead(u32 address);
bool rtcWrite(u32 address, u16 value);
void rtcEnable(bool);
bool rtcIsEnabled();
void rtcReset();
#endif
void rtcReadGame(gzFile gzFile);
void rtcSaveGame(gzFile gzFile);
#endif // RTC_H

View File

@ -1,7 +1,7 @@
// Sound emulation setup/options and GBA sound emulation
#ifndef SOUND_H
#define SOUND_H
#ifndef VBA_SOUND_H
#define VBA_SOUND_H
// Sound emulation setup/options and GBA sound emulation
#include "System.h"
@ -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

View File

@ -1,8 +1,8 @@
#ifndef VBA_SRAM_H
#define VBA_SRAM_H
#ifndef SRAM_H
#define SRAM_H
extern u8 sramRead(u32 address);
extern void sramWrite(u32 address, u8 byte);
extern void sramDelayedWrite(u32 address, u8 byte);
u8 sramRead(u32 address);
void sramWrite(u32 address, u8 byte);
void sramDelayedWrite(u32 address, u8 byte);
#endif // VBA_SRAM_H
#endif // SRAM_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_SYSTEM_H
#define VBA_SYSTEM_H
#ifndef SYSTEM_H
#define SYSTEM_H
#include <stdint.h>
@ -107,4 +107,4 @@ extern int systemThrottle;
#define SYSTEM_SAVE_UPDATED 30
#define SYSTEM_SAVE_NOT_UPDATED 0
#endif //VBA_SYSTEM_H
#endif // SYSTEM_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_UTIL_H
#define VBA_UTIL_H
#ifndef UTIL_H
#define UTIL_H
#include "System.h"
@ -10,39 +10,36 @@ enum IMAGE_TYPE {
};
// save game
typedef struct {
void *address;
int size;
} variable_desc;
extern bool utilWritePNGFile(const char *, int, int, u8 *);
extern bool utilWriteBMPFile(const char *, int, int, u8 *);
extern void utilApplyIPS(const char *ips, u8 **rom, int *size);
extern bool utilIsGBAImage(const char *);
extern bool utilIsGBImage(const char *);
extern bool utilIsGzipFile(const char *);
extern void utilStripDoubleExtension(const char *, char *);
extern IMAGE_TYPE utilFindType(const char *);
extern u8 *utilLoad(const char *,
bool (*)(const char*),
u8 *,
int &);
bool utilWritePNGFile(const char *, int, int, u8 *);
bool utilWriteBMPFile(const char *, int, int, u8 *);
void utilApplyIPS(const char *ips, u8 **rom, int *size);
bool utilIsGBAImage(const char *);
bool utilIsGBImage(const char *);
bool utilIsGzipFile(const char *);
void utilStripDoubleExtension(const char *, char *);
IMAGE_TYPE utilFindType(const char *);
u8 *utilLoad(const char *, bool (*)(const char*), u8 *, int &);
extern void utilPutDword(u8 *, u32);
extern void utilPutWord(u8 *, u16);
extern void utilWriteData(gzFile, variable_desc *);
extern void utilReadData(gzFile, variable_desc *);
extern void utilReadDataSkip(gzFile, variable_desc *);
extern int utilReadInt(gzFile);
extern void utilWriteInt(gzFile, int);
extern gzFile utilGzOpen(const char *file, const char *mode);
extern gzFile utilMemGzOpen(char *memory, int available, const char *mode);
extern int utilGzWrite(gzFile file, const voidp buffer, unsigned int len);
extern int utilGzRead(gzFile file, voidp buffer, unsigned int len);
extern int utilGzClose(gzFile file);
extern z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence);
extern long utilGzMemTell(gzFile file);
extern void utilGBAFindSave(const u8 *, const int);
extern void utilUpdateSystemColorMaps();
#endif
void utilPutDword(u8 *, u32);
void utilPutWord(u8 *, u16);
void utilWriteData(gzFile, variable_desc *);
void utilReadData(gzFile, variable_desc *);
void utilReadDataSkip(gzFile, variable_desc *);
int utilReadInt(gzFile);
void utilWriteInt(gzFile, int);
gzFile utilGzOpen(const char *file, const char *mode);
gzFile utilMemGzOpen(char *memory, int available, const char *mode);
int utilGzWrite(gzFile file, const voidp buffer, unsigned int len);
int utilGzRead(gzFile file, voidp buffer, unsigned int len);
int utilGzClose(gzFile file);
z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence);
long utilGzMemTell(gzFile file);
void utilGBAFindSave(const u8 *, const int);
void utilUpdateSystemColorMaps();
#endif // UTIL_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_GBA_H
#define VBA_GBA_H
#ifndef GBA_H
#define GBA_H
#include "../System.h"
@ -138,4 +138,4 @@ extern struct EmulatedSystem GBASystem;
#include "../EEprom.h"
#include "../Flash.h"
#endif //VBA_GBA_H
#endif // GBA_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_GFX_H
#define VBA_GFX_H
#ifndef GFX_H
#define GFX_H
#include "GBA.h"
#include "../Globals.h"
@ -1578,4 +1578,4 @@ static inline void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb)
}
}
#endif // VBA_GFX_H
#endif // GFX_H

View File

@ -1,7 +1,7 @@
#pragma once
#include <winsock.h>
#ifndef LINKH
#define LINKH
#define LINK_PARENTLOST 0x80
#define UNSUPPORTED -1
#define MULTIPLAYER 0
@ -102,5 +102,3 @@ extern bool linkenable;
extern int linktimeout;
extern lclient lc;
extern int linkid;
#endif

View File

@ -1,5 +1,5 @@
#ifndef VBA_GBAcpu_H
#define VBA_GBAcpu_H
#ifndef GBACPU_H
#define GBACPU_H
extern int armExecute();
extern int thumbExecute();
@ -280,4 +280,4 @@ inline void cpuMasterCodeCheck()
}
}
#endif //VBA_GBAcpu_H
#endif // GBACPU_H

View File

@ -714,4 +714,4 @@ unwritable:
}
}
#endif //GBAINLINE_H
#endif // GBAINLINE_H

View File

@ -1,8 +1,10 @@
#ifndef VBA_AGBPRINT_H
#define VBA_AGBPRINT_H
extern void agbPrintEnable(bool);
extern bool agbPrintIsEnabled();
extern void agbPrintReset();
extern bool agbPrintWrite(u32, u16);
extern void agbPrintFlush();
#endif
#ifndef AGBPRINT_H
#define AGBPRINT_H
void agbPrintEnable(bool enable);
bool agbPrintIsEnabled();
void agbPrintReset();
bool agbPrintWrite(u32 address, u16 value);
void agbPrintFlush();
#endif // AGBPRINT_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_BIOS_H
#define VBA_BIOS_H
#ifndef BIOS_H
#define BIOS_H
extern void BIOS_ArcTan();
extern void BIOS_ArcTan2();
@ -25,4 +25,5 @@ extern void BIOS_SoftReset();
extern void BIOS_Sqrt();
extern void BIOS_MidiKey2Freq();
extern void BIOS_SndDriverJmpTableCopy();
#endif // VBA_BIOS_H
#endif // BIOS_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_GB_GB_H
#define VBA_GB_GB_H
#ifndef GB_H
#define GB_H
#define C_FLAG 0x10
#define H_FLAG 0x20
@ -40,4 +40,4 @@ bool gbReadGSASnapshot(const char *);
extern struct EmulatedSystem GBSystem;
#endif
#endif // GB_H

View File

@ -1,5 +1,5 @@
#ifndef __VBA_GB_GBCHEATS_H
#define __VBA_GB_GBCHEATS_H
#ifndef GBCHEATS_H
#define GBCHEATS_H
#include "../System.h"
@ -39,5 +39,5 @@ bool gbVerifyGgCode(const char *code);
extern int gbCheatNumber;
extern gbCheat gbCheatList[100];
extern bool gbCheatMap[0x10000];
#endif
#endif // GBCHEATS_H

View File

@ -1,3 +1,6 @@
#ifndef GBGLOBALS_H
#define GBGLOBALS_H
extern int gbRomSizeMask;
extern int gbRomSize;
extern int gbRamSize;
@ -69,3 +72,5 @@ extern void gbRenderLine();
extern void gbDrawSprites(bool);
extern u8 (*gbSerialFunction)(u8);
#endif // GBGLOBALS_H

View File

@ -1,3 +1,6 @@
#ifndef GBMEMORY_H
#define GBMEMORY_H
#include <time.h>
struct mapperMBC1 {
@ -182,6 +185,4 @@ extern void memoryUpdateMapTAMA5();
extern void memoryUpdateMapMMM01();
extern void memoryUpdateMapGS3();
#endif // GBMEMORY_H

View File

@ -1,3 +1,6 @@
#ifndef GBSGB_H
#define GBSGB_H
void gbSgbInit();
void gbSgbShutdown();
void gbSgbCommand();
@ -17,4 +20,4 @@ extern int gbSgbPacketTimeout;
extern u8 gbSgbReadingController;
extern int gbSgbFourPlayers;
#endif // GBSGB_H

View File

@ -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
@ -64,7 +64,7 @@ void gbSoundEvent( u16 address, int data );
#define SOUND_EVENT gbSoundEvent
// Emulates read from sound hardware
u8 gbSoundRead( u16 address );
u8 gbSoundRead( u16 address );
// Notifies emulator that SOUND_CLOCK_TICKS clocks have passed
void gbSoundTick();
@ -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

View File

@ -1,5 +1,5 @@
#ifndef VBA_ELF_H
#define VBA_ELF_H
#ifndef ELF_H
#define ELF_H
enum LocationType {
LOCATION_register,
@ -261,4 +261,5 @@ extern bool elfFindLineInModule(u32 *, const char *, int);
u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *);
u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *, u32);
int elfFindLine(CompileUnit *unit, Function *func, u32 addr, const char **);
#endif
#endif // ELF_H

View File

@ -1,3 +1,6 @@
#ifndef MEMGZIO_H
#define MEMGZIO_H
/* gzio.c -- IO on .gz files
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
@ -11,8 +14,10 @@
#include <zlib.h>
gzFile ZEXPORT memgzopen(char *memory, int, const char *);
int ZEXPORT memgzread(gzFile, voidp, unsigned);
int ZEXPORT memgzwrite(gzFile, const voidp, unsigned);
int ZEXPORT memgzclose(gzFile);
long ZEXPORT memtell(gzFile);
gzFile ZEXPORT memgzopen(char *memory, int available, const char *mode);
int ZEXPORT memgzread(gzFile file, voidp buf, unsigned len);
int ZEXPORT memgzwrite(gzFile file, const voidp buf, unsigned len);
int ZEXPORT memgzclose(gzFile file);
long ZEXPORT memtell(gzFile file);
#endif // MEMGZIO_H

View File

@ -1,5 +1,5 @@
#ifndef VBA_WIN32_INPUT_H
#define VBA_WIN32_INPUT_H
#pragma once
#include "../System.h"
#define JOYCONFIG_MESSAGE (WM_USER + 1000)
@ -44,5 +44,3 @@ class Input {
virtual void loadSettings() = 0;
virtual void saveSettings() = 0;
};
#endif

View File

@ -1,11 +1,4 @@
#if !defined(AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_)
#define AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LinkOptions.h : header file
//
class CMyTabCtrl : public CTabCtrl {
DECLARE_DYNAMIC(CMyTabCtrl)
@ -225,7 +218,4 @@ protected:
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_)

View File

@ -1,5 +1,4 @@
#ifndef VBA_WIN32_SOUND_H
#define VBA_WIN32_SOUND_H
#pragma once
enum AUDIO_API {
DIRECTSOUND = 0
@ -24,5 +23,3 @@ class ISound
virtual void setThrottle( unsigned short throttle ) {};
};
#endif

View File

@ -1,3 +1,5 @@
#pragma once
#ifndef NO_OGL
//*********************************************************

View File

@ -1,3 +1,5 @@
#pragma once
#ifndef NO_OGL
#define GZGLFONT_SIZE 35096
@ -258,5 +260,4 @@ unsigned char gzglfont[]=
'\xF1', '\xAA', '\xBA', '\x4E', '\x18', '\x89', '\x00', '\x00'
};
#endif // NO_OGL

View File

@ -1,5 +1,4 @@
#ifndef ___PROTECT_H_
#define ___PROTECT_H_
#pragma once
#if defined(__cplusplus)
extern "C" {
@ -25,5 +24,3 @@ char *unprotect_buffer(unsigned char *buffer, size_t buffer_len);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -1,3 +1,5 @@
#pragma once
//---------------------------------------------------------------------------------------------------------------------------
// hq2x plugin example - Steve Snake 2004.
// This plugin uses (modified) code by Maxim Stepin - see "hq2x16.asm" for info