edit a .dat file with .pcx files in it
Re: edit a .dat file with .pcx files in it
I extended the FontExtractor code.
Now also a complete fontset graphic is in the clipboard.
(Needed for my example in the Games Thread)
Now also a complete fontset graphic is in the clipboard.
(Needed for my example in the Games Thread)
Last edited by infratec on Tue Feb 02, 2021 8:59 pm, edited 1 time in total.
Re: edit a .dat file with .pcx files in it
I extended the picture extractor for the JunkSet
Code: Select all
Case 204800
XPixels = 80
YPixels = 80
Pictures = 32
Last edited by infratec on Tue Feb 02, 2021 8:50 pm, edited 1 time in total.
Re: edit a .dat file with .pcx files in it
For the 25600 byte files
Code: Select all
;
; https://www.squarefree.com/2003/09/19/debris-32/
;
; direct download link:
; http://www.squarefree.com/mirrors/deb3210.exe
;
EnableExplicit
Structure PBPixelStructure
B.a
G.a
R.a
EndStructure
Structure RGBStructure
R.a
G.a
B.a
EndStructure
IncludeFile "Debris32_Palette.pbi"
#Size1 = 64
#Size2 = 48
#Size3 = 32
#Size4 = 24
#Size5 = 16
Define.a Byte
Define.i File, x, y, BytesPerPixel, LinePaddingBytes, Img, Pictures, i, XPos, YPos, YPictures, Event, MaxImageHeight, LastX, LastY
Define Filename$, ExtractDirName$
Define *FileBuffer, *FilePtr.Ascii, *ImgBuffer, *ImgPtr.PBPixelStructure, *ColorPtr.RGBStructure
Filename$ = OpenFileRequester("Choose a 256000 byte dat file", "", "dat|*.dat", 0)
If Filename$
File = ReadFile(#PB_Any, Filename$)
If File
*FileBuffer = AllocateMemory(Lof(File), #PB_Memory_NoClear)
If *FileBuffer
If ReadData(File, *FileBuffer, MemorySize(*FileBuffer)) = MemorySize(*FileBuffer)
*FilePtr = *FileBuffer
For i = 0 To 31
If CreateImage(i, #Size1, #Size1, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size1 * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size1 - 1
For x = 0 To #Size1 - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
For i = 32 To 63
If CreateImage(i, #Size2, #Size2, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size2 * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size2 - 1
For x = 0 To #Size2 - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
For i = 64 To 95
If CreateImage(i, #Size3, #Size3, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size3 * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size3 - 1
For x = 0 To #Size3 - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
For i = 96 To 127
If CreateImage(i, #Size4, #Size4, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size4 * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size4 - 1
For x = 0 To #Size4 - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
OpenWindow(0, 0, 0, 802, 422, GetFilePart(Filename$, #PB_FileSystem_NoExtension), #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
x = 0
y = 0
For i = 0 To 127
If ImageWidth(i) <> LastX
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = 0
ElseIf ImageHeight(i) <> LastY
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = LastY
EndIf
ImageGadget(i, x + 2, y, 0, 0, ImageID(i))
x + ImageWidth(i) + 2
If ImageHeight(i) > MaxImageHeight
MaxImageHeight = ImageHeight(i)
EndIf
If x > 800 - ImageWidth(i)
x = 0
y + MaxImageHeight + 2
MaxImageHeight = 0
EndIf
Next i
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
SetClipboardImage(EventGadget())
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
FreeMemory(*FileBuffer)
EndIf
CloseFile(File)
EndIf
Last edited by infratec on Wed Feb 03, 2021 9:11 am, edited 3 times in total.
Re: edit a .dat file with .pcx files in it
The above RockSetExtractor works also for the CRYSTALS (256000 bytes) and also for tthe BASESET.
So it is more a 256000 Extractor
So it is more a 256000 Extractor
Re: edit a .dat file with .pcx files in it
ThruSet
Code: Select all
;
; https://www.squarefree.com/2003/09/19/debris-32/
;
; direct download link:
; http://www.squarefree.com/mirrors/deb3210.exe
;
EnableExplicit
Structure PBPixelStructure
B.a
G.a
R.a
EndStructure
Structure RGBStructure
R.a
G.a
B.a
EndStructure
IncludeFile "Debris32_Palette.pbi"
Define.a Byte
Define.i File, x, y, BytesPerPixel, LinePaddingBytes, Img, Pictures, i, XPos, YPos, YPictures, Event, MaxImageHeight, LastX, LastY
Define Filename$, ExtractDirName$
Define *FileBuffer, *FilePtr.Ascii, *ImgBuffer, *ImgPtr.PBPixelStructure, *ColorPtr.RGBStructure
Filename$ = OpenFileRequester("Choose a ThruSet dat file", "", "dat|THRUSET*.dat", 0)
If Filename$
File = ReadFile(#PB_Any, Filename$)
If File
*FileBuffer = AllocateMemory(Lof(File), #PB_Memory_NoClear)
If *FileBuffer
If ReadData(File, *FileBuffer, MemorySize(*FileBuffer)) = MemorySize(*FileBuffer)
*FilePtr = *FileBuffer
If CreateImage(100, 18, 24, 24)
If StartDrawing(ImageOutput(100))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - 18 * 3
*ImgPtr = *ImgBuffer
For y = 0 To 23
For x = 0 To 17
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
GrabImage(100, 0, 0, 0, 9, 8)
GrabImage(100, 1, 9, 0, 9, 8)
GrabImage(100, 2, 0, 8, 9, 8)
GrabImage(100, 3, 9, 8, 9, 8)
GrabImage(100, 4, 0, 16, 9, 4)
GrabImage(100, 5, 9, 16, 9, 4)
GrabImage(100, 6, 0, 20, 9, 4)
GrabImage(100, 7, 9, 20, 9, 4)
OpenWindow(0, 0, 0, 200, 100, GetFilePart(Filename$, #PB_FileSystem_NoExtension), #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
x = 0
y = 0
For i = 0 To 7
If ImageWidth(i) <> LastX
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = 0
ElseIf ImageHeight(i) <> LastY
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = LastY
EndIf
ImageGadget(i, x, y, 0, 0, ImageID(i))
x + ImageWidth(i) + 2
If ImageHeight(i) > MaxImageHeight
MaxImageHeight = ImageHeight(i)
EndIf
If x > 800 - ImageWidth(i)
x = 0
y + MaxImageHeight + 2
MaxImageHeight = 0
EndIf
Next i
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
SetClipboardImage(EventGadget())
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
FreeMemory(*FileBuffer)
EndIf
CloseFile(File)
EndIf
Re: edit a .dat file with .pcx files in it
To make the listings shorter I excluded the palette DataSection in an own file.
See:
viewtopic.php?p=564856#p564856
See:
viewtopic.php?p=564856#p564856
Re: edit a .dat file with .pcx files in it
Extended the picture extractor.
Now only the FrameSet is messy.
Now only the FrameSet is messy.
Re: edit a .dat file with .pcx files in it
FrameSet:
Code: Select all
;
; https://www.squarefree.com/2003/09/19/debris-32/
;
; direct download link:
; http://www.squarefree.com/mirrors/deb3210.exe
;
EnableExplicit
Structure PBPixelStructure
B.a
G.a
R.a
EndStructure
Structure RGBStructure
R.a
G.a
B.a
EndStructure
IncludeFile "Debris32_Palette.pbi"
#Size1w = 8
#Size1h = 100
#Size2w = 14
#Size2h = 12
#Size3w = 32
#Size3h = 28
Define.a Byte
Define.i File, x, y, BytesPerPixel, LinePaddingBytes, Img, Pictures, i, XPos, YPos, YPictures, Event, MaxImageHeight, LastX, LastY
Define Filename$, ExtractDirName$
Define *FileBuffer, *FilePtr.Ascii, *ImgBuffer, *ImgPtr.PBPixelStructure, *ColorPtr.RGBStructure
Filename$ = OpenFileRequester("Choose a FRAMESET dat file", "", "dat|FRAMESET*.dat", 0)
If Filename$
File = ReadFile(#PB_Any, Filename$)
If File
*FileBuffer = AllocateMemory(Lof(File), #PB_Memory_NoClear)
If *FileBuffer
If ReadData(File, *FileBuffer, MemorySize(*FileBuffer)) = MemorySize(*FileBuffer)
*FilePtr = *FileBuffer
For i = 0 To 2
If CreateImage(i, #Size1w, #Size1h, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size1w * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size1h - 1
For x = 0 To #Size1w - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
For i = 3 To 3
If CreateImage(i, #Size2w, #Size2h, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size2w * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size2h - 1
For x = 0 To #Size2w - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
For i = 4 To 8
If CreateImage(i, #Size3w, #Size3h, 24)
If StartDrawing(ImageOutput(i))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - #Size3w * 3
*ImgPtr = *ImgBuffer
For y = 0 To #Size3h - 1
For x = 0 To #Size3w - 1
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
Next i
OpenWindow(0, 0, 0, 200, 180, GetFilePart(Filename$, #PB_FileSystem_NoExtension), #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
x = 0
y = 0
For i = 0 To 8
If ImageWidth(i) <> LastX
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = 0
ElseIf ImageHeight(i) <> LastY
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = LastY
EndIf
ImageGadget(i, x + 2, y, 0, 0, ImageID(i))
x + ImageWidth(i) + 2
If ImageHeight(i) > MaxImageHeight
MaxImageHeight = ImageHeight(i)
EndIf
If x > 800 - ImageWidth(i)
x = 0
y + MaxImageHeight + 2
MaxImageHeight = 0
EndIf
Next i
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
SetClipboardImage(EventGadget())
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
FreeMemory(*FileBuffer)
EndIf
CloseFile(File)
EndIf
- TheAutomator
- Enthusiast

- Posts: 112
- Joined: Tue Dec 01, 2020 8:33 pm
Re: edit a .dat file with .pcx files in it
Code: Select all
Repeat
Debug "Thank you!!!"
ForEver