c89 compliant? (#237)
* Replace C++ comments into C comments * Move INLINE out of Makefile.common, move to fceu-types.h An INLINE define is still existing in Makefile.common for msvc (dont have a way to to test that). Moved the rest into fceu-types.h using the one already existing from emu2413.h. * Increase maximum volume for apu channels
This commit is contained in:
committed by
hizzlekizzle
parent
829a7552f1
commit
b5803e0e1d
@@ -17,8 +17,6 @@ endif
|
|||||||
|
|
||||||
ifneq (,$(findstring msvc,$(platform)))
|
ifneq (,$(findstring msvc,$(platform)))
|
||||||
COREDEFINES += -DINLINE=_inline
|
COREDEFINES += -DINLINE=_inline
|
||||||
else
|
|
||||||
COREDEFINES += -DINLINE=inline
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PSS_STYLE),2)
|
ifeq ($(PSS_STYLE),2)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ static DECLFW(M69Write1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SUNSOFT-5/FME-7 Sound
|
/* SUNSOFT-5/FME-7 Sound */
|
||||||
|
|
||||||
static void AYSound(int Count);
|
static void AYSound(int Count);
|
||||||
static void AYSoundHQ(void);
|
static void AYSoundHQ(void);
|
||||||
|
|||||||
@@ -7,20 +7,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "../fceu-types.h"
|
#include "../fceu-types.h"
|
||||||
|
|
||||||
#ifndef INLINE
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define INLINE __forceinline
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define INLINE __inline__
|
|
||||||
#elif defined(_MWERKS_)
|
|
||||||
#define INLINE inline
|
|
||||||
#else
|
|
||||||
#define INLINE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -226,16 +226,16 @@ void UNROM512_Init(CartInfo *info) {
|
|||||||
|
|
||||||
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
|
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
|
||||||
switch (mirror) {
|
switch (mirror) {
|
||||||
case 0: // hard horizontal, internal
|
case 0: /* hard horizontal, internal */
|
||||||
SetupCartMirroring(MI_H, 1, NULL);
|
SetupCartMirroring(MI_H, 1, NULL);
|
||||||
break;
|
break;
|
||||||
case 1: // hard vertical, internal
|
case 1: /* hard vertical, internal */
|
||||||
SetupCartMirroring(MI_V, 1, NULL);
|
SetupCartMirroring(MI_V, 1, NULL);
|
||||||
break;
|
break;
|
||||||
case 2: // switchable 1-screen, internal (flags: 4-screen + horizontal)
|
case 2: /* switchable 1-screen, internal (flags: 4-screen + horizontal) */
|
||||||
SetupCartMirroring(MI_0, 0, NULL);
|
SetupCartMirroring(MI_0, 0, NULL);
|
||||||
break;
|
break;
|
||||||
case 3: // hard four screen, last 8k of 32k RAM (flags: 4-screen + vertical)
|
case 3: /* hard four screen, last 8k of 32k RAM (flags: 4-screen + vertical) */
|
||||||
SetupCartMirroring(4, 1, VROM + (info->vram_size - 8192));
|
SetupCartMirroring(4, 1, VROM + (info->vram_size - 8192));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -713,12 +713,6 @@ void retro_set_environment(retro_environment_t cb)
|
|||||||
{ "fceumm_sndvolume", "Sound Volume; 150|160|170|180|190|200|210|220|230|240|250|0|10|20|30|40|50|60|70|80|90|100|110|120|130|140" },
|
{ "fceumm_sndvolume", "Sound Volume; 150|160|170|180|190|200|210|220|230|240|250|0|10|20|30|40|50|60|70|80|90|100|110|120|130|140" },
|
||||||
{ "fceumm_sndquality", "Sound Quality; Low|High|Very High" },
|
{ "fceumm_sndquality", "Sound Quality; Low|High|Very High" },
|
||||||
{ "fceumm_swapduty", "Swap Duty Cycles; disabled|enabled" },
|
{ "fceumm_swapduty", "Swap Duty Cycles; disabled|enabled" },
|
||||||
{ "fceumm_turbo_enable", "Turbo Enable; None|Player 1|Player 2|Both" },
|
|
||||||
{ "fceumm_turbo_delay", "Turbo Delay (in frames); 3|5|10|15|30|60|1|2" },
|
|
||||||
{ "fceumm_zapper_mode", "Zapper Mode; lightgun|mouse" },
|
|
||||||
{ "fceumm_show_crosshair", "Show Crosshair; enabled|disabled" },
|
|
||||||
{ "fceumm_overclocking", "Overclocking; disabled|2x-Postrender|2x-VBlank" },
|
|
||||||
{ "fceumm_ramstate", "RAM power up state (Restart); fill $ff|fill $00|random" },
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{ "fceumm_apu_1", "Enable Sound Channel 1 (Square 1); enabled|disabled" },
|
{ "fceumm_apu_1", "Enable Sound Channel 1 (Square 1); enabled|disabled" },
|
||||||
{ "fceumm_apu_2", "Enable Sound Channel 2 (Square 2); enabled|disabled" },
|
{ "fceumm_apu_2", "Enable Sound Channel 2 (Square 2); enabled|disabled" },
|
||||||
@@ -726,6 +720,12 @@ void retro_set_environment(retro_environment_t cb)
|
|||||||
{ "fceumm_apu_4", "Enable Sound Channel 4 (Noise) ; enabled|disabled" },
|
{ "fceumm_apu_4", "Enable Sound Channel 4 (Noise) ; enabled|disabled" },
|
||||||
{ "fceumm_apu_5", "Enable Sound Channel 5 (PCM); enabled|disabled" },
|
{ "fceumm_apu_5", "Enable Sound Channel 5 (PCM); enabled|disabled" },
|
||||||
#endif
|
#endif
|
||||||
|
{ "fceumm_turbo_enable", "Turbo Enable; None|Player 1|Player 2|Both" },
|
||||||
|
{ "fceumm_turbo_delay", "Turbo Delay (in frames); 3|5|10|15|30|60|1|2" },
|
||||||
|
{ "fceumm_zapper_mode", "Zapper Mode; lightgun|mouse" },
|
||||||
|
{ "fceumm_show_crosshair", "Show Crosshair; enabled|disabled" },
|
||||||
|
{ "fceumm_overclocking", "Overclocking; disabled|2x-Postrender|2x-VBlank" },
|
||||||
|
{ "fceumm_ramstate", "RAM power up state (Restart); fill $ff|fill $00|random" },
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -966,11 +966,11 @@ static const keymap bindmap[] = {
|
|||||||
|
|
||||||
static void set_apu_channels(int chan)
|
static void set_apu_channels(int chan)
|
||||||
{
|
{
|
||||||
FSettings.SquareVolume[1] = 255 * ((chan >> 0) & 1);
|
FSettings.SquareVolume[1] = 256 * ((chan >> 0) & 1);
|
||||||
FSettings.SquareVolume[0] = 255 * ((chan >> 1) & 1);
|
FSettings.SquareVolume[0] = 256 * ((chan >> 1) & 1);
|
||||||
FSettings.TriangleVolume = 255 * ((chan >> 2) & 1);
|
FSettings.TriangleVolume = 256 * ((chan >> 2) & 1);
|
||||||
FSettings.NoiseVolume = 255 * ((chan >> 3) & 1);
|
FSettings.NoiseVolume = 256 * ((chan >> 3) & 1);
|
||||||
FSettings.PCMVolume = 255 * ((chan >> 4) & 1);
|
FSettings.PCMVolume = 256 * ((chan >> 4) & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_variables(bool startup)
|
static void check_variables(bool startup)
|
||||||
@@ -1356,7 +1356,7 @@ static void FCEUD_UpdateInput(void)
|
|||||||
|
|
||||||
JSReturn = 0;
|
JSReturn = 0;
|
||||||
|
|
||||||
// nes gamepad
|
/* nes gamepad */
|
||||||
for (player = 0; player < MAX_PLAYERS; player++)
|
for (player = 0; player < MAX_PLAYERS; player++)
|
||||||
{
|
{
|
||||||
uint8_t input_buf = 0;
|
uint8_t input_buf = 0;
|
||||||
|
|||||||
@@ -53,6 +53,19 @@ typedef unsigned long long uint64;
|
|||||||
typedef long long int64;
|
typedef long long int64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INLINE
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define INLINE __forceinline
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define INLINE __inline__
|
||||||
|
#elif defined(_MWERKS_)
|
||||||
|
#define INLINE inline
|
||||||
|
#else
|
||||||
|
#define INLINE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PSS_STYLE == 2
|
#if PSS_STYLE == 2
|
||||||
|
|
||||||
#define PSS "\\"
|
#define PSS "\\"
|
||||||
|
|||||||
@@ -1204,7 +1204,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
|
|||||||
{ &DMCFormat, 1, "5FMT" },
|
{ &DMCFormat, 1, "5FMT" },
|
||||||
{ &RawDALatch, 1, "RWDA" },
|
{ &RawDALatch, 1, "RWDA" },
|
||||||
|
|
||||||
//these are important for smooth sound after loading state
|
/* these are important for smooth sound after loading state */
|
||||||
{ &sqacc[0], sizeof(sqacc[0]) | FCEUSTATE_RLSB, "SAC1" },
|
{ &sqacc[0], sizeof(sqacc[0]) | FCEUSTATE_RLSB, "SAC1" },
|
||||||
{ &sqacc[1], sizeof(sqacc[1]) | FCEUSTATE_RLSB, "SAC2" },
|
{ &sqacc[1], sizeof(sqacc[1]) | FCEUSTATE_RLSB, "SAC2" },
|
||||||
{ &RectDutyCount[0], sizeof(RectDutyCount[0]) | FCEUSTATE_RLSB, "RCD1"},
|
{ &RectDutyCount[0], sizeof(RectDutyCount[0]) | FCEUSTATE_RLSB, "RCD1"},
|
||||||
@@ -1213,7 +1213,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
|
|||||||
{ &lq_triacc, sizeof(lq_triacc) | FCEUSTATE_RLSB, "TACC" },
|
{ &lq_triacc, sizeof(lq_triacc) | FCEUSTATE_RLSB, "TACC" },
|
||||||
{ &lq_noiseacc, sizeof(lq_noiseacc) | FCEUSTATE_RLSB, "NACC" },
|
{ &lq_noiseacc, sizeof(lq_noiseacc) | FCEUSTATE_RLSB, "NACC" },
|
||||||
|
|
||||||
//less important but still necessary
|
/* less important but still necessary */
|
||||||
{ &ChannelBC[0], sizeof(ChannelBC[0]) | FCEUSTATE_RLSB, "CBC1" },
|
{ &ChannelBC[0], sizeof(ChannelBC[0]) | FCEUSTATE_RLSB, "CBC1" },
|
||||||
{ &ChannelBC[1], sizeof(ChannelBC[1]) | FCEUSTATE_RLSB, "CBC2" },
|
{ &ChannelBC[1], sizeof(ChannelBC[1]) | FCEUSTATE_RLSB, "CBC2" },
|
||||||
{ &ChannelBC[2], sizeof(ChannelBC[2]) | FCEUSTATE_RLSB, "CBC3" },
|
{ &ChannelBC[2], sizeof(ChannelBC[2]) | FCEUSTATE_RLSB, "CBC3" },
|
||||||
@@ -1229,7 +1229,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
|
|||||||
{ &sexyfilter_acc2, sizeof(sexyfilter_acc2) | FCEUSTATE_RLSB, "FAC2" },
|
{ &sexyfilter_acc2, sizeof(sexyfilter_acc2) | FCEUSTATE_RLSB, "FAC2" },
|
||||||
{ &lq_tcout, sizeof(lq_tcout) | FCEUSTATE_RLSB, "TCOU"},
|
{ &lq_tcout, sizeof(lq_tcout) | FCEUSTATE_RLSB, "TCOU"},
|
||||||
|
|
||||||
//wave buffer is used for filtering, only need first 17 values from it
|
/* wave buffer is used for filtering, only need first 17 values from it */
|
||||||
{ &Wave, 32 * sizeof(int32), "WAVE"},
|
{ &Wave, 32 * sizeof(int32), "WAVE"},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
@@ -1243,7 +1243,7 @@ void FCEUSND_LoadState(int version) {
|
|||||||
RawDALatch &= 0x7F;
|
RawDALatch &= 0x7F;
|
||||||
DMCAddress &= 0x7FFF;
|
DMCAddress &= 0x7FFF;
|
||||||
|
|
||||||
//minimal validation
|
/* minimal validation */
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
int BC_max = 15;
|
int BC_max = 15;
|
||||||
|
|||||||
Reference in New Issue
Block a user