News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

Makeobj patch

Started by Max-Max, November 03, 2013, 11:39:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Max-Max

I think I have managed to isolate some changes into a makeobj patch. I hope all needed files are included (yes, I have test compiled and run the makeobj file on my system).

I have added a resource script file and an icon as well. Please add them to the project and make file.

This patch adds the -DEBUG switch to the command line and has to be used with the PAK command to be of any use.
This will dump extensively information of the images being packed, from makeobj's point of view. If your PAK-set isn't what you expected, this dump can be very useful to track down where the problem is.

Here is an example of the -DEBUG output

         Source                                     image                X     Y     Off X Off Y Width Height Zoom
         ------------------------------------------ -------------------- ----- ----- ----- ----- ----- ------ ----
WARNING: ignoring alpha channel for ./window.png
         image[  0] => window.0.0                   ./window.png             0     0     0     0    64     64   no
         image[  1] => window.1.0                   ./window.png             0    64    27    27    11     10   no
         image[  2] => window.1.1                   ./window.png            64    64    28    26     8     13   no
         image[  3] => window.1.2                   ./window.png           128    64    26    27    12     10   no
         image[  4] => window.1.3                   ./window.png           192    64    29    29     6      6   no
         image[  5] => window.1.4                   ./window.png           256    64    29    29     6      6   no
WARNING: ignoring alpha channel for ./checkbox.png
         image[  6] => checkbox.0.0                 ./checkbox.png           0     0    26    26    13     13   no
         image[  7] => checkbox.0.1                 ./checkbox.png          64     0    26    26    13     13   no
WARNING: ignoring alpha channel for ./arrows.png
         image[  8] => arrows.0.0                   ./arrows.png             0     0    24    24    16     16   no
         image[  9] => arrows.0.1                   ./arrows.png            64     0    24    24    16     16   no
         image[ 10] => arrows.1.0                   ./arrows.png             0    64    24    24    16     16   no
         image[ 11] => arrows.1.1                   ./arrows.png            64    64    24    24    16     16   no
WARNING: ignoring alpha channel for ./button.png
         image[ 12] => button.0.0                   ./button.png             0     0    59    21     5     21   no
         image[ 13] => button.0.2                   ./button.png           128     0     0    21     5     21   no
         image[ 14] => button.0.1                   ./button.png            64     0     0    21    64     21   no
         image[ 15] => button.0.3                   ./button.png           192     0    59    21     5     21   no
         image[ 16] => button.0.5                   ./button.png           320     0     0    21     5     21   no
         image[ 17] => button.0.4                   ./button.png           256     0     0    21    64     21   no
WARNING: ignoring alpha channel for ./arrows.png
         image[ 18] => arrows.2.0                   ./arrows.png             0   128    24    24    16     16   no
         image[ 19] => arrows.2.1                   ./arrows.png            64   128    24    24    16     16   no
         image[ 20] => arrows.3.0                   ./arrows.png             0   192    24    24    16     16   no
         image[ 21] => arrows.3.1                   ./arrows.png            64   192    24    24    16     16   no


I use a command script like this to create theme-PAK files:

del *.pak
..\makeobj QUIET DEBUG PAK64 menu.dark_theme.pak > log.txt
ECHO/ >> log.txt
ECHO/ >> log.txt
ECHO ** GENERATED PAK *********************************************** >> log.txt
FOR %%I IN (*.pak) DO @ECHO %%~znxI >> log.txt 2>&1
ECHO/ >> log.txt
ECHO ** INSTALL THEME *********************************************** >> log.txt
COPY *theme.pak ..\..\ >> log.txt 2>&1
COPY *_theme.tab ..\..\ >> log.txt 2>&1
ECHO/ >> log.txt
ECHO/ >> log.txt
ECHO ** PAK DUMP *********************************************** >> log.txt
FOR %%I IN (*.pak) DO ..\makeobj DUMP %%I >> log.txt


This compiles a theme and copy it to my test installation. Feel free to use it or modify it...

***EDIT
Forgot to add the icon for makeobj...
Download it here.

prissi

Extended debug is certainly useful.

The Icon, I fear, needs probably some more artists attention. (I am not sure, if an icon for a command line application will not lead even more people to double click and complain though). This is open for discussion.

You redirect errors and warnings to stderr, but other stuff to stdout. However stuff to stderr does not always appear on a default command line without redirection (under mingw). But this was just a very quick test, I will look through it and test on other architectures tomorrow.

Max-Max

I added the icon more like a proxy. I don't think people will complain too much by double clicking on the makeobj.exe file. It is still an exe file, with or without icon. There are many games that have exe files with icons that only flicker  and close when you start them, not a new concept.

I saw that most of the errors already where redirected to stderror before me, so I added the ones I came across. I don't really care where they go, I just thought of concistensy. Feel free to redirect them where ever you want. My script is collecting both stdout and stderr into a single log file anyway...

I don't know if some version information should be updated or nor. I have not added any VERSION info into the resource script either, so feel free to add it...  :thumbsup:

prissi

#3
Thanks, reviewing patches is a good time to find errors and inconsitencies.

About doubleclicking makeobj errors: An about monthly reoccuring topic (or is there a sticky now)?

EDIT: Incorporated, thank you. I just converted the remaing fprintf( stderr into dbg->error, dbg->fatal, and dbg->warnings I hope, I caught all now.

greenling

Hello All
By what do help this patch?

Dwachs

By debugging from errors in dat files.

greenling

Hello Dwachs
Thank you for this info over this patch.

prissi

Most of it, especially the debugging was from Max-Max. I just removed the remaining warning and error printfs and called bdg->warning and dbg->error instead (to have a selectable warning level).

Maybe makeobj should war for unparable lines on debuglevel 3 ...

Ters

I think unparsable lines should give a warning on level 0, if not fail completely.

prissi

All unparsable lines inside objects will be printed (when not starting with #) when run with makeobj verbose pak... from now on. That should catch problem like the last bug report on the ways.