English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. General (https://eab.abime.net/forumdisplay.php?f=37)
-   -   Implementing PTReplay PTSongPattern (https://eab.abime.net/showthread.php?t=116688)

FlynnTheAvatar 14 January 2024 13:19

Implementing PTReplay PTSongPattern
 
Hi,

I am currently trying to implement PTSongPattern in Fredrik Wikstrom's ptreplay library for AmigaOS 4.1.

I peaked (=disassembled) the m68k version of it (6.6) and came up this this naive implementation:

Code:

UBYTE _PTReplay_PTSongPattern(struct PTReplayIFace *Self,
 struct Module *module, UWORD Pos)
{
    dbug(("ptreplay::PTSongPattern\n"));

    UBYTE* p = (UBYTE *) module->file_data;
    if (Pos <= module->file_size) {
        return p[952 + Pos];
    }

 return (UBYTE)0;
}

Sorry, I have no idea about the library or the ProTracker file format. Does this suffice, or do I need to aquire the mutex before peeing into the loaded file?

Any help would be greatly appreciated.

Thanks,
Flynn

phx 14 January 2024 14:18

Should be ok. The "song arrangement list" with all pattern-numbers is indeed at offset 952. Those are constants which should never change, so you can read them any time.

Although there is a maximum of 128 positions, so I would better check
Pos
against 128 instead of the module's file size.

FlynnTheAvatar 14 January 2024 15:24

Thank you very much. The information that there are max 128 positions is really helpful. I updated the code with your suggestion and I am testing the new library at the moment.


All times are GMT +2. The time now is 17:28.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04224 seconds with 11 queries