Author Topic: WinAGI Version 2.1.10  (Read 11012 times)

0 Members and 1 Guest are viewing this topic.

Offline AGKorson

WinAGI Version 2.1.10
« 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. 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...



Offline Collector

Re: WinAGI Version 2.1.10
« Reply #1 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
KQII Remake Pic

Offline AGKorson

Re: WinAGI Version 2.1.10
« Reply #2 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.

Offline ZvikaZ

Re: WinAGI Version 2.1.10
« Reply #3 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.

Offline Spikey

Re: WinAGI Version 2.1.10
« Reply #4 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?
Sierra Music Central
Keeping Sierra's music alive in the digital age!

Offline AGKorson

Re: WinAGI Version 2.1.10
« Reply #5 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.

Offline Spikey

Re: WinAGI Version 2.1.10
« Reply #6 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?
« Last Edit: March 29, 2021, 01:51:04 PM by Spikey »
Sierra Music Central
Keeping Sierra's music alive in the digital age!

Offline AGKorson

Re: WinAGI Version 2.1.10
« Reply #7 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.

Offline Spikey

Re: WinAGI Version 2.1.10
« Reply #8 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).
Sierra Music Central
Keeping Sierra's music alive in the digital age!

Offline AGKorson

Re: WinAGI Version 2.1.10
« Reply #9 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.

Offline ZvikaZ

Re: WinAGI Version 2.1.10
« Reply #10 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'.

Offline envoid

Re: WinAGI Version 2.1.10
« Reply #11 on: April 23, 2021, 09:45:54 PM »
I've been working on a project for the IIgs, thank you Andrew as you are making it much more possible, and might be able to offer some info.

I've heard a good disassembler for the IIgs is FlamingBirdDisassembler (link below) but i haven't used it.

From what I think I know and have learned is the MIDI stuff is legit MIDI stored in the AGI files. Or it looks amazingly similar. I don't think it has any headers so would be considered raw I guess. The sound hardware on the IIgs is the Ensoniq 5503 DOC which has 64K of its own memory. A Yamaha keyboard or several were made on this chip as well. The SierraStandard game file is the soundfont for the AGI MIDI and fills the DOC's memory. It consists of about 34 samples though I think it should be 32 since there are 32 channels on the 5503. They are all 8bit unsigned PCM waves that butt against each other except one that is thought of as a timer sequence, but this is still unconfirmed. I've been trying to get into the code to understand which sample/channel is which instrument but I'm not so good with that and have resorted to sample wave comparison (and that sucks). A friend in the Apple II community disassembled KQ1 and can share that assembler source if that is helpful.

I did notice some of the PCM sounds played in WinAGI are fast. However, I think this is a trick they did to conserve space as the DOC can play samples faster or slower. An example is Sound4 on Space Quest for the IIgs. If you play it 0.4x the 8khz speed it sounds like it does in the game. I have no idea where it is told to do this and was hoping it was in the PCM header, but apparently not.

The one person that had all this knowledge was Carlos Escobar of Sierra but he never responded when others had reached out to him in the past. Sadly he passed away a decade ago.

For a feature request, i would love to be able to import IIgs PCM and MIDI sounds now that we can export them.  ;D

Hope this helps in some way.

https://www.brutaldeluxe.fr/products/thirdparties/tfbd/index.html

edit: just noticed the code area had a scroll...
« Last Edit: April 23, 2021, 10:04:21 PM by envoid »

Offline brewton

Re: WinAGI Version 2.1.10
« Reply #12 on: November 01, 2021, 03:21:58 PM »
Wow. I remember the first release of WinAGI way back when. I'm glad to see that it's still alive, and that people are still using it!

Offline obscurenforeign

Re: WinAGI Version 2.1.10
« Reply #13 on: February 02, 2022, 05:18:30 PM »
I'm back to... report another bug I found. Or I think this is a bug. Sorry.

This makes no sense, but if you save a project in WinAGI and then open it again later, all comments will disappear from the source code editor... it looks more like decompiled code. (In fact, I think it is decompiling the logics instead of using the saved source.) The comments thankfully don't disappear from the file on disk, I can still see them in notepad or if I open the .lgc files directly in WinAGI. It also complains about not being able to find AGI.wag. (It seems the file's being named AGIV2.wag instead.)

Attached is some before and after screenshots of a newly created template game and the game after closing WinAGI and opening it again.

E: Ok! I think I have a partial understanding of what's going on here... I hope this makes things easier for somebody.

WinAGI appears to be looking for the source code in a src directory but is instead saving it in a Resources directory. I'm not sure why though... Copying the lgc files from Resources to src makes them appear in the editor mostly-normally, but it'll think every logic needs to be recompiled.
« Last Edit: February 02, 2022, 05:29:52 PM by obscurenforeign »

Offline AGKorson

Re: WinAGI Version 2.1.10
« Reply #14 on: February 02, 2022, 10:07:50 PM »
Can you check which version you are using? If it's 2.1.10, I believe there was a bug with the 'New from Template' function. I thought I fixed it for 2.1.12. (The current dev version I have definitely fixes this. But I might be misremembering when I made the fix.)

What's happening is that the game file name and resource directory name aren't being properly renamed after they get copied from the template. The template game filename is 'AGIV2.wag', and the template resource directory is named 'Resources'. Which matches what you are describing. The wag file does have your new resource directory name (src), but since the copied directory didn't get renamed to 'src', when you re-open the game, it will create a directory named 'src', and then decompile the logics. Your solution is a good way to fix the problem.

And don't worry about the files being marked as needing to be recompiled; it's because once the decompiled logics are created, the CRC check gets reset, so replacing them with the original source files creates a CRC mismatch. It's no big deal- just do a game recompile and the CRC values will be restored.

Another easy workaround to this problem when you want to create a new game is to use file explorer to make a copy of the template into your desired new location, then edit the game properties, including the resource directory name the first time you open it.

The current dev version I have fixes a bunch of other bugs, mostly very minor stuff. I should be releasing another minor upgrade soon. Sorry for the inconvenience.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.081 seconds with 23 queries.