Code Monkey home page Code Monkey logo

snsfopt's Introduction

snsfopt

Travis Build Status AppVeyor Build Status

SNSF set optimizer / timer, derived from snsf9x and gsfopt.

All ripped sets should be optimized before release, to remove unused code/data unrelated to music playback.

Downloads

Usage

Syntax: snsfopt [options] [-s or -l or -f or -r or -x or -t] [snsf files]

Options

-T [time] : Runs the emulation till no new data has been found for [time] specified. Time is specified in mm:ss.nnn format
mm = minutes, ss = seoconds, nnn = milliseconds

-p [bytes] (default=1) : I am paranoid, and wish to assume that any data within [bytes] bytes between two used bytes, is also used

-P [bytes] (default=0) : I am paranoid, and wish to assume that any trailing data within [bytes] bytes of a used byte, is also used

-cs : Correct header checksum before writing a ROM/SNSF.

--offset [load offset] : Load offset of the base snsflib file. (The option works only if the input is SNES ROM file)

File Processing Modes

-f [snsf files] : Optimize single files, and in the process, convert minisnsfs/snsflibs to single snsf files

-l [snsf files] : Optimize the snsflib using passed snsf files.

-r [snsf files] : Convert to Rom files, no optimization

-x [snsf files] : Convert to SPC files

-s [snsflib] [Hex offset] [Count] : Optimize snsflib using a known offset/count

-t [options] [snsf files] : Times the SNSF files. (for auto tagging, use the -T option) Unlike psf playback, silence detection is MANDATORY Do NOT try to evade this with an excessively long silence detect time. (The max time is less than 2*Verify loops for silence detection)

Options for -t

-V [time] : Length of verify loops at end point. (Default 20 seconds)

-L [count] : Number of loops to time for. (Default 2, max 255)

-T : Tag the songs with found time. A Fade is also added if the song is not detected to be one shot.

-F [time] : Length of looping song fade. (default 10.000)

-f [time] : Length of one shot song postgap. (default 1.000)

-s [time] : Time in seconds for silence detection (default 15 seconds) Max (2*Verify loop count) seconds.

Options for -x

-d : Delayed SPC capture, delay-time can be specified by -T

snsfopt's People

Contributors

loveemu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cartoonfan

snsfopt's Issues

Broken SPC export likely due to incomplete initialization

When exporting a large number of SNSF files to an SPC file, as in snsfopt -x *.minisnsf, it may produce different results than running the command one by one in a separate process. I experienced that during the creation of the SNSF for Shin Megami Tensei II.

Data in snsflib could get slightly erased wrongly sometimes

Summary

This is a bug which is originally found in gsfopt. However, unlike GBA, it should be considered as a very rare case that the glitch actually erases necessary ROM content, because SNES hardware reads ROM data once and transfer it to audio RAM.

Snsfopt is possible to write wrong value to ROM coverage in snsflib optimization (mode -l for instance). Theoretically it might wipe the ROM data quite slightly without being noticed.

How to fix : If you worry about snsflibs that you have optimized by old snsfopt, redo the snsflib optimization with unoptimized ROM, then replace your snsflib to new one.

Occurrence condition

The mechanism of the glitch is simple. It's too stupid.

u8 * rom_coverage;
u8 * another_rom_coverage;

for (u32 offset = 0; offset < size; offset++) {
    if (rom_coverage[offset] + another_rom_coverage[offset] <= 0xff) {
        rom_coverage[offset] += another_rom_coverage[offset];
    } else {
        rom_coverage[offset] += 0xff; // wait, why += is placed here
    }
}

In words: the glitch occurs when the song A refers to a certain address once, and another song B refers to the same address at least 255 times.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.