The -a option can autoload from a resource in a JAR.
Chris Pressey
8 years ago
254 | 254 | |
255 | 255 | private boolean readDisk(String name) { |
256 | 256 | System.out.println("READING FROM: " + name); |
257 | ||
257 | 258 | if ((name.toLowerCase()).endsWith(".d64")) |
258 | 259 | reader.readDiskFromFile(name); |
259 | 260 | else if ((name.toLowerCase()).endsWith(".t64")) |
280 | 281 | return false; |
281 | 282 | } |
282 | 283 | |
284 | private boolean readDisk(URL url) { | |
285 | String name = url.toString(); | |
286 | ||
287 | System.out.println("READING FROM URL: " + name); | |
288 | ||
289 | if ((name.toLowerCase()).endsWith(".d64")) | |
290 | reader.readDiskFromURL(url); | |
291 | else if ((name.toLowerCase()).endsWith(".t64")) | |
292 | reader.readTapeFromURL(url); | |
293 | else if (name.toLowerCase().endsWith(".prg") || | |
294 | name.toLowerCase().endsWith(".p00")) { | |
295 | cpu.reset(); | |
296 | try { | |
297 | Thread.sleep(10); | |
298 | }catch (Exception e2) { | |
299 | System.out.println("Exception while sleeping..."); | |
300 | } | |
301 | while(!scr.ready()) { | |
302 | try { | |
303 | Thread.sleep(100); | |
304 | }catch (Exception e2) { | |
305 | System.out.println("Exception while sleeping..."); | |
306 | } | |
307 | } | |
308 | reader.readPGM(url, -1); | |
309 | cpu.runBasic(); | |
310 | return true; | |
311 | } | |
312 | return false; | |
313 | } | |
314 | ||
283 | 315 | private void setFull(boolean full) { |
284 | 316 | // JWindow jw = full ? C64Scr : null; |
285 | 317 | // java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(). |
306 | 338 | public void run() { |
307 | 339 | waitForKernal(); |
308 | 340 | System.out.println("Kernal READY!"); |
309 | readDisk(filename); | |
341 | URL url = getClass().getResource(filename); | |
342 | if (url != null) { | |
343 | readDisk(url); | |
344 | } else { | |
345 | readDisk(filename); | |
346 | } | |
310 | 347 | } |
311 | 348 | }); |
312 | 349 | t.start(); |