Jump to content
Tuts 4 You

NSF player DLL for NES music files.


mudlord

Recommended Posts

Here is a DLL I have been working on. I intended this for my keygens and patchers,

but figured I make it public.

Calling conventions are _cdecl, iirc.

Included is a example in C.

Basically, this is a Nintendo Entertainment system music playback dll, for NSF/NSFE files.Due to the emulator used, the file size is quite big, but UPX does help somewhat.

The emulator emulates all extension chips used for NES audio, including Sunsoft's expansion chips, as well as the VRC6/7 and Namco N-106 chips.

EDIT:

Also did a SNES SPC-700 emulator DLL.

Same parameters as the NSF dll, same calling convention. Uses a much more accurate (cycle-exact) emulator then the dll "SNESAPU.DLL" thats floating around....Plays back SPC files only.

Edited by mudlord
Link to comment

I liked the music in game one of my collection but I had no tools to rip it, I've tried looking on google but I did not find, how to rip music from *. nes or *. bin? ... maybe you can help me. thx b4.

Link to comment

Ripping music from NES games is complex.

You need knowledge of 2a03 assembly language to create the rips.

To ease things, some collections of NSF files are here:
/>http://www.zophar.net/music/nsf.html
/>http://2a03.free.fr/
/>http://midr2.under.jp/compo/top.html

snesmusic.org has plenty of soundtracks from SNES games, including Killer Instinct, Donkey Kong Country 2, etc. Because the SPC files contain a capture of SPC700 APU RAM, they all are 64KB, making them suitable for small patchers/keygens. The RSN files on snesmusic.org are just renamed RARs, so it should be no problem getting the files you need.

Link to comment

Those files should play back fine. If you are suggesting ZIP reading to be added, thats not gonna happen at all.

Started work on a BASS.DLL based player DLL too, some reason BASS_Init fails, not sure why.

Edited by mudlord
Link to comment

Hi Mudlord, I want the intro of the game Chiptune San Guo Zhi - Ying Jie Zhan (Chinese Version), I've search on google but I only met her a while there are some Chiptunes of the game, can you help me? thank you! ...cowboy.gif

Edited by Ondskapen
Link to comment

hi,

any news about mp3/mid support plugin?

I already got the code in the SVN for the MP3/OGG plugin, just needs to be bugfixed.

MIDI support will get done when I feel like, or when I find a need to include it somewhere into my stuff.

Link to comment

hi, the dll is very good :) i used the dll for a delphi program and is very good :) i used the code:

to declare the functions:

function DLL_Play(HWND:hwnd;Data:Pointer;len,subsong:integer): byte; cdecl; external 'nsf_player.dll';

function DLL_Stop(): byte; cdecl; external 'nsf_player.dll';

to load the file:

var

FileBuffer:file;

MusicFileBuffer:array of byte;

//load the nsf file

AssignFile(FileBuffer,'Castlevania.nsf');

ReSet(FileBuffer,1);

SetLength(MusicFileBuffer,FileSize(FileBuffer));

BlockRead(FileBuffer,MusicFileBuffer[0],FileSize(FileBuffer));

CloseFile(FileBuffer);

to play the music:

//the first argument is the handle of the window

DLL_Play(Form1.Handle,@MusicFileBuffer[0],Length(MusicFileBuffer),0);

to stop the music:

DLL_Stop();

Link to comment

also i was trying to use the dll in Game Maker, a program made in Delphi. Game Maker uses

two type of data, double and string. It doesnt use pointers, so it was not possible to use the dll

because i can't use the pointer to the music buffer. Do you think it's possible to make a dll

that can use a string data type for the buffer?

also i wanted to ask if it's possible to load more nsf file, so the game can use sound

and music :)

Link to comment

hi, yes load the nsf file is also good.

Thanks for the help :)

in game maker i was using:

//open file

nsf_file=file_bin_open('Castlevania.nsf',0)

nsf_filesize=file_bin_size(nsf_file)

//the string nsf_filebuffer has the data of the file

nsf_filebuffer=''

a=0

while a<nsf_filesize {

nsf_filebuffer=nsf_filebuffer+chr(file_bin_read_byte(nsf_file))

a=a+1

}

file_bin_close(nsf_file)

call the dll function, the second argument is the string with the data of the file, but the code

doesnt work because the argument of the dll is a pointer, not a string. I hope it's clear.

external_call(DLLPlayCall,window_handle(),nsf_filebuffer,nsf_filesize,0)

Link to comment
  • 3 months later...

Got a odd error with the MP3 plugin when linking to the most recent SDK, other plugins work.

http://www.sendspace.com/file/o3qfzo

05UnZ.jpg

seems you are using the old PDK. the new one tries to load dup2patcher.dll instead of dup2patcher.exe. thats the reason why the old plugins must be recompiled with the new PDK to get them work in v2.26.

be sure you are using the latest dup2patcher.lib when building your plugin.

Edited by diablo2oo2
Link to comment

Oh weird...will retry :S

I was using the libs from the "c" directory of your archive. I take it they weren't updated?

Edited by mudlord
Link to comment

i have another advice: add option called "loop x time(s)", some times user maybe only play 1 time, 2 times... or forever...

regards

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...