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 *.exe
*.dll
*.zip
*.png
*.tim
*.bmp
obj obj

View File

@ -1,10 +1,17 @@
# img2tim # IMG2TIM
An Image to PlayStation TIM File Converter 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. 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 ## Features
- Uses the same argument format used in bmp2tim. * Uses the same arguments used in bmp2tim with special additional arguments.
- Supports alpha channel (if available) with threshold control as transparency mask. * Supports alpha channel (if available) with threshold control as transparency mask.
- Color-key and index-key transparency masking. * Color-key and index-key transparency masking.
- RGB to color-index image conversion (currently very basic). * 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 object_output="obj/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option parameters="-bpp 4 16color.png" />
<Compiler> <Compiler>
<Add option="-O2" /> <Add option="-O2" />
</Compiler> </Compiler>

View File

@ -1,12 +1,12 @@
# depslib dependency file v1.0 # 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> <stdio.h>
<string.h> <string.h>
<ctype.h> <ctype.h>
<math.h> <math.h>
<unistd.h> <unistd.h>
<windows.h> <windows.h>
"freeimage/freeimage.h" <freeimage.h>
"tim.h" "tim.h"
1395229970 c:\documents and settings\lameguy64\desktop\projects\img2tim\freeimage\freeimage.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 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> <stdio.h>
<string.h> <string.h>
<ctype.h> <ctype.h>
@ -33,18 +33,18 @@
1446696616 c:\users\lameguy64\desktop\projects\img2tim\tim.cpp 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> <stdio.h>
<windows.h> <windows.h>
<math.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" "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" "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> <stdio.h>
<windows.h> <windows.h>
<math.h> <math.h>

View File

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

View File

@ -8,7 +8,7 @@
#include "tim.h" #include "tim.h"
#define VERSION "0.60" #define VERSION "0.75"
namespace param { namespace param {
@ -518,7 +518,12 @@ void ConvertImageToTim(IMGPARAM image, tim::PARAM* tim) {
for(short py=0; py<image.h; py++) { 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);
}
} }