Jump to content
Tuts 4 You

NSF player DLL for NES music files.


mudlord

Recommended Posts

Posted (edited)

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
Posted

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.

Posted

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.

Posted

I have asm compiler but infected virus. thx 4 da info.

Posted

your best bet is just to look around for nsf files, etc...

Posted

i think without dll,

OST NES :
/>http://nsf.joshw.info/zzz_unlicensed

Posted (edited)

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
Posted (edited)

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
Posted

hi,

any news about mp3/mid support plugin?

Posted

@rxzcums

try fl studio n Asio for all n woolyss.com

Posted

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.

Posted

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();

Posted

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 :)

Posted

Oh you want a function to load by filename instead of memory location?

Posted

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)

Posted

ah, so you want something like play(char []data, int size)?

Posted

hi mudlord, yes if the argument is a string it's very good :)

Posted

k, will put it on my todo list. :)

  • 3 months later...
Posted

Updated plugins to new DUP2 API.

Posted (edited)

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
Posted (edited)

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
Posted

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

regards

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...