News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Ogre Battle 64 name dump help  (Read 2152 times)

PRIZZA

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
    • Aeon Rivals
Ogre Battle 64 name dump help
« on: May 30, 2019, 07:20:01 pm »
I've been trying to dump certain text from Ogre Battle 64 but ran into a bit of a block. I used binwalk to extract the hundreds of lha files within the main ROM and found some ASCII strings, mostly for dialogue. I'm looking in particular for the list of names the game randomly generates for new characters and monsters that join your team.

The only name I can recall was "Pishtoff", so I searched for that string and found it buried next to a couple other strings.



However, most of the names surrounding it look like they're further compressed as there's a bunch of garbage character data. Anyone have an idea on how I can get possibly get a clean list? Any recommendations welcome. I am not sure if I can share the specific lha from the game since it technically is part of the ROM, albeit a tiny piece.


Zoinkity

  • Hero Member
  • *****
  • Posts: 562
    • View Profile
Re: Ogre Battle 64 name dump help
« Reply #1 on: July 08, 2019, 03:53:01 pm »
Sorry, don't frequent anywhere regularly.
The problem is that file (0x23C8E0C in the USA v1.1 ROM) uses a different compression format.  Ogre 64 has 4-5 of them.  Honestly though, you could have just pulled the list from runtime instead of trying to decompress it.

Full list in that file is:
Code: [Select]
Arges
Eioledes
Ion
Aegis
Eigibann
Iperos
Eiguptos
Itha
Eithacos
Itilla
Eiton
Aytonee
Augeia
Outhorne
Akkaya
Akakoth
Athcaravos
Attis
Adonis
Atropos
Analize
Annios
Apeemosh
Amperoth
Arcadia
Alkmene
Argo
Arsnoba
Antigone
Iamos
Iantey
Evis
Yeeros
Eope
Isqus
Innous
Iroth
Enferrie
Westa
Uranus
Eidothea
Euadonne
Euenoth
Eunokell
Eunomos
Euparramo
Euporupo
Erope
Aekoe
Epionne
Ekketos
Ennipeu
Epigonnoi
Erratau
Erratos
El Penoll
Erebos
Oakus
Oibaros
Ogyukos
Oxuros
Opps
Omega
Oltea
Kaukown
Caunos
Catils
Kaphus
Kampee
Camerus
Galatea
Calith
Karna
Galleo
Gigas
Guarth
Quegikos
Kiknos
Cubelley
Kirrikuth
Grauke
Karlmadan
Kranos
Kryussa
Gryps
Kreovis
Keies
Keparos
Crenate
Satyrreth
Dideux
Sarios
Cuervo
Siquonn
Shiden
Scribner
Sibule
Chumee
Schvalis
Silvanne
Cemerre
Fachu
Deimos
Tatius
Danae
Damia
Tamyrith
Taraos
Dardanos
Tantarus
Dea Shuria
Dea Deea
Diarth
Diez
Tispee
Deimakos
Teukross
Teineth
Theopane
Degeros
Tuia
Typhon
Tukei
Delkynos
Telxion
Delpui
Terepatha
Tuath
Dodonna
Kussohagey
Naucitoth
Nauteth
Niereth
Nyx
Neaira
Neiros
Knessos
Nemea
Nomios
Bakith
Bacchus
Bassacharia
Baneese
Hariara
Paris
Baroque
Pishtoff
Phethos
Hien
Pitane
Pitis
Hyppotes
Hyuzers
Pirylla
Faunn
Famese
Forshpill
Phobos
Pshkee
Ptonos
Placios
Priamos
Prixos
Preggler
Proquenee
Proklis
Proteus
Plotos
Promioth
Mana Bu
Paerenee
Phedasoth
Helios
Beros
Benadeth
Pennea
Hemithea
Peryar
Heriort
Belias
Peripanoth
Helcuna
Persace
Persephone
Berekunti
Pentesillea
Voine
Harlequin
Vonus
Hopladamos
Porukaon
Poryksaw
Porumdana
Porybos
Portusboros
Marwals
Marlth
Meiandos
Makaon
Makkariar
Menos
Misericorde
Minacau
Minneades
Minyuas
Mykenaia
Mulinne
Mylto
Musa
Mulkibell
Metiss
Megaleuth
Mestaul
Metaneira
Metope
Menestheus
Memphis
Meraneus
Merambooth
Merops
Moira
Monels
Morpeus
Morossos
Jannus
Jupiter
Yustetia
Reios
Lawerna
Lauss
Laodameia
Raodukee
Radamantis
Radine
Lattinus
Rattla
Lapitese
Rampethos
Rituelseth
Rinos
Libuke
Ribentina
Rushippe
Rykulgoth
Rukeios
Ryukopron
Lukomedes
Rynkos
Reimonee
Leuke
Reukoon
Regolio
Yamikaze
Yukikaze
Seiten
Raiden
Raiden
(Yes, Raiden is listed twice).

