Skip to content

Commit

Permalink
Added the possibility to set default values for PPU overclocking to b…
Browse files Browse the repository at this point in the history
…e applied for all roms in addition to the per-game ones already used (#326).
  • Loading branch information
punesemu committed Jan 11, 2024
1 parent 795927b commit aa4085b
Show file tree
Hide file tree
Showing 17 changed files with 665 additions and 241 deletions.
6 changes: 4 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ Changelog:
- Rewritten mappers : All.
- Rewritten WRAM, VRAM, PRGROM, CHROM and Nametebles management.
- Rewritten FDS support.
Furthermore, an option has been added to select the mode for write operations. Until now, all writes were stored on an external file (to preserve the integrity of the disk image), now it's possible to choose to write them directly to the FDS/QD file (making it portable to other emulators as well).
* Furthermore, an option has been added to select the mode for write operations. Until now, all writes were stored on an external file (diff file) to preserve the integrity of the disk image, now it's possible to choose to write them directly to the FDS/QD file (making it portable to other emulators as well).
* Changed the format of the diff file, now I use the IPS format (which can always be applied to the original image).
- Rewritten the format and management of save states.
WARNING save states of version 0.110 or earlier are no longer compatible.
- Added support to Quick Disk format.
- Added an option for RAM initialization (#276).
It's possible to choose between three values:
* 0x00
* 0xFF (default)
* Randomize.
* Randomize
- Added the possibility to set default values for PPU overclocking to be applied for all roms in addition to the per-game ones already used.
- Added Arabic translation (thx to Chipsum).
- Added Polish translation (thx to elektronicznypank).
- Added full support for the NES 2.0 header format.
Expand Down
1 change: 1 addition & 0 deletions src/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum exit_type { EXIT_OK, EXIT_ERROR };
enum lower_value { LOWER, UPPER };
enum machine_mode { AUTO, NTSC, PAL, DENDY, DEFAULT = 255 };
enum initial_ram_value_type { IRV_0X00, IRV_0XFF, IRV_RANDOM };
enum overcan_type { PERGAME_OFF, PERGAME_ON, PERGAME_DEFAULT };
enum console_type {
REGULAR_NES,
VS_SYSTEM,
Expand Down
18 changes: 14 additions & 4 deletions src/core/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#include "apu.h"
#include "input.h"

typedef struct _config_overclock {
BYTE enabled;
BYTE dmc_control_disabled;
struct config_overclock_extra_slines {
WORD vblank;
WORD postrender;
} extra_slines;
} _config_overclock;
typedef struct _last_geometry {
int x, y;
int w, h;
Expand Down Expand Up @@ -85,11 +93,7 @@ typedef struct _config {
BYTE bck_pause;
WORD language;
int dipswitch;
BYTE ppu_overclock;
BYTE ppu_overclock_dmc_control_disabled;
BYTE ppu_alignment;
WORD extra_vb_scanlines;
WORD extra_pr_scanlines;
BYTE save_battery_ram_file;
BYTE multiple_instances;
BYTE nsf_player_effect;
Expand All @@ -104,6 +108,12 @@ typedef struct _config {

_config_input input;
_config_apu apu;
_config_overclock *oclock;

struct _config_overclock_all {
_config_overclock def;
_config_overclock pergame;
} oclock_all;
#if defined (WITH_FFMPEG)
struct _config_recording {
BYTE last_type;
Expand Down
6 changes: 3 additions & 3 deletions src/core/cpu_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
r4011.cycles = r4011.frames = 0;
r4011.value = value;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = TRUE;
nes[nidx].p.ppu_sclines.total = machine.total_lines;
nes[nidx].p.ppu_sclines.vint = machine.vint_lines;
Expand All @@ -1529,7 +1529,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
if (address == 0x4012) {
DMC.address_start = (value << 6) | 0xC000;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = FALSE;
ppu_overclock_update()
ppu_overclock_control()
Expand All @@ -1540,7 +1540,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
/* sample length */
DMC.length = (value << 4) | 0x01;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = FALSE;
ppu_overclock_update()
ppu_overclock_control()
Expand Down
2 changes: 0 additions & 2 deletions src/core/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,6 @@ BYTE emu_turn_on(void) {
info.lag_frame.totals = 0;
info.lag_frame.consecutive = 0;

cfg->extra_vb_scanlines = cfg->extra_pr_scanlines = 0;

vs_system.watchdog.next = vs_system_wd_next()

info.r2002_jump_first_vblank = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions src/core/mappers/MMC1.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ void wram_swap_MMC1_base(WORD address, WORD value) {
// older boards with older MMC1's, while the R bit was only introduced later. But because the E bit wasn't
// confirmed by the homebrew community until October 2010[4], emulators tend not to implement it.
//
// !!!! : Se Lascio questo controllo attivo "Witch n' Wiz (World) (Digital Release) (Aftermarket) (Unl).nes" ha le
// schermate sporche dopo la selezione dello slot di salvataggio
// !!!! : Se Lascio questo controllo attivo "Witch n' Wiz (World) (Digital Release) (Aftermarket) (Unl).nes" ha le
// schermate sporche dopo la selezione dello slot di salvataggio
// const BYTE wram_enabled = mmc1tmp.type == MMC1B
// ? (info.mapper.submapper == 0
// ? (mmc1.reg[3] | (mmc1.reg[1] | mmc1.reg[2])) & 0x10 ? FALSE : TRUE
Expand Down
6 changes: 3 additions & 3 deletions src/core/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,9 +1086,9 @@ void ppu_overclock(BYTE nidx, BYTE reset_dmc_in_use) {
nes[nidx].p.overclock.sclines.vb = 0;
nes[nidx].p.overclock.sclines.pr = 0;

if (cfg->ppu_overclock) {
nes[nidx].p.overclock.sclines.vb = cfg->extra_vb_scanlines;
nes[nidx].p.overclock.sclines.pr = cfg->extra_pr_scanlines;
if (cfg->oclock && (cfg->oclock->enabled == PERGAME_ON)) {
nes[nidx].p.overclock.sclines.vb = cfg->oclock->extra_slines.vblank;
nes[nidx].p.overclock.sclines.pr = cfg->oclock->extra_slines.postrender;
}

nes[nidx].p.overclock.sclines.total = nes[nidx].p.overclock.sclines.vb + nes[nidx].p.overclock.sclines.pr;
Expand Down
Loading

0 comments on commit aa4085b

Please sign in to comment.