News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Camm

Editing the Palette of an existing game?

Started by Camm, 07:15, 26 March 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Devilmarkus

Making progress...
Need to embed CPCXFS and a suitable filechooser...
But the most important things already work!
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Camm

Looking great  :)

I am astounded at how quickly this has all come about and the progress that has been made already. All I can say is nice work, and keep going.

Devilmarkus

Well it goes quick because I use existing classes from JavaCPC and CPCInAJar and combine them.
The CPCXFS embedding and the "file-mode" I will code extra.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

File editing is a hard nut... But I'll make it ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

#29
Here you go: CPCgfxEd 1.0 is ready to use!
It can edit sprites from RAM or also from DSK images!
Download

Please handle with care ;) (Always use copies of your to-edit-dsk)

How to edit sprites now from files?
Simple follow these steps:
- Startup CPCgfxEd
- Insert a dsk into drive (F2 or the button)
- Load your game and run it (Only if you need colour palette)
- Switch to GFX Editor view
- There in the upper right area you see 2 radio buttons: RAM mode or DSK mode. Select DSK mode here.
- This will show you a selector with all found files from your DSK. Select one now.
- Search and edit graphics in this file. Use mousewheel to scroll, or change address by + and - buttons.
- Edit a sprite cell by double click with your right mousebutton into the sprite you want to change.
- Important: Select the pencil icon here in the Cell-Editor!
- Pixel around as you wish
- Edit as many sprites as you wish in the loaded file
- When done, click the "Save" button right to the file selector.
- Thats all! Have fun!
- Always remember: keep your original DSKs in a safe place!
- When done editing, you can delete "temp.dsk" and "temp.bin" (In the same folder where this app. is in)
- Never delete the folder "tools" or its contents! (Contains CPCXFS)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

einoeL

Are you Speedy Gonzales?
Pretty damn quick!

Devilmarkus

Yep...
Well I had nothing other to do... ;) You are not here... So all is sad  :'(
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Camm

#32
Incredible!!

I was able to test and edit the sprites, using the version of super wonder boy that has loading problems later in the game, which I believe was a tape to disk conversion (as it asks in the game to rewind side 2 and press play). I also found some information that said that the cassette tape version of the game had loading problems and was a known bug.

Strangely enough, the 2 different disk versions that I have found that load correctly, don't have any individual files on disk 2, which is where the sprites are, so I couldn't use the tool with them. You can download these versions here:

http://cpc-power.com/pages/download.php?fiche=2150&dsk=4

http://museo8bits.es/cpc/games/arcade/superwon.zip

I am not sure if this is common with CPC games or not?

Anyway, I am testing the application with the version that has loading problems and will report any bugs that I discover, and any suggestions that come to mind.

Brilliant work and very encouraging  ;D

In my testing so far I have been able to confirm that the sprites can have the 3rd color added to them. The attached images show this with a quick test that I did.

Camm

#33
Ok I have been testing more and have some feedback:


- Something to look at, is when the screen is zoomed out, ie. zoom 1 and sometimes 2, and there is a lot of data on the screen, if you press - or +, sometimes only the top part of the data moves and the bottom part does not move. Also when doing this, sometimes strange colors appear that are not part of the palette. In order to replicate this possible bug, it must be a large file.

- similarly when scrolling with the mouse wheel, I have seen some strange colors appear that are not part of the palette. Edit: when scrolling or moving at all these colors seem to appear occasionally. All seems to be related to the first mentioned bug.

- After a new disk is loaded, or if changing between ram and disk, the data displayed does not update to the new data until you scroll.

- A suggestion would be some way to edit the colors of the palette manually, of course they don't need to be saved but just for the purposes of working with the graphics. For example, with super wonder boy, there are 2 blacks, 1 of which is used as a transparency mask for the sprites. In this situation it is useful to to change one of the black colors in the palette, so you can see what is being masked and what is actually black. Some sort of color selector tool would do the trick.

- Along with the mouse wheel, and -/+ controls(and check boxes), possibly use Page Up and Page Down to skip pages of data. Home and End to skip to the start or end of the data. Could also make use the up, down, left, right arrow keys to for quick key based movement, just a thought.

- The ability to load, view, edit, any file, including whole disk images, cartridges/roms etc. could be useful in certain situations, such as the problem I have encountered with the super wonder boy disks. Mind you this is an area I know nothing about, so you may a solution up your sleeve for that one ;)

This tool is shaping up to be totally awesome! (Yes I was well and truly alive in the 1980s lol)

Edit: When selecting a file in a disk, after clicking the dsk mode, with multiple files you can't see the data for the first file on the list until you have clicked on the second file and then clicked back on the first.

arnoldemu

Quote from: Camm on 04:04, 30 March 11
Incredible!!

I was able to test and edit the sprites, using the version of super wonder boy that has loading problems later in the game, which I believe was a tape to disk conversion (as it asks in the game to rewind side 2 and press play). I also found some information that said that the cassette tape version of the game had loading problems and was a known bug.
I did do a tape to disc conversion at one time of this game. So this bad one might be mine.


Quote from: Camm on 04:04, 30 March 11
Strangely enough, the 2 different disk versions that I have found that load correctly, don't have any individual files on disk 2, which is where the sprites are, so I couldn't use the tool with them. You can download these versions here:

http://cpc-power.com/pages/download.php?fiche=2150&dsk=4

http://museo8bits.es/cpc/games/arcade/superwon.zip

I am not sure if this is common with CPC games or not?

Anyway, I am testing the application with the version that has loading problems and will report any bugs that I discover, and any suggestions that come to mind.

Brilliant work and very encouraging  ;D

In my testing so far I have been able to confirm that the sprites can have the 3rd color added to them. The attached images show this with a quick test that I did.
Excellent!

As for the disk version, a version that does direct sector editing could be good for this, but it may be better to work with a working cracked version.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

Quote from: Camm on 04:04, 30 March 11
Incredible!!

I was able to test and edit the sprites, using the version of super wonder boy that has loading problems later in the game, which I believe was a tape to disk conversion (as it asks in the game to rewind side 2 and press play). I also found some information that said that the cassette tape version of the game had loading problems and was a known bug.

Strangely enough, the 2 different disk versions that I have found that load correctly, don't have any individual files on disk 2, which is where the sprites are, so I couldn't use the tool with them. You can download these versions here:

http://cpc-power.com/pages/download.php?fiche=2150&dsk=4

http://museo8bits.es/cpc/games/arcade/superwon.zip

I am not sure if this is common with CPC games or not?

Anyway, I am testing the application with the version that has loading problems and will report any bugs that I discover, and any suggestions that come to mind.

Brilliant work and very encouraging  ;D

In my testing so far I have been able to confirm that the sprites can have the 3rd color added to them. The attached images show this with a quick test that I did.
In the part where you added the colour, is this treated as transparent now?
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Devilmarkus

#36
Quote from: Camm on 04:59, 30 March 11
Ok I have been testing more and have some feedback:


- Something to look at, is when the screen is zoomed out, ie. zoom 1 and sometimes 2, and there is a lot of data on the screen, if you press - or +, sometimes only the top part of the data moves and the bottom part does not move. Also when doing this, sometimes strange colors appear that are not part of the palette. In order to replicate this possible bug, it must be a large file.

- similarly when scrolling with the mouse wheel, I have seen some strange colors appear that are not part of the palette. Edit: when scrolling or moving at all these colors seem to appear occasionally. All seems to be related to the first mentioned bug.

That's strange. I did not encounter this problem.
Perhaps your Java is outdated / your PC too slow?

Quote- After a new disk is loaded, or if changing between ram and disk, the data displayed does not update to the new data until you scroll.

True... I could blank the editor.  A file should only be loaded when the user wants it.
But I think you can live with that ;)

Quote- A suggestion would be some way to edit the colors of the palette manually, of course they don't need to be saved but just for the purposes of working with the graphics. For example, with super wonder boy, there are 2 blacks, 1 of which is used as a transparency mask for the sprites. In this situation it is useful to to change one of the black colors in the palette, so you can see what is being masked and what is actually black. Some sort of color selector tool would do the trick.

Well, that would be impossible while the game is running. The game code or the CPC itself would overwrite a changed palette.
But you can do this:
- Don't run your game
- Select the file you want to edit as you already did in the selector
- Define the inks from BASIC manually. (INK 0,w:INK 1,x:INK 2,y:INK 3,z)

Quote- Along with the mouse wheel, and -/+ controls(and check boxes), possibly use Page Up and Page Down to skip pages of data. Home and End to skip to the start or end of the data. Could also make use the up, down, left, right arrow keys to for quick key based movement, just a thought.

My "playfield" (The area, where you see the sprites) is a rude hack :D
I will try to add "page up - page down" keys. But I am not sure if it works.
Also mouse scrolling is not always accurate.

