Author Topic: Modifying spellcards  (Read 12916 times)

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Modifying spellcards
« on: August 14, 2009, 01:32:10 AM »
Is there a way to modify and customize spellcards for PCB - StB in a similar way to Danmakufu?
I Looked into the DAT archive using the Brightmoon utility, I think that the data for spellcard patterns is in the .ecl files, but I'm not sure. In any case, I don't know how to modify it because they won't open up like .txt files, they come out as gibberish.

Is there a utility or program I can use to convert them to .txt and back (or some other format where I can edit them), and if so can anyone give me the link and instructions?
« Last Edit: August 14, 2009, 02:17:15 AM by Fujiwara no Mokou »

Drake

  • *
Re: Modifying spellcards
« Reply #1 on: August 14, 2009, 05:38:57 AM »
If there was don't you think there would be full games out already?

I mean, texture editing, sound editing, bgm editing, msg editing and bullet pattern editing? That's pretty much the entire game itself. There would be ZUN games firing out like roman candles.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Modifying spellcards
« Reply #2 on: August 14, 2009, 06:58:35 AM »
I suppose there isn't?

I guess I'll have to pay a programmer to make one out for me.  Thanks anyway.

Re: Modifying spellcards
« Reply #3 on: August 15, 2009, 07:22:41 PM »
I'm working on this for the MoF?UFO ECL format, but it needs more work.

I found this[1] today which helped solve a big mystery (floating-point values), with that there's only two obstacles left to figuring out what everything does.

[1] http://www1.axfc.net/uploader/Sc/so/19176&key=eclreader (I think it's for EoSD.)
« Last Edit: August 15, 2009, 07:26:02 PM by dzzlA1HJ »

Alice Fact

  • Kingdom Hearts
  • let's play shintopuncher
Re: Modifying spellcards
« Reply #4 on: August 16, 2009, 10:41:17 AM »
uh, you can turn words into links by doing

Code: [Select]
[url=http://www1.axfc.net/uploader/Sc/so/19176&key=eclreader]this[/url]
Regarding score threads: For the time being, I'm not going to be online much; I would suggest that you simply do as you normally do, because I will come back and I will want those threads when I do.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Modifying spellcards
« Reply #5 on: September 06, 2009, 04:39:50 AM »
I'm working on this for the MoF?UFO ECL format, but it needs more work.

I found this[1] today which helped solve a big mystery (floating-point values), with that there's only two obstacles left to figuring out what everything does.

[1] http://www1.axfc.net/uploader/Sc/so/19176&key=eclreader (I think it's for EoSD.)

Thanks.
Can you let me know when you get those two obstacles?

Re: Modifying spellcards
« Reply #6 on: September 06, 2009, 09:23:25 AM »
Can you let me know when you get those two obstacles?

I have managed to figure out an important part of the first one, and a little of the other (perhaps enough).  I also managed to figure out relative jumps which makes it much easier to copy and paste things.  A release at this state might be a good idea since it should be possible to figure out what most of the actual script commands do now.  But before that I have to make the user interface a little friendlier, and I will have to finish up the documentation.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Modifying spellcards
« Reply #7 on: September 06, 2009, 09:56:18 PM »
Thanks.
Well, take your time. Please let me know how to use it when you're done, and thanks again.

Drake

  • *
Re: Modifying spellcards
« Reply #8 on: September 06, 2009, 11:07:58 PM »
Hey now, don't think you're going anywhere without giving me a piece of the action.

I'd like to know how to managed to de/recompile the format, too. I mean, with this, people can pretty much create entire games based on either MoF, SA or UFO's engine (more than likely SA), if what I'm thinking is right.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Modifying spellcards
« Reply #9 on: September 07, 2009, 10:07:50 AM »
I'd like to know how to managed to de/recompile the format, too. I mean, with this, people can pretty much create entire games based on either MoF, SA or UFO's engine (more than likely SA), if what I'm thinking is right.

Someone released a small tool along with a specification adequate for further hacking.  As far as I can tell it was in the "Touhou 11 english project?" topic by "Mr_Alert".

The SHT and STD files will have to be figured out or any modifications will not be very interesting.

Re: Modifying spellcards
« Reply #10 on: September 20, 2009, 04:55:48 PM »
Initial release. Files [1] and documentation [2] are available.

[1] http://code.google.com/p/thtk/downloads/list
[2] http://code.google.com/p/thtk/w/list

The script format is not documented, but most of it should be easy to figure out. The parts that might not be as obvious are:
1. C-style comments are available for documentation purposes: /* ... */
2. +LH specifies that an instruction is only executed at the Lunatic and Hard ranks. Default is all ranks.
3. Numbers within square brackets. I believe positive numbers are used for local variables, with 0 being the first variable, 4 the second, and so on. Instruction 40 appears to set up the space for local variables. Negative numbers might be used for global variables, I know -9945 is used to choose which spell cards to serve on stage 4 of SA.
4. The anim and ecli things include animation files and other script files.
5. Labels without letters are timestamps (60:), the time upon entering a subroutine is 0, and it increases by 1 every frame. Execution will not proceed past a label until the current time is equal or greater.

The script format is designed to make it easy to parse, it doesn't require newlines or spaces (except where necessary). The format is going to change as more instructions are figured out. My next efforts will be focused on the arithmetic parts as they probably help the most.

For extracting ECL files, try Brightmoon, and for repacking them, datpacker.

Drake

  • *
Re: Modifying spellcards
« Reply #11 on: September 20, 2009, 06:50:38 PM »
Wait, xarnonymous? Oh, hahaha. I consulted you to figure out how to use some tools. Thanks once again for that. This is my thread; what came of our discussions.

EDIT: this looks amazing holy youkai jesus

EDIT: Hrm. After looking through the reference sheets and such, I can see that if you want a major change it might take a while, but I can see how it may be done. I can use the dumping program fine, and if I recompile the ecl without making any changes it works, but if I change a value, say, dropping a point item instead of a power item, or changing the name of a spellcard, it gives me a dead file.

EDIT: Aha, found the first problem. When referring to spellcard names, it parses the two quotation marks as one string, then goes through "code", then another string. This screws it up.

EDIT: YEAAAAHH



Quote
Horror "Well-bucket-dropping Monster" -> Horror Well-bucket-dropping-Monster
« Last Edit: September 20, 2009, 07:11:23 PM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Modifying spellcards
« Reply #12 on: September 20, 2009, 07:23:33 PM »
EDIT: Hrm. After looking through the reference sheets and such, I can see that if you want a major change it might take a while, but I can see how it may be done. I can use the dumping program fine, and if I recompile the ecl without making any changes it works, but if I change a value, say, dropping a point item instead of a power item, or changing the name of a spellcard, it gives me a dead file.

Dead in what way?  That list of items might not tell the whole story, some enemies can drop several items at once, and I have no idea how it's done.

Drake

  • *
Re: Modifying spellcards
« Reply #13 on: September 20, 2009, 07:32:28 PM »
I fixed it. The reason is the parser interprets the quotation marks in certain spellcards as a string in itself. So I supposed if it's written like C, you would need the \" escape sequences. Instead of this,
Code: [Select]
359 +HL 8 2400 500000 C"Miasma "Unexplained Fever"";You will have to edit it to this.
Code: [Select]
359 +HL 8 2400 500000 C"Miasma \"Unexplained Fever\"";example

This works, but certain characters such as hyphens don't work because the hyphen is interpreted as code and malfunctions. This is why some gave me a broken file. (As in, 0 bytes)

I'll test. Nope, illegal. Gotta try something else. %22 gives a null character.
« Last Edit: September 20, 2009, 07:45:29 PM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Modifying spellcards
« Reply #14 on: September 20, 2009, 07:48:03 PM »
I fixed it. The reason is the parser interprets the quotation marks in certain spellcards as a string in itself. So I supposed if it's written like C, you would need the \" escape sequences. Instead of this,
Code: [Select]
359 +HL 8 2400 500000 C"Miasma "Unexplained Fever"";You will have to edit it to this.
Code: [Select]
359 +HL 8 2400 500000 C"Miasma \"Unexplained Fever\"";example

This works, but certain characters such as hyphens don't work because the hyphen is interpreted as code and malfunctions. This is why some gave me a broken file. (As in, 0 bytes)

I'll test. Nope, illegal. Gotta try something else.

Quote escaping hasn't been implemented yet, so there's no way to put regular double quotes in the names. (It's even documented ;)) Any other character (except newline, and probably carriage return) should work, there are many other types of quotes available.

Drake

  • *
Re: Modifying spellcards
« Reply #15 on: September 20, 2009, 08:14:02 PM »
« Last Edit: September 20, 2009, 08:38:08 PM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Modifying spellcards
« Reply #16 on: September 26, 2009, 01:54:39 AM »
Wow, this is really good.
But is there one that works for the previous games? Or are 10, 11, and 12 the only ones we can ever modify?

Re: Modifying spellcards
« Reply #17 on: September 26, 2009, 07:44:31 AM »
Wow, this is really good.
But is there one that works for the previous games? Or are 10, 11, and 12 the only ones we can ever modify?

As long as someone figures out the file formats it shouldn't be that hard. The other games probably have a lot in common.

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Modifying spellcards
« Reply #18 on: October 06, 2009, 02:16:19 AM »
I DONT UNDERSTAND HOW TO USE THIS

;-;
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Modifying spellcards
« Reply #19 on: August 18, 2010, 12:03:31 PM »
New release.  This time along with two other tools (merged from various programs).

thanm (merged from anmtopng and thinspng):
* Can extract image data.
* Can reinsert modified image data.
* Allows the same for the animation scripts.
* Should support any Touhou game with ANM files.

thdat (datpacker with extraction)
* Can extract game archives.
* Can create game archives.
* Supports any Touhou game except the fighters (IaMP has creation support).

thecl (merged from ecldump and eclc):
* Can convert scripts to a more human-readable format.
* Can convert edited scripts back.
* Supports MoF, SA, UFO, DS, FW.

New features since last releases:
* thanm: Editing of non-image data.
* thdat: Extraction, some support for TH3-5.
* thecl: Support for the new games, probably some changes to the syntax.

http://code.google.com/p/thtk/

Re: Modifying spellcards
« Reply #20 on: August 24, 2010, 09:44:26 PM »
New release.  This time along with two other tools (merged from various programs).

thanm (merged from anmtopng and thinspng):
* Can extract image data.
* Can reinsert modified image data.
* Allows the same for the animation scripts.
* Should support any Touhou game with ANM files.

thdat (datpacker with extraction)
* Can extract game archives.
* Can create game archives.
* Supports any Touhou game except the fighters (IaMP has creation support).

thecl (merged from ecldump and eclc):
* Can convert scripts to a more human-readable format.
* Can convert edited scripts back.
* Supports MoF, SA, UFO, DS, FW.

New features since last releases:
* thanm: Editing of non-image data.
* thdat: Extraction, some support for TH3-5.
* thecl: Support for the new games, probably some changes to the syntax.

http://code.google.com/p/thtk/
Tried thanm and got an error, saying I don't have libpng14.dll on my comp.
Is it supposed to run on windows 7? ;x

led

Re: Modifying spellcards
« Reply #21 on: August 25, 2010, 10:07:53 AM »
Tried thanm and got an error, saying I don't have libpng14.dll on my comp.
Is it supposed to run on windows 7? ;x

Was it ran directly from the archive? Try to unzip/extract with libpng14.dll in the same folder.

Re: Modifying spellcards
« Reply #22 on: August 25, 2010, 03:51:16 PM »
Was it ran directly from the archive? Try to unzip/extract with libpng14.dll in the same folder.
For some reason, winrar didn't extract the DLL. When i checked the archive later i found it in there ;P
Thanks anyways.

Re: Modifying spellcards
« Reply #23 on: October 07, 2010, 05:14:33 PM »
Here's the second release of thtk.

Quote from: NEWS
* thdat: A bug which made compression for TH07 fail has been
  fixed.
* thdat: Extraction can now use parallel execution.
* thdat: Compression efficiency has been improved beyond
  that of the official archives.
* thdat: Compression times have been reduced by about 40%.
* thecl: The version option must now be specified for
  compilation and dumping.
* thecl: The syntax for the difficulty mask has been changed.
* thecl: Parse stack-based expressions for games other than
  TH10.
* thecl: New type-specific operators have been added which
  take values of any kind and give back a value of the kind
  specified by the operator.  $+ is an addition returning an
  integer value, while %+ is an addition returning a
  floating-point value.  In case the generic operator is
  used (+), the return value depends on the value passed to
  it:  If both are integer, the return value is integer as
  well, if any is floating, the return value is floating.
* thecl: Expressions can now be used as parameters to
  instructions.  These expressions must be contained within
  $() or %(), and are replaced by [-1] or [-1.0f]
  respectively.  The actual expression is output before the
  instruction it is passed to.
* thecl: Variables are supported, these are defined in the
  argument list of a function, or in the body by a var
  statement.  When using the variables, they must be
  prefixed by $ or % in order to know which type is being
  requested.  The dumper attempts to figure out the arity of
  functions, and gives variables automatic names.

This time thanm is linked statically against libpng and zlib so no extra DLLs are required.

Results for compression (version, archive name, compressed size, original archive size, ratio) (results will vary if multithreaded operation is used):

Quote
2 (東方封魔.録): 718943 / 718943 (1.0000)
3 (夢時空1.DAT): 1467184 / 1467184 (1.0000)
3 (夢時空2.DAT): 583719 / 583719 (1.0000)
4 (幻想郷ED.DAT): 1120284 / 1120284 (1.0000)
4 (東方幻想.郷): 1053177 / 1053177 (1.0000)
5 (MUSIC.DAT): 610437 / 610437 (1.0000)
5 (怪綺談1.DAT): 1005627 / 1005627 (1.0000)
5 (怪綺談1.DAT.1.01): 1005679 / 1005679 (1.0000)
5 (怪綺談2.DAT): 1134696 / 1134696 (1.0000)
6 (紅魔郷CM.DAT.0.13): 932676 / 932882 (.9997)
6 (紅魔郷CM.DAT.1.00): 941318 / 941530 (.9997)
6 (紅魔郷CM.DAT.1.02f): 935063 / 935275 (.9997)
6 (紅魔郷ED.DAT.1.00): 2017599 / 2017777 (.9999)
6 (紅魔郷ED.DAT.1.02f): 2017599 / 2017777 (.9999)
6 (紅魔郷IN.DAT.0.13): 759868 / 760223 (.9995)
6 (紅魔郷IN.DAT.1.00): 759868 / 760223 (.9995)
6 (紅魔郷IN.DAT.1.02f): 759868 / 760223 (.9995)
6 (紅魔郷MD.DAT.0.13): 125311 / 125366 (.9995)
6 (紅魔郷MD.DAT.1.00): 305803 / 306003 (.9993)
6 (紅魔郷MD.DAT.1.02f): 305803 / 306003 (.9993)
6 (紅魔郷ST.DAT.0.13): 705160 / 705453 (.9995)
6 (紅魔郷ST.DAT.1.00): 2963740 / 2964464 (.9997)
6 (紅魔郷ST.DAT.1.02f): 2963734 / 2964458 (.9997)
6 (紅魔郷TL.DAT.0.13): 1045017 / 1045398 (.9996)
6 (紅魔郷TL.DAT.1.00): 1036903 / 1037281 (.9996)
6 (紅魔郷TL.DAT.1.02f): 1040327 / 1040706 (.9996)
7 (th07.dat.1.00): 23828146 / 23828393 (.9999)
7 (th07.dat.1.00a): 23828658 / 23828905 (.9999)
7 (th07.dat.1.00b): 23828888 / 23829135 (.9999)
7 (th07tr.dat.0.11): 9126013 / 9126103 (.9999)
8 (th08.dat.1.00): 46837684 / 46838629 (.9999)
8 (th08.dat.1.00a): 46836951 / 46837896 (.9999)
8 (th08.dat.1.00c): 46837009 / 46837958 (.9999)
8 (th08.dat.1.00d): 46837079 / 46838025 (.9999)
8 (th08tr.dat.0.02): 19433617 / 19433922 (.9999)
8 (th08tr.dat.0.03): 19000247 / 19000530 (.9999)
9 (th09.dat.1.00): 88176661 / 88179471 (.9999)
9 (th09tr.dat.0.02a): 28490737 / 28491198 (.9999)
10 (th10.dat.1.00a): 27685987 / 27696219 (.9996)
10 (th10tr.dat.0.01a): 11592856 / 11602587 (.9991)
10 (th10tr.dat.0.02a): 11550688 / 11560451 (.9991)
11 (th11.dat.1.00a): 26600553 / 26610794 (.9996)
11 (th11tr.dat.0.01a): 10597092 / 10606886 (.9990)
11 (th11tr.dat.0.02a): 10597136 / 10606929 (.9990)
12 (th12.100a.dat): 31305828 / 31320303 (.9995)
12 (th12.dat): 31305772 / 31320247 (.9995)
12 (th12tr.dat.0.02a): 14474995 / 14488857 (.9990)
95 (th095.dat.1.00a): 17949854 / 17953645 (.9997)
95 (th095.dat.1.01a): 17956131 / 17959921 (.9997)
95 (th095.dat.1.01b): 17956142 / 17959933 (.9997)
95 (th095.dat.1.01c): 17956166 / 17959956 (.9997)
95 (th095.dat.1.02a): 17956813 / 17960600 (.9997)
125 (th125.dat.1.00a): 30205473 / 30222346 (.9994)
128 (th128.dat.1.00a): 32318047 / 32336111 (.9994)

The next release might have ECL support for the earlier games. A MSG tool is planned.

http://code.google.com/p/thtk/

Drake

  • *
Re: Modifying spellcards
« Reply #24 on: October 07, 2010, 05:37:16 PM »
My god you are amazing. That list of updates is friggin astounding, and people have been wanting a universal msg editor for a long time. Keep up the great work.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Modifying spellcards
« Reply #25 on: October 29, 2010, 03:22:03 PM »
can someone post one example of the code to use the thecl? Im stuck with that, i cant get how i need to put the words to make it work.