mirror of
https://github.com/libretro/prosystem-libretro.git
synced 2026-10-22 16:14:46 +00:00
Cleanups
This commit is contained in:
1 parent
da596828a6
commit
1924a37860
11 files changed
+341
-360
No files matched your search
@@ -50,7 +50,7 @@ void ct_channel_render(CoreChannel_t *pChannel, int16_t *pBuffer, const int32_t
|
||||
scale_R.sWhole = pChannel->cVolMain * pChannel->cVolRight;
|
||||
scale_R.sWhole = scale_R.cPair.cHi;
|
||||
|
||||
switch(pChannel->eMode)
|
||||
switch (pChannel->eMode)
|
||||
{
|
||||
case eCHANNEL_MODE_SINGLESHOT:
|
||||
/**
|
||||
@@ -208,6 +208,9 @@ void ct_channel_render(CoreChannel_t *pChannel, int16_t *pBuffer, const int32_t
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eCHANNEL_MODE_OFF:
|
||||
case eCHANNEL_MODE_FOOTER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ int32_t ct_instr_setup(uint8_t *pInstrPak)
|
||||
double dFr_int,dFr_frac;
|
||||
|
||||
int16p16_t iFr;
|
||||
uint32_t uiX,uiY;
|
||||
uint32_t uiX;
|
||||
|
||||
/**
|
||||
* In order for an instrument pack to be considered valid it must reside
|
||||
@@ -64,18 +64,14 @@ int32_t ct_instr_setup(uint8_t *pInstrPak)
|
||||
*
|
||||
* Nothing elaborate, assuming good intentions with the data we're given.
|
||||
*/
|
||||
uiY = (uint32_t)pInstrPak;
|
||||
uint32_t uiY = (uint32_t)*pInstrPak;
|
||||
if(0 != (uiY % sizeof(uint32_t)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(uiX = 0; uiX < CORETONE_INSPAK_HEAD_MAGICLEN; uiX++)
|
||||
{
|
||||
if(szCoreInstr_Magic[uiX] != pInstrPak[uiX])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(&uiCoreInstr_Count, (pInstrPak + CORETONE_INSPAK_HEAD_COUNT), sizeof(uint32_t));
|
||||
|
||||
@@ -123,32 +123,26 @@ int32_t ct_sample_setup(uint8_t *pSamplePak)
|
||||
int32p32_t lFr;
|
||||
|
||||
uint32_t *pEntry;
|
||||
uint32_t uiX,uiY;
|
||||
uint32_t uiX;
|
||||
|
||||
/**
|
||||
* We'll consider a sample package valid for use as long as its magic
|
||||
* word matches what we expect, the sample count is below our limit,
|
||||
* and it's living at a 32-Bit aligned address.
|
||||
*/
|
||||
uiY = (uint32_t)pSamplePak;
|
||||
uint32_t uiY = (uint32_t)*pSamplePak;
|
||||
if(0 != (uiY % sizeof(uint32_t)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(uiX = 0; uiX < CORETONE_SMPPAK_HEAD_MAGICLEN; uiX++)
|
||||
{
|
||||
if(szCoreSample_Magic[uiX] != pSamplePak[uiX])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(&uiY, (pSamplePak + CORETONE_SMPPAK_HEAD_COUNT), sizeof(uint32_t));
|
||||
if(uiY > CORETONE_SAMPLES_MAXENTRIES)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
pCoreSample_PackBase = pSamplePak;
|
||||
pCoreSample_DirBase = (uint32_t*)(pSamplePak + CORETONE_SMPPAK_DIR_BASE);
|
||||
|
||||
+13
-13
@@ -116,14 +116,14 @@ err:
|
||||
void bupchip_Stop(void)
|
||||
{
|
||||
bupchip_flags &= ~BUPCHIP_FLAGS_PLAYING;
|
||||
ct_stopMusic( );
|
||||
ct_stopMusic();
|
||||
}
|
||||
|
||||
void bupchip_Play(unsigned char song)
|
||||
{
|
||||
if(song >= bupchip_song_count)
|
||||
{
|
||||
bupchip_Stop( );
|
||||
bupchip_Stop();
|
||||
return;
|
||||
}
|
||||
bupchip_flags |= BUPCHIP_FLAGS_PLAYING;
|
||||
@@ -134,13 +134,13 @@ void bupchip_Play(unsigned char song)
|
||||
void bupchip_Pause(void)
|
||||
{
|
||||
bupchip_flags |= BUPCHIP_FLAGS_PAUSED;
|
||||
ct_pause( );
|
||||
ct_pause();
|
||||
}
|
||||
|
||||
void bupchip_Resume(void)
|
||||
{
|
||||
bupchip_flags &= ~BUPCHIP_FLAGS_PAUSED;
|
||||
ct_resume( );
|
||||
ct_resume();
|
||||
}
|
||||
|
||||
void bupchip_SetVolume(uint8_t volume)
|
||||
@@ -162,22 +162,22 @@ void bupchip_ProcessAudioCommand(unsigned char data)
|
||||
switch(data)
|
||||
{
|
||||
case 0:
|
||||
bupchip_flags = 0;
|
||||
bupchip_flags = 0;
|
||||
bupchip_volume = 0x1f;
|
||||
ct_stopAll( );
|
||||
ct_resume( );
|
||||
ct_stopAll();
|
||||
ct_resume();
|
||||
ct_attenMusic(127);
|
||||
break;
|
||||
case 2:
|
||||
bupchip_Resume( );
|
||||
bupchip_Resume();
|
||||
break;
|
||||
case 3:
|
||||
bupchip_Pause( );
|
||||
bupchip_Pause();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x40:
|
||||
bupchip_Stop( );
|
||||
bupchip_Stop();
|
||||
break;
|
||||
case 0x80:
|
||||
bupchip_Play(data & 0x1f);
|
||||
@@ -209,13 +209,13 @@ void bupchip_Release(void)
|
||||
|
||||
void bupchip_StateLoaded(void)
|
||||
{
|
||||
ct_stopAll( );
|
||||
ct_stopAll();
|
||||
if((bupchip_flags & BUPCHIP_FLAGS_PLAYING) == 0)
|
||||
return;
|
||||
ct_playMusic(bupchip_songs[bupchip_current_song].data);
|
||||
if((bupchip_flags & BUPCHIP_FLAGS_PAUSED) != 0)
|
||||
ct_pause( );
|
||||
ct_pause();
|
||||
else
|
||||
ct_resume( );
|
||||
ct_resume();
|
||||
bupchip_SetVolume(bupchip_volume);
|
||||
}
|
||||
+8
-8
@@ -124,7 +124,7 @@ static void maria_StoreGraphic(void)
|
||||
uint8_t data = maria_ReadByte(maria_pp.w);
|
||||
if(maria_wmode)
|
||||
{
|
||||
if(maria_IsHolyDMA( ))
|
||||
if(maria_IsHolyDMA())
|
||||
{
|
||||
maria_StoreCell(0, 0);
|
||||
maria_StoreCell(0, 0);
|
||||
@@ -137,7 +137,7 @@ static void maria_StoreGraphic(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(maria_IsHolyDMA( ))
|
||||
if(maria_IsHolyDMA())
|
||||
{
|
||||
maria_StoreCell2(0);
|
||||
maria_StoreCell2(0);
|
||||
@@ -256,7 +256,7 @@ static void maria_StoreLineRAM(void)
|
||||
for(index = 0; index < width; index++)
|
||||
{
|
||||
maria_cycles += 3;
|
||||
maria_StoreGraphic( );
|
||||
maria_StoreGraphic();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -271,11 +271,11 @@ static void maria_StoreLineRAM(void)
|
||||
maria_pp.b.h = maria_ReadByte(CHARBASE) + maria_offset;
|
||||
|
||||
maria_cycles += 6;
|
||||
maria_StoreGraphic( );
|
||||
maria_StoreGraphic();
|
||||
if(cwidth)
|
||||
{
|
||||
maria_cycles += 3;
|
||||
maria_StoreGraphic( );
|
||||
maria_StoreGraphic();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ uint32_t maria_RenderScanline(void)
|
||||
maria_dp.b.h = maria_ReadByte(maria_dpp.w + 1);
|
||||
|
||||
if(maria_ReadByte(maria_dpp.w) & 128)
|
||||
sally_ExecuteNMI( );
|
||||
sally_ExecuteNMI();
|
||||
}
|
||||
else if(maria_scanline >= maria_visibleArea.top && maria_scanline <= maria_visibleArea.bottom)
|
||||
maria_WriteLineRAM(maria_surface + ((maria_scanline - maria_displayArea.top) * Rect_GetLength(&maria_displayArea)));
|
||||
@@ -318,7 +318,7 @@ uint32_t maria_RenderScanline(void)
|
||||
{
|
||||
maria_dp.b.l = maria_ReadByte(maria_dpp.w + 2);
|
||||
maria_dp.b.h = maria_ReadByte(maria_dpp.w + 1);
|
||||
maria_StoreLineRAM( );
|
||||
maria_StoreLineRAM();
|
||||
maria_offset--;
|
||||
if(maria_offset < 0)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ uint32_t maria_RenderScanline(void)
|
||||
maria_offset = maria_ReadByte(maria_dpp.w) & 15;
|
||||
|
||||
if(maria_ReadByte(maria_dpp.w) & 128)
|
||||
sally_ExecuteNMI( );
|
||||
sally_ExecuteNMI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -92,10 +92,10 @@ void memory_Write(uint16_t address, uint8_t data)
|
||||
memory_ram[WSYNC] = true;
|
||||
break;
|
||||
case INPTCTRL:
|
||||
if(data == 22 && cartridge_IsLoaded( ))
|
||||
cartridge_Store( );
|
||||
if(data == 22 && cartridge_IsLoaded())
|
||||
cartridge_Store();
|
||||
else if(data == 2 && bios_enabled)
|
||||
bios_Store( );
|
||||
bios_Store();
|
||||
break;
|
||||
case INPT0:
|
||||
case INPT1:
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ void pokey_Reset(void)
|
||||
int index, channel;
|
||||
|
||||
for(index = 0; index < POKEY_POLY17_SIZE; index++)
|
||||
pokey_poly17[index] = rand( ) & 1;
|
||||
pokey_poly17[index] = rand() & 1;
|
||||
|
||||
pokey_polyAdjust = 0;
|
||||
pokey_poly04Cntr = 0;
|
||||
|
||||
+22
-29
@@ -38,7 +38,6 @@
|
||||
#include "BupChip.h"
|
||||
#define PRO_SYSTEM_STATE_HEADER "PRO-SYSTEM STATE"
|
||||
|
||||
static uint8_t prosystem_frame = 0;
|
||||
static uint32_t prosystem_cycles = 0;
|
||||
uint16_t prosystem_frequency = 60;
|
||||
uint16_t prosystem_scanlines = 262;
|
||||
@@ -48,24 +47,23 @@ void prosystem_Reset(void)
|
||||
if(!cartridge_IsLoaded())
|
||||
return;
|
||||
|
||||
prosystem_frame = 0;
|
||||
sally_Reset();
|
||||
region_Reset( );
|
||||
tia_Clear( );
|
||||
tia_Reset( );
|
||||
pokey_Clear( );
|
||||
pokey_Reset( );
|
||||
memory_Reset( );
|
||||
maria_Clear( );
|
||||
maria_Reset( );
|
||||
riot_Reset ( );
|
||||
region_Reset();
|
||||
tia_Clear();
|
||||
tia_Reset();
|
||||
pokey_Clear();
|
||||
pokey_Reset();
|
||||
memory_Reset();
|
||||
maria_Clear();
|
||||
maria_Reset();
|
||||
riot_Reset ();
|
||||
|
||||
if(bios_enabled)
|
||||
bios_Store( );
|
||||
bios_Store();
|
||||
else
|
||||
cartridge_Store( );
|
||||
cartridge_Store();
|
||||
|
||||
prosystem_cycles = sally_ExecuteRES( );
|
||||
prosystem_cycles = sally_ExecuteRES();
|
||||
}
|
||||
|
||||
void prosystem_ExecuteFrame(const uint8_t* input)
|
||||
@@ -96,19 +94,19 @@ void prosystem_ExecuteFrame(const uint8_t* input)
|
||||
|
||||
if(memory_ram[WSYNC] && !(cartridge_flags & CARTRIDGE_WSYNC_MASK))
|
||||
{
|
||||
prosystem_cycles = 456;
|
||||
prosystem_cycles = 456;
|
||||
memory_ram[WSYNC] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cycles = maria_RenderScanline( );
|
||||
cycles = maria_RenderScanline();
|
||||
if(cartridge_flags & CARTRIDGE_CYCLE_STEALING_MASK)
|
||||
prosystem_cycles += cycles;
|
||||
|
||||
while(prosystem_cycles < 456)
|
||||
{
|
||||
cycles = sally_ExecuteInstruction( );
|
||||
cycles = sally_ExecuteInstruction();
|
||||
prosystem_cycles += (cycles << 2);
|
||||
if(riot_timing)
|
||||
riot_UpdateTimer(cycles);
|
||||
@@ -135,11 +133,6 @@ void prosystem_ExecuteFrame(const uint8_t* input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prosystem_frame++;
|
||||
|
||||
if(prosystem_frame >= prosystem_frequency)
|
||||
prosystem_frame = 0;
|
||||
}
|
||||
|
||||
bool prosystem_Save(char *buffer, bool compress)
|
||||
@@ -257,7 +250,7 @@ bool prosystem_Load(const char *buffer)
|
||||
bupchip_flags = buffer[offset++];
|
||||
bupchip_volume = buffer[offset++];
|
||||
bupchip_current_song = buffer[offset++];
|
||||
bupchip_StateLoaded( );
|
||||
bupchip_StateLoaded();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -265,11 +258,11 @@ bool prosystem_Load(const char *buffer)
|
||||
|
||||
void prosystem_Close(bool persistent_data)
|
||||
{
|
||||
bupchip_Release( );
|
||||
bupchip_Release();
|
||||
cartridge_Release(persistent_data);
|
||||
maria_Reset( );
|
||||
maria_Clear( );
|
||||
memory_Reset( );
|
||||
tia_Reset( );
|
||||
tia_Clear( );
|
||||
maria_Reset();
|
||||
maria_Clear();
|
||||
memory_Reset();
|
||||
tia_Reset();
|
||||
tia_Clear();
|
||||
}
|
||||
-10
@@ -48,16 +48,6 @@ static INLINE uint32_t Rect_GetLength(struct Rects *rect)
|
||||
return (rect->right - rect->left) + 1;
|
||||
}
|
||||
|
||||
static INLINE uint32_t Rect_GetHeight(struct Rects *rect)
|
||||
{
|
||||
return (rect->bottom - rect->top) + 1;
|
||||
}
|
||||
|
||||
static INLINE uint32_t Rect_GetArea(struct Rects *rect)
|
||||
{
|
||||
return Rect_GetLength(rect) * Rect_GetHeight(rect);
|
||||
}
|
||||
|
||||
typedef struct Rects rect;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+281
-281
File diff suppressed because it is too large.
Load diff
@@ -665,6 +665,11 @@ void retro_reset(void)
|
||||
prosystem_Reset();
|
||||
}
|
||||
|
||||
static INLINE uint32_t Rect_GetHeight(struct Rects *rect)
|
||||
{
|
||||
return (rect->bottom - rect->top) + 1;
|
||||
}
|
||||
|
||||
void retro_run(void)
|
||||
{
|
||||
const uint8_t *buffer = NULL;
|
||||
|
||||
Reference in new issue
Block a user