Oni Central Forum

A forum for the Oni community

You are not logged in.

#101 01/22/08 14:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

Well, you guys are over my head now, so I'll just wait for some file to be posted so I can stick it in a folder somewhere smile

Back on topic, seeing as geyser refuses to spend 30 seconds editing his .sh files in xedition, I suppose we can have the AEI send an Enter key keystroke to the Terminal to get past the echo/read part.  I've already sent keystrokes to the Terminal with AppleScript in other scripts.  I can post some code tomorrow that does that.

As for the colon/slash bug, I have to really sit and think about that before I have an answer, but I suppose I can always just write the POSIX path function myself (it's pretty frickin' simple seeing as it refuses to even escape any characters).  Then, it should work in any version of OS X.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#102 01/22/08 14:01

geyser
Member
From: beyond the veil
Registered: 01/14/07
Website

Re: Mac programming

"seeing as geyser refuses to spend 30 seconds editing his .sh files in xedition"
I just don't want the installation scripts to rely on AEI. Surely you understand.


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#103 01/22/08 15:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

EdT: Yeah, I got colons instead of slashes when I ran AE Tools. I've got 10.3.9. I just ran big_zeal directly via Terminal instead. As for my knowledge of specific programming languages, it's pretty much nonexistent, but I'm a quick learner, so pick me a language and I'll get started.


Work in progress...

Offline

#104 01/22/08 15:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

geyser wrote:

Surely you understand.

Yeah, I do, geyser.  Sorry, I was just being snarky.

U479 wrote:

so pick me a language and I'll get started.

COBOL.


Just kidding.  But that would be cool.  You could ensure that the Edition is Y2K-compatible.

Thanks for the confirmation on the colon bug (eww, colon bug!).  I think I can take care of it in the next day or two.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#105 01/22/08 17:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

Iritscen: There is no need to worry about the echo thing. I will remove them in the version I have posted on my website.  I have that file's URL linked in AE Tools.

I did it for simplicity sake, if the URL for the original Edition or Mono frameworks changes, then AE Tools is broken.  But if I keep the files on my server, then the URL for them will not change.  I just have to make sure I post the latest ones.

Offline

#106 01/22/08 22:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

Well, you guys are over my head now, so I'll just wait for some file to be posted so I can stick it in a folder somewhere

OK, put the 3 files into the level0 folder and recompile the level. Have fun!

Offline

#107 01/23/08 09:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

smile Thanks, will have to try it along with the Edition Preview tonight.  Last night, as I sat exhausted after work, I thought about our two outstanding problems, the echo/read lines stopping progress, and the colon bug (ew!) and came to these conclusions:

- It's good that you have provided a place for the files the AEI needs so that we can count on the link to remain valid. But if we incorporate some fairly simple code into the Installer, you won't need to manually edit the Edition files that geyser provides.

If you have a script that requires the enter key to be pressed, such as:

#! /bin/sh
echo "Press Enter."
read
echo "Done."

then use the attached script's code to advance past the read line.  Notice that the text in quotes is literally a return character.  Don't let the compiler or whatever you type AppleScript in automatically tab in when you hit Enter while typing code like this, because the tab characters will also get passed to the Terminal.  Make sure that only a return is between the quotes.

- You already have the code you need to fix the colon bug.  You can take my function that escapes space characters, make_path_UNIX_safe, and make it replace slashes with colons. This code can replace the POSIX path function which seems not to work under pre-10.4 systems.

- You should probably use the "quoted form" statement as Apple recommends, to avoid trouble with unusual path names that have quote-marks, etc.  This statement should also fix the spaces issue, thus removing the need for my function that escapes space characters.  So you can repurpose that function to simply convert colons to slashes.

Sorry to leave all this coding to you, but I'm swamped right now.  Probably in a week I'll be in better shape.  I'll be glad to help troubleshoot if you have trouble implementing any of the above.  Anyway, it's not like there's as much of a rush now, with the pushed-back deadline for the Edition.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#108 01/23/08 18:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479 said on AE preview thread:

You talked about using the POSIX path of function earlier, so why not use that?

We are:

tell application "Finder" to get POSIX path of (container of (path to me) as text)
set base_path to quoted form of POSIX path of result
set safe_path to my make_path_UNIX_safe(base_path, safe_path)

However, in OSX 10.3 we are getting colons separating the directories not slashes as in 10.4 and 10.5.  That's why AE Tools didn't work for you.

Offline

#109 01/23/08 18:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

Oh. Dude. In what you just quoted, you get the POSIX path of the POSIX path. Why? v_V That's your problem.

Get rid of the useless "make_path_UNIX_safe" code, everywhere, and replace that part you quoted there with

tell application "Finder" to get POSIX path of (container of (path to me) as text)
set base_path to quoted form of result


Work in progress...

Offline

#110 01/23/08 19:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479: You're a genius! Thanks.

Will post an updated version of AE tools for you to test, later.

EDIT: Do you still have the installer for mono?  I noticed that the current version is for 10.4 and up.
I installed the latest version on my iBook which has 10.3.9, but OniSplit doesn't work.
I get an error message:
Unhandled Exception: System.ExecutionEngineException: SIGILL

Last edited by EdT (01/23/08 19:01)

Offline

#111 01/23/08 19:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

Already updated that on mine, when I made the post, but thanks. wink Also added the lines I've mentioned before about copying intro.bik and outro.bik.

Now I just need to figure out where the main menu pic is saved, so that I can also have it fix Konoko's damned beard. (-.-)

Last edited by Ultimatum479 (01/23/08 19:01)


Work in progress...

Offline

#112 01/23/08 19:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479: Did you do the Install Edition or Update Edition?  If you do the Install Edition then the old versions will be removed and a fresh install will be made.  That will get rid of the bearded lady...

By the way did you see my question about your mono install in my previous post?

Offline

#113 01/23/08 19:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

Installed.

No, I didn't. Yeah, I had to find the 10.3 one. Here ya go.


Work in progress...

Offline

#114 01/23/08 22:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479: Thanks for the help with AE tools.

This version should be compatible with OSX 10.3 to 10.5
I added a button to d/l the 10.3 version of Mono.

Offline

#115 01/24/08 08:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

Or you could let AE Tools decide for the person just in case they download the wrong one. ^_^

set version to (do shell script "/usr/bin/uname -r")
if (version > 8) then
    (display dialog "10.4")
end if
if (version < 8) then
    (display dialog "pre-10.4")
end if

Switch the "display dialog" parts, obviously, for the action it would take depending on the result. For 10.4 or higher, you download the new Mono; for pre-10.4, you download the one I sent ya.

EDIT: More details...

Switching

if name of theObject = "mono" then
        set dialogReply to «event panSdlog» "This will download the Mono Framework for OSX 10.4 and up. " given «class btns»:{"Download Mono", "Cancel"}, «class dflt»:1
        set _URL to "http://edt.oni2.net/AE/MonoFramework.dmg"
        if button returned of dialogReply is "Download Mono" then
            open location _URL
        end if
    end if
   
    if name of theObject = "mono103" then
        set dialogReply to «event panSdlog» "This will download the Mono Framework for OSX 10.3" given «class btns»:{"Download Mono", "Cancel"}, «class dflt»:1
        set _URL to "http://edt.oni2.net/AE/MonoFramework10.3.dmg"
        if button returned of dialogReply is "Download Mono" then
            open location _URL
        end if
    end if

for

if name of theObject = "mono" then
        set dialogReply to «event panSdlog» "This will download the Mono Framework for your operating system. " given «class btns»:{"Download Mono", "Cancel"}, «class dflt»:1
        set version to (do shell script "/usr/bin/uname -r")
        if (version > 8) then
            (set _URL to "http://edt.oni2.net/AE/MonoFramework.dmg")
        end if
        if (version < 8) then
            (set _URL to "http://edt.oni2.net/AE/MonoFramework10.3.dmg")
        end if
        if button returned of dialogReply is "Download Mono" then
            open location _URL
        end if
    end if

should work, at least within the script. You'll have to change the buttons in the app back to how they were, and I dunno how to do that.

Last edited by Ultimatum479 (01/24/08 09:01)


Work in progress...

Offline

#116 01/24/08 10:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

Thanks for the help, U479.  I think Ed missed a couple of my earlier suggestions (I already suggested using "quoted form" in lieu of my old make_path_UNIX_safe code, and I didn't intend for POSIX path to be used twice), but your help in fixing the code is appreciated.

I tried the Extract TXMP option last night and got this in the Terminal:

cd /Games/Oni/edition/install; mono onisplit.exe -extract:tga ../../TXMPfiles ../../GameDataFolder/level0_Final.dat
System.IO.IOException: Cannot create ../../GameDataFolder/level0_Final.dat because a file with the same name already exists.
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] 
  at Oni.Files.Program.ExtractTextures (System.String[] args) [0x00000] 
  at Oni.Files.Program.Main (System.String[] args) [0x00000]

I don't know how to use onisplit, but I figured, maybe the syntax is backwards and you're supposed to give the source first and destination second like in Unix, so I entered this:

cd /Games/Oni/edition/install; mono onisplit.exe -extract:tga ../../GameDataFolder/level0_Final.dat ../../TXMPfiles

And it generated a folder that looked like this:

TXMPExportingBug.jpg

Opening any file pretty much shows this:

TXMPViewingBug.jpg

Was I not supposed to use onisplit that way?  What's going on?

Last edited by Iritscen (07/22/17 13:07)


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#117 01/24/08 11:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479: Thanks again.  I'll update AE Tools. I'll also post the actual xCode project so you and Iritiscen and others can make it better. (Remember AE Tools is my first attempt at using xCode and Applescript to make a program, so it will be rough at the edges)

OT: Take a look at this screen recording program, it should work in 10.3. and if you get it through macZOT http://www.maczot.com/ today, its only $9.98

Iritiscen: If you downloaded the latest version of Edition through AE Tools, you would have gotten an updated version of OniSplit, which fixes that bug you see.  I had been in contact with Neo about it and he came up with the fix just for us Mac Users smile

I'm really glad to have you guys on board at OCF.

Hmmm... people in Konoko's time are not as advanced as we thought, look at what they're still using:
attachment.php?item=200&download=1

lol

Last edited by EdT (01/24/08 11:01)

Offline

#118 01/24/08 11:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

Ah, I see, I'll download the latest edition then. Edit: Err, where is that again?  I can't run the AETools on this PC so I can't click the button... what's the link to your page with the edition?

people in Konoko's time are not as advanced as we thought, look at what they're still using

That would be the holographic micro-bubble crystal laser storage unit, which holds many exabytes of data.

...Any resemblance to something familiar is purely coincidental.

Last edited by Iritscen (01/24/08 12:01)


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#119 01/24/08 13:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

Just look at this directory, it has a listing of all the AE related stuff.
http://edt.oni2.net/AE/

That would be the holographic micro-bubble crystal laser storage unit, which holds many exabytes of data.

I see... it must be one of those retro things... smile

EDIT: The xCode project files for AE Tools can be found here:
http://edt.oni2.net/AE/AETools_xCode.zip

If there areas that you want to improve: interface, code, etc, please do so.

Last edited by EdT (01/24/08 14:01)

Offline

#120 01/24/08 14:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

Thanks, I'll take a look.  By the way, you don't link to that stuff on your main page.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#121 01/24/08 14:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

I know... its on the to do list.

Offline

#122 01/24/08 15:01

Ultimatum479
Member
Registered: 08/29/07

Re: Mac programming

I've actually never used Xcode myself except to play around in C a bit. I'll check it out, though.

EDIT: Glanced at the AppleScript comment lines...Eww. Don't do that. You gave _me_ credit for it and not yourself. (-.-) You and Iritscen did all the work; I just pointed out the fact that you called "POSIX path of" twice, which takes careful observation rather than actual coding ability to notice. (Well, and the lil' OS X version number thing, but that was pretty simple.) I shouldn't be on that. v_V

Last edited by Ultimatum479 (01/24/08 17:01)


Work in progress...

Offline

#123 01/25/08 12:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

U479: I wanted to give credit where credit it due, your assistance was valuable.  I would never have figured out that OSX version code.  So if you see areas that can be improved or features added, please do so.

On another note, as mentioned on the TXPM thread, Neo has released a new version of OniSplit that can import textures.
http://wiki.oni2.net/User_talk:Neo  I will test it out later today.

Now wouldn't it be cool to add that to AE Tools?  We would need to add a file browsing feature. Once the texture is selected run the commands to convert it an .oni file.  Move that file to the level0 folder. Of course back up the original, then recompile level0... simple right??? smile

With such a tool, it would be easier to update and improve the textures in the game.

Lastly, any comments or bugs with OniSplit please post it on Neo's page.

Offline

#124 01/25/08 13:01

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Mac programming

I agree that U479 certainly should be mentioned in the script if I'm mentioned.  I mean, credit isn't about measuring how much someone did in relation to the others.  Even if you have a single chat with someone and it tells you something or leads you to a solution that's part of a much bigger project, they are still supposed to be credited.  I'm credited on a piece of software that I haven't written a line of code for.

I like your idea, EdT.  I don't want the AETools to become a catch-all that gets bloated with random features, but a TXMP import button would go well with the export button.  Perhaps "replace" instead of import, as the Tools should make sure that the original .oni file from the level0 folder is backed up somewhere.  Perhaps when AETools exports all TXMPs, it makes a folder inside "TXMPFiles" called "Backup" and a folder called "Modified".  Then, when you click "Import" (or "Replace"), it looks for any TXMPs in the Modified folder, copies the file in level0's folder with that name into the Backup folder, and copies the modded versions to the level0 folder.

If you then remove some files from the Modified folder, and click "Import" some time in the future, it deletes the files from the level0 folder that are missing from the Modified folder and restores the files in Backup to level0.  In other words, like a sync action with a backup feature.  I have done similar code before using rsync and AppleScript.

I don't want to make it too complicated, but actually this would handle the whole process automatically for the user and take the burden of worrying about accidentally replacing something off their shoulders.  The other day, I accidentally deleted my version of your good vs. evil script when I installed the latest Edition.  I had to get it back by downloading it off my post on this forum!  I am always worrying about backing up .oni files before overwriting them with the modded versions, and this would at least handle the TXMP replacement process in a reversible fashion.  Very handy when testing a newly-changed TXMP.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#125 01/25/08 13:01

EdT
Moderator
From: Los Angeles, CA
Registered: 01/13/07
Website

Re: Mac programming

In other words, like a sync action with a backup feature.  I have done similar code before using rsync and AppleScript.

Good, I'll leave that piece of coding up to you! smile

The other day, I accidentally deleted my version of your good vs. evil script when I installed the latest Edition.

I've done that countless of times (That is losing different mods and scripts)

Perhaps, in the future, AE Tools can have a separate window for advanced users or for OniSplit commands.
As Neo continues to work on it, there will be more features that could use a GUI.

EDIT: First test of importing TXMP does not work on PPC Mac OSX 10.4.11.
I get the error message:

System.IndexOutOfRangeException: Array index is out of range.
  at Oni.Files.Imaging.Color.WriteBgra32 (Color color, System.Byte[] data, Int32 index) [0x00000] 
  at Oni.Files.Imaging.Surface.SetPixel (Int32 x, Int32 y, Color color) [0x00000] 
  at Oni.Files.Imaging.TgaReader.LoadRleTrueColor (Oni.Files.Imaging.TgaHeader header, System.IO.BinaryReader reader) [0x00000] 
  at Oni.Files.Imaging.TgaReader.Read (System.String filePath) [0x00000] 
  at Oni.Files.Imaging.TextureImporter.LoadImage (System.String filePath) [0x00000] 
  at Oni.Files.Imaging.TextureImporter.Import (System.String filePath, System.String outputDirPath) [0x00000] 
  at Oni.Files.Program.CreateTexture (System.String[] args) [0x00000] 
  at Oni.Files.Program.Main (System.String[] args) [0x00000]

Its already been reported to Neo.

Last edited by EdT (01/25/08 14:01)

Offline

Board footer

Powered by FluxBB