Join us on Discord!
You can help CodeWalrus stay online by donating here.

PICO-8 : Fantasy console

Started by Duke "Tape" Eiyeron, April 16, 2015, 08:44:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Duke "Tape" Eiyeron

Quote from: Siapran on May 21, 2015, 02:44:15 PM
I think each byte of the cart is spread on the last 2 bits of every channel:

take for instance, the keyword "local"
hex: 6c 6f 63 61 6c
binary: 0110 1100 0110 1111 0110 0011 0110 0001 0110 1100


now for a gray pixel on the png:
hex: 66 66 66 FF
binary: 0110 0110 0110 0110 0110 0110 1111 1111


now for each pixel, spread a char on the end of each channel:
binary:
0110 0101 0110 0110 0110 0111 1111 1100
0110 0101 0110 0110 0110 0111 1111 1111
0110 0101 0110 0110 0110 0100 1111 1111
0110 0101 0110 0110 0110 0100 1111 1101
0110 0101 0110 0110 0110 0111 1111 1100
hex:
65 66 67 FC
65 66 67 FF
65 66 64 FF
65 66 64 FD
65 66 67 FC


the color change is so subtle you can't even see it, but the data is still there
with a picture of 160*205, you have 32800 pixels, that makes 32K of data for a cart
Or you can just ask Lexaloffle. That's a classic way to store data in picture : changing the less signifiant bits.
  • Calculators owned: A lot.

Snektron

What if there's a secret message hidden in the original Walrii? O.O
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Yuki

I just wrote a little script to test this algorithm up, it indeed seems to work. I can see about 32K of memory with some Lua code in it.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

#108
Quote from: Siapran on May 21, 2015, 11:27:33 AM
oh my god
I tried getting the code from a cart png with a text editor

I though it would just be some extensive metadata in the picture
I was wrong

the whole thing is encoded into the pixels themselves
Seems like something I wanted to do on-calc a while back.

What surprises me though is how someone uploaded a cart a while ago, yet I couldn't see any different color difference between pixels of the same hue.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Duke "Tape" Eiyeron

Hre's the base ram laout, found directly from the readme
0x0    gfx
0x1000 gfx2/map2 (shared)
0x2000 map
0x3000 gfx_props
0x3100 song
0x3200 sfx
0x4300 user-defined
0x5f00 draw state [,cart data] (1024 bytes incl. unused)
0x6000 screen (8k)
  • Calculators owned: A lot.

Yuki

#110
Quote from: DJ Omnimaga on May 21, 2015, 06:41:36 PM
What surprises me though is how someone uploaded a cart a while ago, yet I couldn't see any different color difference between pixels of the same hue.
The data is encoded in the 2 least signifiant bits of each channel, and a difference of 4 out of 255 in each color is pretty much imperceptible. Myself I was fooled, it's kind of incredible when you think about it.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

Yeah I didn't see the color difference myself, which is why I was wondering lol when Ivoah posted that 3D cart. I was asking myself: "Where is the code? O.o" It's a good idea I think, providing that people use common sense and don't start distributing cartridges in JPEG format. :P
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Siapran

Quote from: DJ Omnimaga on May 22, 2015, 06:33:46 AM
Yeah I didn't see the color difference myself, which is why I was wondering lol when Ivoah posted that 3D cart. I was asking myself: "Where is the code? O.o" It's a good idea I think, providing that people use common sense and don't start distributing cartridges in JPEG format. :P

if you're looking for the differences, check the 10~ rows of pixels under the green cube, that is the zone mapped to the code

(use GIMP or something)

Dream of Omnimaga

I actually maxed out the image gamma three times and I see it now :)

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

That is very interesting, what's the blue line through the cube for?
  • Calculators owned: TI-83+, TI-84+


Snektron

OH that's cool, really easy to see now
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Yuki

#116
[spoiler=Some random code]
<?php$im = new Imagick($argv[1]);$it = $im->getPixelIterator();foreach($it as $row => $pixels) {  foreach ($pixels as $column => $pixel) {    $c = $pixel->getColor();    $cn = $pixel->getColor(true);    $mem[] = ((floor($cn['a']*255)&3)<<6)|(($c['r']&3)<<4)|(($c['g']&3)<<2)|(($c['b'])&3);  }  $it->syncIterator();}for($i=0x4300;$mem[$i]!=0&&$i<count($mem);$i++){  echo chr($mem[$i]);}?>
[/spoiler]

I said absolutely nothing. >.>

So yeah, it's pretty much what Siapran said, but the alpha channel's 2 least signifiant bits are the characters' 2 most signifiant bytes, that is, it goes first. The memory map should be pretty much what the doc said about it, and Lua code starts at 0x4300 and probably goes until 0x7F00. Finding a library that doesn't convert the 8-bit alpha channel value to 7-bit (GD) or 1-bit (non-normalized Imagick) was kinda tedious, though.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Strontium

I lost my Lexaloffle acc. so I can't use PICO-8 anymore :(
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

@Juju does that script return the actual code? I don't know PHP that much.

@Strontium that sucks :(. Did you get hacked or did you just forget your password? You should maybe contact the author about the issue in case he can restore your access.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Maybe there are still some codes left, strontium. Atleast i hope so.

Also would it be possible to have more than 16k lua code by encoding it into the sprites, map, sound and music areas and just copying it somewhere else on runtime?
Guess not since the lua ram is not accessible :/
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal