Commit 99a633f5 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Start getting rid of non-libretro codepaths

parent d0653dd8
......@@ -57,12 +57,8 @@ unsigned int cartAddrMask = 0x3FFFFF;
/* with selector, I get
* writeSaveGameFile: Couldn't open Battery//mnt/sd/Games/race/ChryMast.ngf file
*/
#ifdef __LIBRETRO__
extern char retro_save_directory[2048];
#define SAVEGAME_DIR retro_save_directory
#else
#define SAVEGAME_DIR "states/"
#endif
unsigned char currentWriteCycle = 1; /* can be 1 through 6 */
unsigned char currentCommand = NO_COMMAND;
......
......@@ -15,17 +15,11 @@
#include "StdAfx.h"
#include "main.h"
#ifndef __LIBRETRO__
#include "menu.h"
#include "GP2X.h"
#endif
#include "graphics.h"
#include "memory.h"
#ifdef __LIBRETRO__
extern ngp_screen* screen;
extern int gfx_hacks;
#endif
#define INITGUID
......@@ -157,9 +151,8 @@ unsigned short p2[16] = {
#ifndef __LIBRETRO__
#define DO_PERIODIC_FLASH_SAVES
#define DO_FPS_DISPLAY
#endif
#if defined(DO_FPS_DISPLAY) || defined(DO_PERIODIC_FLASH_SAVES)
#if defined(DO_PERIODIC_FLASH_SAVES)
static unsigned int frameCount = 0;
#endif
......@@ -181,7 +174,7 @@ void graphicsBlitEnd(void)
void graphics_paint(void);
#if defined(DO_FPS_DISPLAY) || defined(DO_PERIODIC_FLASH_SAVES)
#if defined(DO_PERIODIC_FLASH_SAVES)
inline void incFrameCount()
{
frameCount++;
......@@ -470,15 +463,13 @@ void palette_init16(DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask)
*/
void graphicsSetDarkFilterLevel(unsigned filterLevel)
{
#ifdef __LIBRETRO__
unsigned prev_dark_filter_level = dark_filter_level;
unsigned prev_dark_filter_level = dark_filter_level;
dark_filter_level = filterLevel;
dark_filter_level = (dark_filter_level > 100) ? 100 : dark_filter_level;
dark_filter_level = filterLevel;
dark_filter_level = (dark_filter_level > 100) ? 100 : dark_filter_level;
if (dark_filter_level != prev_dark_filter_level)
palette_init16(0xf800,0x7e0,0x1f);
#endif
if (dark_filter_level != prev_dark_filter_level)
palette_init16(0xf800,0x7e0,0x1f);
}
void palette_init8(DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask)
......@@ -1141,7 +1132,7 @@ void graphicsBlitLine(unsigned char render)
tlcsMemWriteB(0x00008010,tlcsMemReadB(0x00008010) & ~0x40);
graphicsBlitInit();
#if defined(DO_FPS_DISPLAY) || defined(DO_PERIODIC_FLASH_SAVES)
#if defined(DO_PERIODIC_FLASH_SAVES)
incFrameCount();
#endif
......
......@@ -363,49 +363,43 @@ void WriteSoundChip(SoundChip* chip, _u8 data)
//=============================================================================
//#ifdef __LIBRETRO__
void dac_writeL(unsigned char data)
{
static int conv=5;
#ifdef __LIBRETRO__
//pretend that conv=5.5 (44100/8000) conversion factor
if(conv==5)
conv=6;
else
{
conv=5;
//Arregla el sonido del Super Real Mahjong
if (fixsoundmahjong>500)
conv=3;
}
#else
conv=1;
#endif
static int conv=5;
/* pretend that conv=5.5 (44100/8000) conversion factor */
if(conv==5)
conv=6;
else
{
conv=5;
/* Arregla el sonido del Super Real Mahjong */
if (fixsoundmahjong>500)
conv=3;
}
for(int i=0;i<conv;i++)
{
//Write to buffer
dacBufferL[dacLBufferWrite++] = (data-0x80)<<8;
for(int i=0;i<conv;i++)
{
//Write to buffer
dacBufferL[dacLBufferWrite++] = (data-0x80)<<8;
//dacLBufferWrite++;
if (dacLBufferWrite == DAC_BUFFERSIZE)
dacLBufferWrite = 0;
//dacLBufferWrite++;
if (dacLBufferWrite == DAC_BUFFERSIZE)
dacLBufferWrite = 0;
//Overflow?
dacLBufferCount++;
if (dacLBufferCount == DAC_BUFFERSIZE)
{
//dbg_printf("dac_write: DAC buffer overflow\nPlease report this to the author.");
dacLBufferCount = 0;
}
}
//Overflow?
dacLBufferCount++;
if (dacLBufferCount == DAC_BUFFERSIZE)
{
//dbg_printf("dac_write: DAC buffer overflow\nPlease report this to the author.");
dacLBufferCount = 0;
}
}
}
//#endif
/*void dac_writeR(unsigned char data)
{
......@@ -434,11 +428,7 @@ void dac_update(_u16* dac_buffer, int length_bytes)
while (length_bytes > 1)
{
//Copy then clear DAC data
#ifdef __LIBRETRO__
*(dac_buffer++) |= dacBufferL[dacLBufferRead];
#else
*(dac_buffer++) = dacBufferL[dacLBufferRead];
#endif
dacBufferL[dacLBufferRead] = 0; //silence?
length_bytes -= 2; // 1 byte = 8 bits
......@@ -518,14 +508,8 @@ void sound_init(int SampleRate)
//=============================================================================
#ifdef __LIBRETRO__
#define NGPC_CHIP_FREQUENCY 44100
#else
#define NGPC_CHIP_FREQUENCY 8000
#endif
int chip_freq=NGPC_CHIP_FREQUENCY;//what we'd prefer
int chip_freq=NGPC_CHIP_FREQUENCY; /* what we'd prefer */
#define CHIPBUFFERLENGTH 35280
......
......@@ -6983,7 +6983,7 @@ inline unsigned char makeBCD(int i)
//extern "C" int sceUtilityGetSystemParamInt (int id, int *value);
void initTimezone()
void initTimezone(void)
{
#ifdef __LIBRETRO__
/*#define PSP_SYSTEMPARAM_ID_INT_TIMEZONE 6
......@@ -9181,10 +9181,6 @@ void tlcs_execute(int cycles)
static unsigned int steps=1;
#endif
#ifndef __LIBRETRO__
UpdateInputState();
#endif
while(cycles > 0)
{
/* AKTODO */
......@@ -9281,13 +9277,8 @@ void tlcs_execute(int cycles)
//Flavor, this auto-frameskip code is messed up
void ngpc_run()
void ngpc_run(void)
{
#ifndef __LIBRETRO__
int currTick=0,lastTick=0;
u32 ticks_per_sec = 1000;
#endif /* !__LIBRETRO__ */
#ifdef AUTO_FRAMESKIP
unsigned int skipFrames=0;
#endif /* AUTO_FRAMESKIP */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment