QinL / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Transferring pictures to target platforms, for example to C64 via Codenet #521

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
An option to send pictures to their target platforms for viewing. Personally I 
only work with C64 graphics, but I'm sure users of other platforms also know 
some solutions for their beloved boxes.

For the C64 Codenet is the obvious choice. Codenet is an open protocol 
developed by Graham of Oxyron for sending data and code to a C64 via RR-net. 
Info and sourcecode is available at http://www.oxyron.de/html/codenet.html . 
Codenet is a selling point for some of GrafX2' competitors, at least for C64 
users.

I made a simple picview prg file for the C64 that can be inserted before a 
hires picture and sent with Codenet. This file also includes Codenet, so the 
user does not need to restart the C64 and run codenet again to update the 
picture or send a new one, a simple resend will do. 

To test it follow these simple instructions:
- Save a hires .c64 picture without load address.
- Join picviewhires.prg (attached) and the .c64 picture. (cat picviewhires.prg 
picture.c64 > codenettest.prg)
- Send codenettest.prg to the C64 using Codenet.

Right now it's hires only, that is just what I was testing with. Multicolor 
support will come.

The picture should now display on your C64 screen, and you can send a new pic 
without resetting the machine to start Codenet. Thanks to Graham for providing 
me with the C64 sources for Codenet.

I also attached the source to the picview code and the codenet C64 binary 
snippet.

I suggest two new "retro platform buttons" for the UI; one for sending and one 
for format checking. (Format checking code already exists in the save 
routines.) Right click would bring up settings, for example IP address of 
target machine on the send button and format check options on the format check 
button.

Original issue reported on code.google.com by mikeri...@gmail.com on 21 Dec 2012 at 12:04

Attachments:

GoogleCodeExporter commented 8 years ago
You should be able to do the transfer using a Lua script.
If everything is in ~/c64 for example, it would look like:
fn, fp = getfilename();
os.execute("cat " .. fp .. "/" .. fn .. " ~/c64/picviewhires.prg > 
/tmp/codenettest.prg; ~/c64/codenet /tmp/codenettest.prg &");

I'm not 100% sure about the final &, I think it should make the script return 
(and grafx2 becoming responsive again) while the transfer is in progress.
If this technique works, you can attach a keyboard shortcut.

Original comment by yrizoud on 22 Dec 2012 at 4:12

GoogleCodeExporter commented 8 years ago
Using codenet would require us to embed network datagram support in GrafX2. 
That makes it harder to port. Also, it means we are hrdcoding the protocol into 
GrafX2, and we'll need different protocols for different pachines (on Amstrad 
CPC I'd like to use the CPC Booster and SNArkos, for example).
So, using Lua scripts is definitely the right thing to do. If you get the 
script working, please send it to us and we'll include it as an example in the 
next GrafX2 version.

Since our Lua API also allows creating dialog windows, adding a configuration 
screen where user can select he path to codenet executable and the IP address 
is also possible.

Original comment by pulkoma...@gmail.com on 23 Dec 2012 at 9:42

GoogleCodeExporter commented 8 years ago
You make very valid arguments, I agree fully. I didn't know about the 
getfilename function, partly because I'm using 2.3 as the C64 multicolor saver 
doesn't work in 2.4 here. (I didn't raise an issue yet because I only tested my 
own build in Ubuntu so far. I will test more and raise an issue if appropriate.

Anyway, I made a working script now. It sends and displays multicolor and hires 
images with or without load addresses via Codenet and starts another Codenet 
session on the C64 so the user can send more images without any interactions on 
the C64.

As the C64-code is so small I just base64ed it into the script itself. If you 
need the sources the comply with the GPL or whatnot for inclusion in the Grafx2 
distribution just use the ones I attached to my first post.

Feel free to include this script anywhere.

Original comment by mikeri...@gmail.com on 25 Dec 2012 at 9:16

Attachments:

GoogleCodeExporter commented 8 years ago
Included in r2043.
Some comments however :
 - The script is linux-only.We may want to help writing such scripts by providing some more IO functions,
 - Adding a config dialog to set the IP address and some error management would be nice

Original comment by pulkoma...@gmail.com on 29 Dec 2012 at 7:01

GoogleCodeExporter commented 8 years ago
Personally I prefer no mandatory interactions for frequently used scripts, so I 
suggest a dialog that can easily be disabled with a variable in the first lines 
of the script.

Original comment by mikeri...@gmail.com on 29 Dec 2012 at 7:05