Skip to content

Commit

Permalink
Bring codebase more in sync with nexponent repo
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Dec 18, 2023
1 parent 76bde1c commit 174bf56
Show file tree
Hide file tree
Showing 283 changed files with 215 additions and 110 deletions.
9 changes: 6 additions & 3 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ INCFLAGS := \
-I$(LIBRETRO_COMM_DIR)/include \
-I$(CORE_DIR) \
-I$(CORE_DIR)/input \
-I$(CORE_DIR)/boards
-I$(CORE_DIR)/mappers \
-I$(CORE_DIR)/mappers/hw \
-I$(CORE_DIR)/mappers/sound

ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
Expand All @@ -18,7 +20,9 @@ COREDEFINES = \
-DFRONTEND_SUPPORTS_RGB565

FCEU_SRC_DIRS := \
$(CORE_DIR)/boards \
$(CORE_DIR)/mappers \
$(CORE_DIR)/mappers/hw \
$(CORE_DIR)/mappers/sound \
$(CORE_DIR)/input

SOURCES_C := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
Expand All @@ -40,7 +44,6 @@ SOURCES_C += \
$(CORE_DIR)/fceu-memory.c \
$(CORE_DIR)/fceu.c \
$(CORE_DIR)/fds.c \
$(CORE_DIR)/fds_apu.c \
$(CORE_DIR)/file.c \
$(CORE_DIR)/filter.c \
$(CORE_DIR)/general.c \
Expand Down
2 changes: 1 addition & 1 deletion src/fds.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "x6502.h"
#include "fceu.h"
#include "fds.h"
#include "fds_apu.h"
#include "mappers/sound/fdssound.h"
#include "sound.h"
#include "general.h"
#include "state.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/468_fme7.h → src/mappers/468_fme7.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define FME7_index regByte[15]
#define FME7_counter regWord[0]

