Updated to v0.75

This commit is contained in:
Lameguy64 2016-10-11 10:32:22 +08:00
parent 7f594837c4
commit b61e0e6dd5
6 changed files with 40 additions and 22 deletions

5
.gitignore vendored
View File

@ -1,2 +1,7 @@
*.exe
*.dll
*.zip
*.png
*.tim
*.bmp
obj

View File

@ -1,10 +1,17 @@
# img2tim
# IMG2TIM
An Image to PlayStation TIM File Converter
This tool converts almost any image file into a PlayStation TIM image file for PlayStation homebrew development. Uses the FreeImage library for loading image files of almost any file format.
# Features
- Uses the same argument format used in bmp2tim.
- Supports alpha channel (if available) with threshold control as transparency mask.
- Color-key and index-key transparency masking.
- RGB to color-index image conversion (currently very basic).
## Features
* Uses the same arguments used in bmp2tim with special additional arguments.
* Supports alpha channel (if available) with threshold control as transparency mask.
* Color-key and index-key transparency masking.
* Basic RGB to color-index image conversion.
## Changelog
**Version 0.75**
* Fixed a pixel order bug when converting images from either RGB or 4-bit depth to 4-bit color depth.
**Version 0.60**
* Initial release.

View File

@ -11,6 +11,7 @@
<Option object_output="obj/" />
<Option type="1" />
<Option compiler="gcc" />
<Option parameters="-bpp 4 16color.png" />
<Compiler>
<Add option="-O2" />
</Compiler>

View File

@ -1,12 +1,12 @@
# depslib dependency file v1.0
1458085464 source:c:\documents and settings\lameguy64\desktop\projects\img2tim\main.cpp
1476085104 source:c:\documents and settings\lameguy64\desktop\projects\img2tim\main.cpp
<stdio.h>
<string.h>
<ctype.h>
<math.h>
<unistd.h>
<windows.h>
"freeimage/freeimage.h"
<freeimage.h>
"tim.h"
1395229970 c:\documents and settings\lameguy64\desktop\projects\img2tim\freeimage\freeimage.h
@ -17,7 +17,7 @@
1430448034 c:\documents and settings\lameguy64\desktop\projects\img2tim\tim.cpp
1459050299 source:c:\users\lameguy64\desktop\projects\img2tim\main.cpp
1476152828 source:c:\users\lameguy64\desktop\projects\img2tim\main.cpp
<stdio.h>
<string.h>
<ctype.h>
@ -33,18 +33,18 @@
1446696616 c:\users\lameguy64\desktop\projects\img2tim\tim.cpp
1446768380 c:\users\lameguy64\desktop\projects\img2tim\tim.h
1458995574 c:\users\lameguy64\desktop\projects\img2tim\tim.h
<stdio.h>
<windows.h>
<math.h>
1446768874 source:c:\users\lameguy64\desktop\projects\img2tim\tim.cpp
1458995574 source:c:\users\lameguy64\desktop\projects\img2tim\tim.cpp
"tim.h"
1446768876 source:c:\documents and settings\lameguy64\desktop\projects\img2tim\tim.cpp
1459049574 source:c:\documents and settings\lameguy64\desktop\projects\img2tim\tim.cpp
"tim.h"
1446768382 c:\documents and settings\lameguy64\desktop\projects\img2tim\tim.h
1459049574 c:\documents and settings\lameguy64\desktop\projects\img2tim\tim.h
<stdio.h>
<windows.h>
<math.h>

View File

@ -6,14 +6,14 @@
<Cursor1 position="325" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="639" topLine="0" />
</Cursor>
</File>
<File name="tim.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1388" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="663" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -8,7 +8,7 @@
#include "tim.h"
#define VERSION "0.60"
#define VERSION "0.75"
namespace param {
@ -518,7 +518,12 @@ void ConvertImageToTim(IMGPARAM image, tim::PARAM* tim) {
for(short py=0; py<image.h; py++) {
memcpy(&((u_char*)tim->imgData)[(image.w/2)*py], &((u_char*)image.pixels)[(image.w/2)*py], image.w/2);
for(short px=0; px<image.w/2; px++) {
u_char pix = ((u_char*)image.pixels)[px+((image.w/2)*py)];
((u_char*)tim->imgData)[px+((image.w/2)*py)] = ((pix&0xf)<<4)|((pix>>4)&0xf);
}
}