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:
retro-wertz
2018-12-04 10:25:17 +08:00
committed by hizzlekizzle
parent 829a7552f1
commit b5803e0e1d
7 changed files with 34 additions and 37 deletions

View File

@@ -17,8 +17,6 @@ endif
ifneq (,$(findstring msvc,$(platform)))
COREDEFINES += -DINLINE=_inline
else
COREDEFINES += -DINLINE=inline
endif
ifeq ($(PSS_STYLE),2)

View File

@@ -97,7 +97,7 @@ static DECLFW(M69Write1) {
}
}
// SUNSOFT-5/FME-7 Sound
/* SUNSOFT-5/FME-7 Sound */
static void AYSound(int Count);
static void AYSoundHQ(void);

View File

@@ -7,20 +7,6 @@
#include <math.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
extern "C" {
#endif

View File

@@ -226,16 +226,16 @@ void UNROM512_Init(CartInfo *info) {
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
switch (mirror) {
case 0: // hard horizontal, internal
case 0: /* hard horizontal, internal */
SetupCartMirroring(MI_H, 1, NULL);
break;
case 1: // hard vertical, internal
case 1: /* hard vertical, internal */
SetupCartMirroring(MI_V, 1, NULL);
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);
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));
break;
}

View File

@@ -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_sndquality", "Sound Quality; Low|High|Very High" },
{ "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
{ "fceumm_apu_1", "Enable Sound Channel 1 (Square 1); 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_5", "Enable Sound Channel 5 (PCM); enabled|disabled" },
#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 },
};
@@ -966,11 +966,11 @@ static const keymap bindmap[] = {
static void set_apu_channels(int chan)
{
FSettings.SquareVolume[1] = 255 * ((chan >> 0) & 1);
FSettings.SquareVolume[0] = 255 * ((chan >> 1) & 1);
FSettings.TriangleVolume = 255 * ((chan >> 2) & 1);
FSettings.NoiseVolume = 255 * ((chan >> 3) & 1);
FSettings.PCMVolume = 255 * ((chan >> 4) & 1);
FSettings.SquareVolume[1] = 256 * ((chan >> 0) & 1);
FSettings.SquareVolume[0] = 256 * ((chan >> 1) & 1);
FSettings.TriangleVolume = 256 * ((chan >> 2) & 1);
FSettings.NoiseVolume = 256 * ((chan >> 3) & 1);
FSettings.PCMVolume = 256 * ((chan >> 4) & 1);
}
static void check_variables(bool startup)
@@ -1356,7 +1356,7 @@ static void FCEUD_UpdateInput(void)
JSReturn = 0;
// nes gamepad
/* nes gamepad */
for (player = 0; player < MAX_PLAYERS; player++)
{
uint8_t input_buf = 0;

View File

@@ -53,6 +53,19 @@ typedef unsigned long long uint64;
typedef long long int64;
#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
#define PSS "\\"

View File

@@ -1204,7 +1204,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
{ &DMCFormat, 1, "5FMT" },
{ &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[1], sizeof(sqacc[1]) | FCEUSTATE_RLSB, "SAC2" },
{ &RectDutyCount[0], sizeof(RectDutyCount[0]) | FCEUSTATE_RLSB, "RCD1"},
@@ -1213,7 +1213,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
{ &lq_triacc, sizeof(lq_triacc) | FCEUSTATE_RLSB, "TACC" },
{ &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[1], sizeof(ChannelBC[1]) | FCEUSTATE_RLSB, "CBC2" },
{ &ChannelBC[2], sizeof(ChannelBC[2]) | FCEUSTATE_RLSB, "CBC3" },
@@ -1229,7 +1229,7 @@ SFORMAT FCEUSND_STATEINFO[] = {
{ &sexyfilter_acc2, sizeof(sexyfilter_acc2) | FCEUSTATE_RLSB, "FAC2" },
{ &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"},
{ 0 }
};
@@ -1243,7 +1243,7 @@ void FCEUSND_LoadState(int version) {
RawDALatch &= 0x7F;
DMCAddress &= 0x7FFF;
//minimal validation
/* minimal validation */
for (i = 0; i < 5; i++)
{
int BC_max = 15;