ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Thu Mar 23, 2017 12:23 am

All times are UTC




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Fri Mar 13, 2015 4:10 am 
User avatar

Joined: Sat Dec 13, 2014 1:01 am
Posts: 161
Over time I've made various programs to convert certain graphics formats into a usable form (i.e. PNG). The two most recent examples were for GXT and PNGB/TGAB. I've noticed that it's become a bit tedious, since the majority of the code is similar and I have to recompile every time I change anything. I used to do this with archives as well, but since I started using QuickBMS a while ago it's made it much quicker and easier to extract them (and sharing the script is also easier). So I thought, "why not have a program like QuickBMS but for converting graphics?"

Therefore I am considering making something like this. That way you can make converters for complex graphic files which graphics viewers such as TiledGGD cannot handle easily (or at all). This would be especially useful for formats that may have images displayed in chunks.

An example script may be something like this:
Code:
get SIZE long
get WIDTH short
get HEIGHT short
savepos OFFSET

setformat ARGB32 #this means the pixel data is read as 32-bit ARGB
readpxls IMG OFFSET SIZE WIDTH HEIGHT #stores the image data into an object called IMG
save IMG "myImg.png"

This is just a simple example of how the scripts might work, you can probably figure out what it would do. I would allow custom pixel formats, but there would be presets for common formats like ARGB32. You could do additional things to IMG before saving such as flipping or combining with other images to form a bigger image (I have seen some formats that store images in parts). However as you can see things like reading numbers would be similar to QuickBMS, this would make it relatively easy to learn for people who already use QuickBMS.

I just want to know, do you guys think this is a good idea, and would you find it useful? I think it's good and I would personally use it but it would be nice to have some input and opinions. Suggestions are also welcome :)


Top
   
PostPosted: Fri Mar 13, 2015 4:37 am 

Joined: Mon Sep 22, 2014 5:13 pm
Posts: 58
I love this idea, especially if we can re-inject a texture back into a container. It would have to have the same original attributes (size, height, pixel depth, alpha channel, etc). I don't think anyone needs to go nuts accepting tons of formats for import, but man, there are so many games I'd like to mod textures on.


Top
   
PostPosted: Fri Mar 13, 2015 8:40 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 5700
I know that it's not related to the post but, regarding quickbms, there are at least a couple of things many people probably don't know and may be useful while writing complex scripts.

1) callfunction supports arguments, they have the same name of the function followed by "_ARG" + number:
Code:
callfunction TEST 0 "this is the first argument" 2 0x000003 four

startfunction TEST
    print "%TEST_ARG1%"
    print "%TEST_ARG2%"
    print "%TEST_ARG3%"
    print "%TEST_ARG4%"
endfunction


2) quickbms allows to include other scripts and this is a technique that AlphaTwentyThree uses a lot to put some generic "utils" functions in one or more scripts that are loaded in the final script specific for a game, example:
Code:
include "utils_functions.bms"
include "graphic_functions.bms"
get ...


I repeat that this is OT with the topic and quickbms is probably not the best solution for this type of stuff (I'm sure you have experienced difficulties in making graphic converters with bms scripts), but I think there are ways to make this task easier, after all usually it's just a matter of "get" from input and "put" to MEMORY_FILE :)


Top
   
PostPosted: Fri Mar 13, 2015 11:06 am 
User avatar

Joined: Sat Dec 13, 2014 1:01 am
Posts: 161
Yeah, there are ways to do it with QuickBMS, but I've concluded that that usually takes more effort than just making a whole program :P Technically I could probably make a number of intertwining BMS scripts that make it easier but I think a custom program is the best choice.

Thanks for pointing it out anyway, I wasn't aware that you could include external scripts in QuickBMS, that might be useful in the future.

Teancum wrote:
I love this idea, especially if we can re-inject a texture back into a container. It would have to have the same original attributes (size, height, pixel depth, alpha channel, etc).

Yes, I would try and make it support reverse conversion using the same script, similar to QuickBMS's reimport feature. I'm not sure how difficult this might be though, most scripts won't handle every single valye in a file's header so you may have to explicitly choose an existing file to use as a base.
Yeah I'm not sure how I'd make it work exactly, but it's definitely a feature I want it to have.


Last edited by puggsoy on Fri Mar 13, 2015 11:17 am, edited 1 time in total.

Top
   
PostPosted: Fri Mar 13, 2015 11:15 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 5700
I agree with you that a specific tool just for this task is necessary.

Do you have a specific programming language in mind?

Have you already evaluated if there are other existent solutions?
I mean custom tools and doing the same in pure Python/Ruby/Perl.


Top
   
PostPosted: Fri Mar 13, 2015 11:33 am 
User avatar

Joined: Sat Dec 13, 2014 1:01 am
Posts: 161
The programming language I would use is Haxe; it's the language I use for my existing conversion programs and I think it would work well for this.

To my knowledge there is no program that already does this. I think the closest might be ImageMagick, but its focus is more on complex image manipulation rather than conversion/extraction. From what I can tell, to add a new format you need to either ask the developers to do it or code it in C yourself :?


Top
   
PostPosted: Fri Mar 13, 2015 11:55 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 5700
Does Haxe have any runtime dependency?

For example the python/ruby/perl scripts obviously require that the final user has the whole interpreter installed (very annoying), and .net is the same although it's installed by default on Windows but sometimes there are problems with the required version or some components, Java requires JRE installed.
VisualBasic has lot of dependencies (ocx, dll and so on), just like the MFC programs.


Top
   
PostPosted: Sat Mar 14, 2015 4:42 am 
User avatar

Joined: Sat Dec 13, 2014 1:01 am
Posts: 161
Well Haxe can compile to multiple targets (like Flash) but for command-line programs like this I just do it to a native Windows executable. It does require a number of .dll and .ndll files to be packed with it but otherwise it runs natively, it doesn't need you to install any runtime environment or virtual machine.

EDIT: I tested some stuff and it's actually possible to compile so that it needs little or no extra files next to it, so it's just a single .exe. That's handy :)


Top
   
PostPosted: Tue Sep 22, 2015 9:04 pm 
User avatar

Joined: Sat Sep 12, 2015 7:09 am
Posts: 101
Has much progress been done on this since March? I do think it's a great idea which is why I'm interested and asking.

_________________
I can mildly reverse engineer, and lightly understand programming terms and functions, yet somehow I am completely incapable of writing programs, scripts, etc.


Top
   
PostPosted: Wed Sep 23, 2015 9:43 am 
User avatar

Joined: Sat Dec 13, 2014 1:01 am
Posts: 161
I'm currently very busy with study, however I am trying to spend some time on this when I can. The biggest hurdle is making good and stable script interpretation and implementing stuff like variables, once that's done adding commands and features should go relatively smoothly.

Anyway, it's going a bit slowly right now but once my exams are over in November I will have a lot of time on my hands, and will try and dedicate a large chunk of that to getting this done. I'm personally very excited to finish this since I know it will be useful for myself as well as others.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited