KoLMafia on iPhone..

matt.chugg

Moderator
This isn't actually a question of how do I, more a question of: should I give up now?!

Inevitable questions:

Yes, its Jailbroken, this would be impossible any other way.
No, its not working enough to actually play the game
No this is not a daily build of kolmafia, but the changes I made were very minor.

EDIT: see last post
 

Attachments

  • photo.PNG
    photo.PNG
    160.1 KB · Views: 207
Last edited:

matt.chugg

Moderator
I must admit, I'm curious. What's your exception?

It looks like something gui related is happening, possibly the preferences frame attempting to show itself because there it couldn't find the preferences file??

sorry for screeny, no cut copy paste support on terminal,
 

Attachments

  • IMG_0870.PNG
    IMG_0870.PNG
    165.1 KB · Views: 137

matt.chugg

Moderator
New jailbreak for IOS6 on iPhone 5 has got me back on this project AND I'm getting closer, I've had to make a few modifications and recompile a few times, but its all good fun!

Current state: LOGGED IN! :)


all changes so far have been GUI related:

KoLConstants.java

line 79: Changed to
public static final Font DEFAULT_FONT = new Font("sansserif", Font.BOLD, 32);

pretty sure I don't need this in headless, but it is used so to prevent compilation errors I put in something random!


line 111: deleted: (I couldn't find any reference to this being used!)
public static final JLabel BLANK_LABEL = new JLabel();

KoLmafia.java

line 491: deleted: (obviously I don't need this!)
OSXAdapter.setDockIconImage( JComponentUtilities.getImage( "limeglass.gif" ).getImage() );

i've also modified printline in requestlogger to just send to system.out

Does anyone else run in headless mode? I'd have thought they would cause issues for them too!


photo (1).PNG

current next step:

Code:
java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:367)
   at jamvm.java.lang.JarLauncher.main(JarLauncher.java:50)
Caused by: java.lang.ExceptionInInitializerError
   at net.sourceforge.kolmafia.session.StoreManager.clearCache(StoreManager.java:105)
   at net.sourceforge.kolmafia.KoLCharacter.reset(KoLCharacter.java:693)
   at net.sourceforge.kolmafia.KoLCharacter.reset(KoLCharacter.java:578)
   at net.sourceforge.kolmafia.KoLCharacter.reset(KoLCharacter.java:573)
   at net.sourceforge.kolmafia.session.LoginManager.initialize(LoginManager.java:162)
   at net.sourceforge.kolmafia.session.LoginManager.doLogin(LoginManager.java:88)
   at net.sourceforge.kolmafia.session.LoginManager.login(LoginManager.java:72)
   at net.sourceforge.kolmafia.request.LoginRequest.processLoginRequest(LoginRequest.java:439)
   at net.sourceforge.kolmafia.request.GenericRequest.handleServerRedirect(GenericRequest.java:1893)
   at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1788)
   at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1453)
   at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1346)
   at net.sourceforge.kolmafia.request.LoginRequest.run(LoginRequest.java:261)
   at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:222)
   at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:185)
   at net.sourceforge.kolmafia.KoLmafiaCLI.attemptLogin(KoLmafiaCLI.java:156)
   at net.sourceforge.kolmafia.KoLmafia.main(KoLmafia.java:559)
   at java.lang.reflect.Method.invokeNative(Native Method)
   ...2 more
Caused by: java.awt.HeadlessException
   at java.awt.dnd.DropTarget.<init>(DropTarget.java:222)
   at java.awt.dnd.DropTarget.<init>(DropTarget.java:176)
   at javax.swing.JComponent.<init>(JComponent.java:789)
   at javax.swing.JLabel.<init>(JLabel.java:491)
   at javax.swing.JLabel.<init>(JLabel.java:478)
   at net.java.dev.spellcast.utilities.JComponentUtilities.createLabel(JComponentUtilities.java:127)
   at net.sourceforge.kolmafia.swingui.StoreManageFrame.<clinit>(StoreManageFrame.java:119)
   at net.sourceforge.kolmafia.session.StoreManager.clearCache(StoreManager.java:105)
   ...19 more
 