static void FME7_sync() {
static void FME7_sync(void) {
int AND =mapperFlags &8? 0xFF: 0x7F;
switch(FME7_reg[8] &0xC0) {
case 0x00: case 0x80:
Expand Down
2 changes: 1 addition & 1 deletion src/boards/468_if12.h → src/mappers/468_if12.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define IF12_reg regByte

static void IF12_sync () {
static void IF12_sync(void) {
int AND =prgAND >>1;
int OR =prgOR >>1;
setprg16(0x8000, IF12_reg[1] &AND | OR &~AND);
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/boards/468_mmc24.h → src/mappers/468_mmc24.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define MMC24_reg regByte

static void MMC2_sync() {
static void MMC2_sync(void) {
setprg8(0x8000, MMC24_reg[0] &prgAND | prgOR &~prgAND);
setprg8(0xA000, 0xFD &prgAND | prgOR &~prgAND);
setprg8(0xC000, 0xFE &prgAND | prgOR &~prgAND);
Expand All @@ -10,7 +10,7 @@ static void MMC2_sync() {
setmirror(MMC24_reg[5] &1? MI_H: MI_V);
}

static void MMC4_sync() {
static void MMC4_sync(void) {
int AND =prgAND >>1;
int OR =prgOR >>1;
setprg16(0x8000, MMC24_reg[0] &AND | OR &~AND);
Expand Down
2 changes: 1 addition & 1 deletion src/boards/468_mmc3.h → src/mappers/468_mmc3.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define MMC3_irq regByte[13]
#define MMC3_lastReg regByte[14]

static void MMC3_sync () {
static void MMC3_sync(void) {
int chrAND =mapper &0x01? 0xFF: 0x7F;
int OR =prgOR | (misc2 &1? 12: 0);
setprg8(0x8000 ^(MMC3_index <<8 &0x4000), MMC3_reg[6] &prgAND | OR &~prgAND);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/ac-08.c → src/mappers/ac-08.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#include "mapinc.h"
#include "../fds_apu.h"
#include "sound/fdssound.h"

static uint8 reg, mirr;
static uint8 prg;
Expand Down
78 changes: 3 additions & 75 deletions src/boards/addrlatch.c → src/mappers/addrlatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

#include "mapinc.h"

static uint16 latche, latcheinit;
uint16 latche;
static uint16 latcheinit;
static uint16 addrreg0, addrreg1;
static uint8 dipswitch;
static void (*WSync)(void);
Expand Down Expand Up @@ -62,7 +63,7 @@ static void StateRestore(int version) {
WSync();
}

static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) {
void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) {
latcheinit = linit;
addrreg0 = adr0;
addrreg1 = adr1;
Expand Down Expand Up @@ -137,22 +138,6 @@ void BMCD1038_Init(CartInfo *info) {
AddExState(&dipswitch, 1, 0, "DIPSW");
}

/*------------------ Map 058 ---------------------------*/

static void M58Sync(void) {
if (latche & 0x40) {
setprg16(0x8000, latche & 7);
setprg16(0xC000, latche & 7);
} else
setprg32(0x8000, (latche >> 1) & 3);
setchr8((latche >> 3) & 7);
setmirror(((latche & 0x80) >> 7) ^ 1);
}

void Mapper58_Init(CartInfo *info) {
Latch_Init(info, M58Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}

/*------------------ Map 059 ---------------------------*/
/* One more forgotten mapper */
/* Formerly, an incorrect implementation of BMC-T3H53 */
Expand All @@ -172,21 +157,6 @@ void Mapper59_Init(CartInfo *info) {
Latch_Init(info, M59Sync, M59Read, 0x0000, 0x8000, 0xFFFF, 0);
}*/

/*------------------ Map 061 ---------------------------*/
static void M61Sync(void) {
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
setprg16(0xC000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
} else
setprg32(0x8000, latche & 0xF);
setchr8(0);
setmirror(((latche >> 7) & 1) ^ 1);
}

void Mapper61_Init(CartInfo *info) {
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}

/*------------------ Map 063 ---------------------------*/
/* added 2019-5-23
* Mapper 63 NTDEC-Multicart
Expand Down Expand Up @@ -317,30 +287,6 @@ void Mapper204_Init(CartInfo *info) {
Latch_Init(info, M204Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
}

/*------------------ Map 212 ---------------------------*/

static uint8 M212Read(uint32 A) {
uint8 ret = CartBROB(A);
if ((A & 0xE010) == 0x6000)
ret |= 0x80;
return ret;
}

static void M212Sync(void) {
if (latche & 0x4000) {
setprg32(0x8000, (latche >> 1) & 3);
} else {
setprg16(0x8000, latche & 7);
setprg16(0xC000, latche & 7);
}
setchr8(latche & 7);
setmirror(((latche >> 3) & 1) ^ 1);
}

void Mapper212_Init(CartInfo *info) {
Latch_Init(info, M212Sync, M212Read, 0x0000, 0x8000, 0xFFFF, 0);
}

/*------------------ Map 213 ---------------------------*/

/* SEE MAPPER 58 */
Expand Down Expand Up @@ -823,21 +769,3 @@ static void M461Sync(void) {
void Mapper461_Init(CartInfo *info) {
Latch_Init(info, M461Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
}

/*------------------ Map 464 ---------------------------*/
static void M464Sync(void) {
int p =latche >>7;
int c =latche &0x1F;
if (latche &0x40) {
setprg32(0x8000, p >> 1);
} else {
setprg16(0x8000, p);
setprg16(0xC000, p);
}
setchr8(c);
setmirror(latche &0x20? MI_H: MI_V);
}

void Mapper464_Init(CartInfo *info) {
Latch_Init(info, M464Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
}
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/boards/eeprom_93C66.c → src/mappers/eeprom_93C66.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ uint8 eeprom_93C66_output;
#define STATE_DATA 20
#define STATE_FINISHED 99

void eeprom_93C66_init ()
void eeprom_93C66_init(void)
{
eeprom_93C66_address =0;
eeprom_93C66_state =STATE_STANDBY;
eeprom_93C66_lastCLK =0;
eeprom_93C66_writeEnabled =0;
}

uint8 eeprom_93C66_read ()
uint8 eeprom_93C66_read(void)
{
return eeprom_93C66_output;
}

void eeprom_93C66_write (uint8 CS, uint8 CLK, uint8 DAT)
void eeprom_93C66_write(uint8 CS, uint8 CLK, uint8 DAT)
{
if (!CS && eeprom_93C66_state <= STATE_ADDRESS)
eeprom_93C66_state =STATE_STANDBY;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/datalatch.c → src/mappers/hw/latch.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include "mapinc.h"
#include "../fds_apu.h"
#include "sound/fdssound.h"

static uint8 latche, latcheinit, bus_conflict;
static uint16 addrreg0, addrreg1;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/42.c → src/mappers/mapper042.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#include "mapinc.h"
#include "../fds_apu.h"
#include "sound/fdssound.h"

static uint8 preg, creg, mirr;
static uint32 IRQCount, IRQa;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions src/mappers/mapper058.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "mapinc.h"

/* forward declarations */
extern uint16 latche;
void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram);

/*------------------ Map 058 ---------------------------*/

static void M58Sync(void) {
if (latche & 0x40) {
setprg16(0x8000, latche & 7);
setprg16(0xC000, latche & 7);
} else
setprg32(0x8000, (latche >> 1) & 3);
setchr8((latche >> 3) & 7);
setmirror(((latche & 0x80) >> 7) ^ 1);
}

void Mapper58_Init(CartInfo *info) {
Latch_Init(info, M58Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}

File renamed without changes.
41 changes: 41 additions & 0 deletions src/mappers/mapper061.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "mapinc.h"

/* Forward declarations */
extern uint16 latche;
void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram);

/*------------------ Map 061 ---------------------------*/
static void M61Sync(void) {
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
setprg16(0xC000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
} else
setprg32(0x8000, latche & 0xF);
setchr8(0);
setmirror(((latche >> 7) & 1) ^ 1);
}

void Mapper61_Init(CartInfo *info) {
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/103.c → src/mappers/mapper103.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

#include "mapinc.h"
#include "../fds_apu.h"
#include "sound/fdssound.h"

static uint8 reg0, reg1, reg2;
static uint8 *WRAM = NULL;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/boards/lh32.c → src/mappers/mapper125.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

#include "mapinc.h"
#include "../fds_apu.h"
#include "sound/fdssound.h"

static uint8 reg;
static uint8 *WRAM = NULL;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 174bf56

Please sign in to comment.