Jump to content


Photo

Feature Request: READ/WRITE_ARBITRARY


  • Please log in to reply
4 replies to this topic

#1 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 21 April 2004 - 09:15 AM

There have been times when I'm trying to read more than a few bytes and I would love to have a READ/WRITE function than can take more than the standard 1, 2, or 4 bytes (BYTE, SHORT and LONG respectively). What I would like are functions that can read/write an arbitrary number of bytes. They would be the same as READ/WRITE_BYTE, except with an extra argument to designate the number of bytes read/written. I propose:

READ_ARBITRARY numberofbytes offset "variable"
WRITE_ARBITRARY numberofbytes offset value

I.e if I wanted to read 16 bytes at 0x06 into the variable "info", then

READ_ARBITRARY 16 0x06 "info"

Or if I wanted to write 5 bytes at 0xA2

WRITE_ARBITRARY 5 0xA2 0x6400A4CC90

These functions can already be accomplished by using a series of READ/WRITEs at consecutive offsets, but these functions would make coding much easier.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#2 -Ding0-

-Ding0-
  • Guest

Posted 21 April 2004 - 09:38 AM

One of the requests I've seen around is the ability to append BAM sequences to mapicons.bam. Now, if WRITE_ARBITRARY could take a file as a parameter, that would probably make this a lot easier, since you can write the contents of a file to a BAM. Am I making any sense to anyone?

#3 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 23 April 2004 - 10:42 AM

Wes would have to write up a BAM decompression function as well though, since a lot of the BAMs are compressed using the BAMC format.
Check out BG1Tutu.

#4 weimer

weimer
  • Member
  • 1569 posts

Posted 24 April 2004 - 03:24 PM

Because of issues that are elided in your post (like byte-ordering and parsing huge decimal values), if I were to do this it would be like this:

Add a command to read the contents of a file into a variable.

Add a command to write the contents of a variable into the file you are currently patching at the specified offset with no trailing 0. (Like WRITE_EVALUATED_ASCII, but with no 8-byte limit).

Would you still want such things?

#5 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 27 April 2004 - 02:21 PM

Could you be persuaded about adding complete BAM frames?
Avenger