roippi

Developer
Since I now own an iphone 5, this does interest me, though I am leery of jailbreaking it. That's mostly a position of ignorance, I know little to nothing about it.

From an academic standpoint I am interested in making headless work properly. The things that you were forced to patch out should be fixed, though probably in a less hackish manner.
 

matt.chugg

Moderator
I can't obviously recommend jail breaking because that would be bad, but in my experience of jailbreaking with several phones and several versions of IOS now, it's pretty difficult to "brick" the phone, worst case for me has been having to plug into iTunes and restore, and that was more my fault than the jailbreak. Pm me if you want to chat on that!

My changes are very hackish! Looking back, I replaced a default font with a 32 pt/pix/em (units?) font and bold as well, I've mostly been interested in just seeing if this is worth doing, my main aim is to be able to login and execute a few daily scripts if I can't get to a computer. Since requests don't load images, styles or js, it should even work relatively well on 3G and GSM!

Once I know this works I will
Probably start putting some
Patches together to fix headless mode properly as you said, based on km receiving the --CLI parameter I think, or maybe another parameter for really headless



If you don't want to jailbreak, I'm happy to do the testing! Will be next week before I do any more, but for reference im using JamVM and you need to use java -X to allocate more memory, otherwise you get a memory fail
Loading modifiers.txt I went with 200m and that works fine for me for now. Also OpenSSH is awesome, and you'll need mobile terminal, and sbssettings is a must for any jailbreak!
 

matt.chugg

Moderator
Storemanage.java
This fixes the above one:

Code:
                if(StaticEntity.isGUIRequired())
                {
                    StoreManageFrame.cancelTableEditing();
                }

Seems really slow make http requests, maybe not using wifi for some reason, i'll look into this, the login procedure takes a couple of minutes,

Full login and session refresh working now, need to look at the command processor in KoLmafiaCLI.java next

Code:
KoLmafia v15.8
Released on December 9, 2012

Currently Running on Darwin
Local Directory is /private/var/mobile/.kolmafia
Using Java 1.5.0

Unknown item found: charrrm

username: 
Installing default certificate validation...
Validating login server (www.kingdomofloathing.com)...
772 players online.
Sending login request...
Unknown item found: Factoid
Initializing session for mskc...
Refreshing session data...
Synchronizing moon data...
Loading character status...
Adjusting familiar weight by 30 pounds
Retrieving character data...
Refreshing closet...
Examining consumables in closet...
Examining equipment in closet...
Examining miscellaneous items in closet...
Updating inventory...
Retrieving quest data...
Retrieving familiar data...
Familiar data retrieved.
Retrieving campground data...
Refreshing storage...
Examining meat in storage...
Examining consumables in storage...
Examining equipment in storage...
Examining miscellaneous items in storage...
Session data refreshed.
Visiting Crimbo Tree in clan VIP lounge
6 days until St. Sneaky Pete's Day, Mysticism bonus today (not tomorrow).

 > Exception in thread "Thread-2" java.awt.HeadlessException
   at gnu.java.awt.peer.headless.HeadlessToolkit.getSystemEventQueueImpl(HeadlessToolkit.java:320)
   at java.awt.Toolkit.getSystemEventQueue(Toolkit.java:970)
   at java.awt.EventQueue.isDispatchThread(EventQueue.java:458)
   at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1101)
   at net.sourceforge.kolmafia.utilities.PauseObject.pause(PauseObject.java:74)
   at net.sourceforge.kolmafia.KoLmafiaCLI.getNextLine(KoLmafiaCLI.java:269)
   at net.sourceforge.kolmafia.KoLmafiaCLI$CommandProcessorThread.run(KoLmafiaCLI.java:227)
 
Top