Community

AGI Programming => AGI Development Tools => Topic started by: AGKorson on March 06, 2021, 02:29:37 AM

Title: WinAGI Version 2.1.10
Post by: AGKorson on March 06, 2021, 02:29:37 AM
The console mode that I added in version 2.1.6 was a bit of a hack, and I just couldn't leave it that way. So here's an update that includes a separate executable, conWAGI.exe for running a windowless console mode. It's a much cleaner implementation and it supports importing games (creating WinAGI game files from an existing AGI game) and all three compile options. (The main app also includes a couple minor bug fixes.)

You can get the latest version from the AGI wiki (http://agiwiki.sierrahelp.com/index.php?title=WinAGI). Here's a direct link to the install file:
http://agiwiki.sierrahelp.com/images/8/8b/WinAGI_2_1_10.zip

I am still working on a C# version of WinAGI. I got the all the basic AGI library functions moved over, and have a working app that can display all resources. There are no resource editors or tools added yet, and it's not real stable; there are a ton of bugs, and it's easy to crash right now.

If anyone is interested, I guess I could share a link to the git files. Just don't make fun of my poor C# coding skills...
Title: Re: WinAGI Version 2.1.10
Post by: Collector on March 06, 2021, 07:01:37 PM
I wouldn't mind having a look. I understand that it is a wip. Nice to know you are making progress. For a C# logic editor take a look at FastColoredTextBox. https://github.com/PavelTorgashov/FastColoredTextBox
Title: Re: WinAGI Version 2.1.10
Post by: AGKorson on March 07, 2021, 05:11:13 PM
I sent you a PM.

I found FastColoredTextBox a month or so ago. It's pretty impressive. I was able to modify it to handle extended characters properly, which is important for working with AGI logics. I haven't added it to my project yet, though. I want to get the core functions and preview features to a more stable state before I begin working on the resource editors.  But certainly I'll be using FastColoredTextBox once I do build the logic editor.
Title: Re: WinAGI Version 2.1.10
Post by: ZvikaZ on March 08, 2021, 02:33:00 AM
If you've mentioned extended characters handling - it'd be nice to be able to choose the encoding of the extended character set.
It's not really important for me, as I export all the strings to a csv file, and they are translated by a team in a Google Drive, and then imported back to the logic files by a script - but still, it's a nice feature - if it's not too hard to implement.
Title: Re: WinAGI Version 2.1.10
Post by: Spikey on March 25, 2021, 02:44:23 PM
Hey Andrew,

Thanks for your awesome work on this program.

I noticed AppleII GS sounds can be opened but not extracted, despite the program extracting them. Is it possible to capture those extracted SND files in some way? If not, is there another way to do it that you know of?
Title: Re: WinAGI Version 2.1.10
Post by: AGKorson on March 26, 2021, 10:50:12 AM
You can use the export feature to extract those sounds. It's on the Resource menu. You can choose to export them as an AGI resource file, which keeps all the AGI formatting (you could then add them to another game if you wanted to), or you can export them as a MIDI/WAV file, depending on the type of sound.

Let me know if this helps, or if you still have questions.
Title: Re: WinAGI Version 2.1.10
Post by: Spikey on March 29, 2021, 01:34:35 PM
Thanks a lot man. I just had the wrong window open, got a bit lost in there. :) All sorted, thanks a lot!


EDIT: Question. It's been posited the AppleII GS version sends SysEx data at game launch. If this was correct, how would one go about extracting it?
Title: Re: WinAGI Version 2.1.10
Post by: AGKorson on March 30, 2021, 10:55:55 AM
That's a tough one. I know very little about Apple IIgs and how AGI actually works on that platform. I do have the binary files, and if I could find a decent dissassembler, I could probably figure it out. I did some searching, but haven't come across anything like IDAPro Free that would be useful. So unfortunately, I can't help much. I suspect there are some people out there who know more about Apple IIgs who might be able to answer that question for you.
Title: Re: WinAGI Version 2.1.10
Post by: Spikey on March 31, 2021, 10:53:44 AM
Thanks, man. Unfortunately the list of people who know about Sierra + Apple IIGS games is about as long as the people who actually know details about Sierra's MIDI implementation- something like less than 5, and they don't know each other. :P

Are you familiar with SCI games, where they utilise a 1.pat and other similar patch files for different MIDI devices? That's what I'm trying to find out here. I guess I don't even know if AGI is compatible with that. Although, the SND files that are in AGI Apple games seem very similar to the SCI SND files (although different enough to both SCI and AGI SND files that neither's convertors work).
Title: Re: WinAGI Version 2.1.10
Post by: AGKorson on April 02, 2021, 11:10:43 AM
Unfortunately, I know very little about SCI games. I spend enough time studying AGI, and have never had the time or interest to delve into the world of SCI.

As for converters, I'm not sure what exactly you mean. WinAGI is able to extract both MIDI and PCM sounds from IIgs games, which you can then export (i.e. convert) to the corresponding modern format. I admit that I don't have definitive answers as to exactly what each byte of data means in the sound headers, but using the assumptions I made, all IIgs sounds I've extracted sound legitimate. Here are my notes on both sound types, and how WinAGI handles them for doing the extraction:
Code: [Select]
  ' IIgs MIDI sounds:

  ' this function extracts the raw MIDI data from the IIgs sound
  ' and creates a new MIDI stream that is compatible with modern
  ' MIDI player format 

  ' length value gets calculated by counting total number of ticks
  ' assumption is 60 ticks per second; nothing to indicate that is
  ' not correct; all sounds 'sound' right, so we go with it
 
  ' the raw midi data embedded in the sound seems to play OK
  ' when using 'high-end' players (WinAmp as an example) but not
  ' Windows Media Player, or the midi API functions; even in
  ' WinAmp, the total sound length (ticks and seconds) doesn't
  ' calculate correctly, even though it plays;
  ' this seems to be due to the presence of 0FCh commands
  ' it looks like every sound resource has them; sometimes
  ' one 0FCh ends the file; other times there are a series of
  ' them that are followed by a set of 0Dyh and 0Byh commands
  ' that appear to reset all 16 channels
 
  ' eliminating the 0FCh command and everything that follows
  ' plays the sound correctly (I think)
 
  ' a common 'null' file is one with just four 0FCh codes, and
  ' nothing else, so ANY file starting with 0FCh is considered empty

  ' time values are supposed to be a 'delta' value
  ' but it appears that AGI used an absolute value; so if time
  ' is greater than 07Fh, it will cause a hiccup in modern midi
  ' players (we need to convert them to a valid delta time value)

  ' treat 0FCh as an end mark, even if found in time position
  ' 0F8h also appears to cause an end


  ' IIgs PCM (wav file) sounds:

  ' this function extracts the raw PCM data from a IIgs sound and
  ' adds a properly formatted WAV file header to it
   
  ' AGI header is 54 bytes for pcm, but its purpose is still mostly
  ' unknown; the total size is a word value at positon 08h; the rest of
  ' the header appears identical across resources, with exception of
  ' position 02h- it seems to vary from low thirties to upper 60s,
  ' maybe it's a volume thing?
 
  ' at position 06h is a word value of 02Ch = 44; this might be size
  ' of an internal header; there are 44 bytes of data, followed
  ' by 00-00 before the raw pcm data starts? (probably not - because at
  ' position 02Ah, there are six word values; 0C07Fh, 0236h, 0000h,
  ' 0C07Fh, 0236h, 0000h; this has the feel of two channel info,
  ' where both channels use the same data; 0C07Fh=49279; 0236h=566;
  ' 0C0h=192; 07F=127; 036h=54 not sure if any of these values
  ' are significant)
 
  ' at position 022h, there is a word value of 0203h = 8195; this
  ' might be the actual sample rate? it's close to 8000 (which was my
  ' original assumption) and it's really hard to tell the difference when either
  ' value is used for the exported sound
 
  ' all resources appear to end with a byte value of 0; not sure
  ' if it's necessary for wav files, but we keep it anyway

I figure it's a good idea to make this public information so others who are interested or are working on this can compare notes and (hopefully) improve on it.

Maybe this will be of use to you? Let me know if you become aware of any further information, especially if it affects how to correctly extract and convert the sounds for true replication. That way I can update WinAGI as well.
Title: Re: WinAGI Version 2.1.10
Post by: ZvikaZ on April 04, 2021, 09:22:26 AM
Thanks, man. Unfortunately the list of people who know about Sierra + Apple IIGS games is about as long as the people who actually know details about Sierra's MIDI implementation- something like less than 5, and they don't know each other. :P

I think you're too pessimistic...

Anyway, if you want information regarding Sierra's Apple IIgs games, I assume you've read http://www.agidev.com/articles/agispec/agispecs-9.html. Another, less known resource - https://wiki.scummvm.org/index.php?title=User:Buddha%5E/GSoC2007-ProjectDiary.
You might also want to just read ScummVM's implementation, it's not too long: https://github.com/scummvm/scummvm/blob/master/engines/agi/sound_2gs.cpp

Quote
It's been posited the AppleII GS version sends SysEx data at game launch.
Where have you seen that? I don't think it's accurate.

If it's true, you should be able to find it either in the game source files, or in the aforementioned ScummVM's 2gs 'driver'.
ScummVM doesn't have such code. I haven't searched the game source files, but I believe it's not there either. You can simply check it.

BTW, it won't help you with your 2gs query, but I have added a feature to ScummVM to dump MIDI commands, if using standard MIDI devices. Just run it with '--dump-midi'.