Quote- The ability to load, view, edit, any file, including whole disk images, cartridges/roms etc. could be useful in certain situations, such as the problem I have encountered with the super wonder boy disks. Mind you this is an area I know nothing about, so you may a solution up your sleeve for that one ;)

As larger a file is, as more problematic is to show it.
So, @ the moment it's for files on DSKs only.

QuoteThis tool is shaping up to be totally awesome! (Yes I was well and truly alive in the 1980s lol)

Thank you! :)

QuoteEdit: When selecting a file in a disk, after clicking the dsk mode, with multiple files you can't see the data for the first file on the list until you have clicked on the second file and then clicked back on the first.

True.
But I don't want to load the first file automatically. Perhaps I should add the entry "none" @ first field and this cleans the editor.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

You can hit the "Step field" checkbox. This will step each sprite cell when you click + or - on the address field.
"Step line" steps the field linewise.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

arnoldemu

I looked at the code.

The sprites seem to be drawn using a standard method (AND screen with a mask, and then OR the data on).
This implies, the potential that you can use 3 or possible 4 colours for each sprite (depending on masking method).

You can use 4 colours if you can find mask data in there (look for it in mode 2), but more likely they use a mask table, and you can only use 3 colours + transparent.

As for the backgrounds, I think I see something related to them, but it looks like the code is forced to 1-bit.
Does the scroll move a minimum of 4 pixels at a time? I see RLD and RRD opcodes being used. (RLD and RRD can be used for 4-pixel rate scrolling in mode 2).
But I also see big blocks of LDI being used, which also imply 4 pixel scrolling, but normal scroll.

So without furthur investigation, I can't tell if the tile drawing code is actually full colour in disguise, or forced for 1 bit.

I'd need to look at the code a bit more to give a full and final answer to the possibilities, but I know already you have opened up some without me looking closer.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Camm

QuoteSo, @ the moment it's for files on DSKs only.

The only versions that I have found that doesn't  have loading problems later in the game, I can't edit disk 2 with the   new tool because it doesn't have any amstrad files on it, just data. Is   there some sort of way that it can be done?

This is one of them from CPC-Power and looks like an official disk release for the game:

http://cpc-power.com/pages/download.php?fiche=2150&dsk=4

Can you have a look at it with the tool devil and let me know if there is a solution?

QuoteThat's strange. I did not encounter this problem.
Perhaps your Java is outdated / your PC too slow?

I updated Java yesterday, and my computer is quite reasonable. The bug was occurring when large amounts of data where scrolling or moving with zoom on 1 or 2. The easiest way to replicate it is when viewing ram. It would be good if someone else could have a look and see if they encounter the same problem.

QuoteIn the part where you added the colour, is this treated as transparent now?

I can see that it might look that way from the image, but no it is solid color  :)



Devilmarkus

The original DSKs are not editable in this way.
They use copy protections / unreadable formats for CPCXFS.

Perhaps I add DSK-edit feature, too. So you can edit directly on the DSK.
But first I must find the pixel problem...  :o
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Camm


Devilmarkus

Version 1.1 is out.
You can now also edit all files you want (DSK, SNA etc...)
You find it under the same Download link

Just select "File mode" and then open or save your file.

But: as larger a file is, as slower does the display react!
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Camm

#43
Brilliant!

I successfully managed to load the DSK file, edit the sprite graphics, saved directly to the DSK file using the new file mode, and then tested in the emulator with the changes visible.

I played around for a while and thought that I could not get the zoomed out/scrolling bug to replicate, but eventually I did get it to happen, after I went into mode 0, was also in Ram mode and there was a lot of data. So it didn't actually happen for a while until I went into mode 0. I didn't see any weird colors appear though, just the top part of the data moved and the bottom part of the data was stationary when the -/+ feature was used.

I think that the Page Up/Page down feature would be a real improvement for larger files, as I did a lot of scrolling with the scroll wheel lol.

All in all excellent work and I think this is going to be a favorite, must use tool for amstrad modders and hackers  :)

Camm

#44
A couple of new questions that I would appreciate some thoughts on.

The below screen shot is an info hack where I have edited any mainly 1 color tiles so that they have numbers/letters, to show where they are being used. I have also changed 1 of the 2 black colors, the sprite transparent mask color, from black to blue. Just ignore the horrible color scheme, it is just a hack to gather info.



As you can see in the screen shot, the transparent mask color is also being used in the play area, and there are 2 vertical columns of blue on the edges of the playing field that would normally be black and therefore not noticeable.

I have not been able to find a tile that is being used where the blue columns appear, so is this just empty space and blue is the background color?

Does anyone have any ideas about how to make those blue columns black?

Any thoughts would be most appreciated  :)

Devilmarkus

Version 1.2 is out.

You find it under the same Download link

New:
- Page up/down buttons scroll though the cells now. (Accelerated)
      Click into address field to enable them.
- Bug fix: DSK files are loaded properly now. (1.1 only handled the first 64k)
- Palette override: Click on a colour @ the bottom palette field. There you can lock and override the colour.
- Added a Hex editor to edit files.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Camm

This tool is a powerhouse ... That is all I have to say!

Devilmarkus

Quote from: Camm on 14:51, 31 March 11
This tool is a powerhouse ... That is all I have to say!

:) Thank you!
I hope you find it useful ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

FatAgnus

Really nice, like JavaCPC!
I'm starting to hate my netbook... it's sooo slow!

Camm

#49
Well it has been a crazy couple of days of hacking, where after working out how to change the palette, and adding the extra color, I embarked on the impossible mission of finding where the pens were assigned to the task of drawing the tiles. This would give me some control over what color was being used for what. As you can imagine this was much harder than finding the palette data, because the pen values are 00, 01, 02 and 03 ... very common values. I bit the bullet and entered 01 in to the search bar and spent the best part of a day and a half finding 01 and changing it to 00, then starting the game and looking for the desired change, then going through the whole process again ... not particularly enjoyable, but all part of being a hacker. After almost giving up all hope, having tested a ridiculous number of times, I finally found it, and the rest of the pens were assigned in the same area.

However, I wouldn't be writing such a long spiel as this, if that was all I found!!! After all I was searching for 01 and changing it to 00, and it turned up something very interesting along the way. I found the value on the disk that controls the mode of the game and managed to change it into mode 0 with 16 colors.

Oh that's nice, I hear you say, but it isn't really going to be of much use. The graphics won't be in the right format, their won't be enough pen data on the disk to support it etc, etc.

Well, I wouldn't be writing such a long spiel as this, if that was all I found!!! When I first fired the game up in mode 0, first of all it worked which was a surprise, but as expected it only had 4 colors and looked like a garbled mess, plus the sprites were invisible. BUT! I remembered that directly after the palette data there was a pile of 14s (black) and so on a whim I decided to replace all the 14s with random color values. I fired the game up and BANG the screen exploded in a mess of color. Rather peculiar that the disk had data for all 16 pens, but it gets better, the colors were actually specifically placed, it wasn't just a random mess. Of course the colors were randomly chosen by me, but they were actually placed properly ... where they had been designed to go, on the background and on the sprites. The game is using 16 colors and it plays properly. I don't know exactly how, but the graphics themselves actually look ... well ... right? This one is even bending my brain I have spent days looking at these tiles in tile editors and I was certain that the menu and background tiles were 1bpp and the sprites were 2bpp, but there is 4 colors on each background tile, 4 different colors on each menu tile and 8 colors (7 + mask) on the sprites (some shared with the menu tiles). This one is bending my brain I can tell you, but it is all there and working. All I can think of is it must be some sort of layered effect, where there are actually more tiles that layer over the top. In mode 1, the palette for these extra tiles must have been those values that were set to 14, which is the transparent black, and was effectively hiding those tiles??

As a mad keen Wonder Boy fan, I am well aware of the other activision ports of the game, and I immediately thought this might actually be an Atari ST port, or perhaps even commodore 64 or Amiga, but as I fired up each emulator and had a look at those versions it was apparent that the graphics had not been ripped from those versions. They had indeed come from the spectrum.

So my theory is, that they indeed ported it from the Spectrum, and had the intention of a full blown "proper" port, but as the deadline drew closer they decided to take a short cut in order to meet that deadline and put it into mode 1. Or it may even have been for the benefit of the green screen. What ever the reason, one thing is for sure, this game is not limited to 4 colors and this hack just got a whole lot more exciting!

I now have control over the palette/ink, the assignment of the pens and mode 0 with 16 colors! I also discovered that part of the play area is actually covered up with black tiles, and it actually loads the play area tiles underneath them, but they don't scroll. Not sure what I can do with that yet, but it is something else worth a mention.

I haven't got a screen shot to post at this time, because I am trying to get the palette right. I am attempting to use the Atari ST version as a reference as it may have been influenced by that version. If not I will just go with an extended version of the original look.

More info soon.

Powered by SMFPacks Menu Editor Mod