For those who are interested, you can decode the original file with something like this.  Fair warning though: the last time I looked at this was when the yield statement was added to python:
Code: [Select]
# Like iter(), but spits out zeroes after data expended.
def _grab(data):
    for i in data:
        yield i
    else:
        yield 0

def decodeLZ(data, output=None):
    """LZ compression.  Note this requires any previous
        output to be given to reference backpedals.
    Silly, really.  Complain to Enix.

    Returns output, appended to any you already fed it.
    Also returns True if okay, False if error occured.

    As a note, the header only specifies the decompressed size.
    Each file happens to be preceeded by a compressed size also, which isn't really part of the header.
    That's part of the archive that contains the file o.0
    """
    if not output:
        output = bytearray()
    ## Header should start with the decompressed size.
    ## That will set the endpoint.
    o = 4
    dec_s = int.from_bytes(data[0:4], byteorder='big')
    if (dec_s+4) == len(data):
        # Strip off the archive's wrapper.
        cmp_s = dec_s
        dec_s = int.from_bytes(data[4:8], byteorder='big')
        o+=4
    tot_s = len(output) + dec_s
    b = _grab(data[o:])

    ## loop through compressed file
    while len(output) < tot_s:
        cmd = next(b)
        if cmd & 0x80:
            ## 7800     len, -3
            ## 07FF     offset, -1
            l = (cmd&0x78)>>3
            o = (cmd&0x7)<<8
            o|= next(b)
            l+= 3
        elif cmd & 0x40:
            ## 3F       write len+1 bytes
            l = cmd&0x3F
            for i in range(l+1):
                output.append(next(b))
            continue
        elif cmd & 0x20:
            ## 1F       fill with len+2 zeroes
            l = cmd&0x1F
            for i in range(l+2):
                output.append(0)
            continue
        elif cmd & 0x10:
            ## 0FC000   len, -4
            ## 003FFF   offset, -1
            l = next(b)
            o = (l & 0x3F)<<8
            o|= next(b)
            l>>=2
            l&=0x30
            l|= (cmd & 0xF)
            l+= 4
        elif cmd==2:
            ## 00FF len, - 3    fill with len+3 zeroes
            l = next(b) + 3
            for i in range(l):
                output.append(0)
            continue
        elif cmd==1:
            ## 00FF len, - 3    fill with len+3 -1s
            l = next(b) + 3
            for i in range(l):
                output.append(0xFF)
            continue
        elif cmd==0:
            ## 00FF0000 len, - 5
            ## 0000FFFF offset, -1
            l = next(b) + 5
            o = next(b)<<8
            o|= next(b)
        else:
            ## not valid. This is default behaviour.
            continue
        ## for copy routines; catch index out of range
        off = len(output)-o-1
        if off<0:
            raise RuntimeError("Error: this file is reliant on additional, previously-decompressed data.")
            return output
        for i in range(l):
            output.append(output[off+i])
    return output