Exec() fails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gangreen
    New Member
    • Feb 2008
    • 98

    Exec() fails

    Hi, I was asked to create an anticheatprogra m for a game of the medal of honor series. The code i post is a thread that should start medal of honor and read it's STDOUT.
    But, when i execute this script, medal of honor tries to start, but fails. A windows message pops up; Launch MFC application does not work anymore...you can search online for a solution, blahblah..

    However when I use the executable of medal of honor to start it it works.
    Any suggestions?

    Code:
    package antiCheat;
    
    import java.io.*;
    
    public class MohReader extends Thread {
    	public static String path = "C:\\Program Files\\EA Games\\Medal of Honor Allied Assault Breakthrough Demo\\moh_breakthrough_demo.exe";
    	@Override
    	public void run() {
    		loadMoh();
    	}
    	
    	private static void loadMoh() {
    		try {
    			String line;
    			Process p = Runtime.getRuntime().exec(path);
    			BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    			while ((line = input.readLine()) != null)
    				System.out.println(line);
    			input.close();
    		} catch (Exception err){
    			System.err.println(err.getMessage());
    		}
    	}
    }
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Those spaces in the path name are the killers: the exec() method uses them
    to separate the argument(s) from the path. Use double quotes around the path
    component(s) (and escape them in String literals).

    kind regards,

    Jos

    Comment

    • Gangreen
      New Member
      • Feb 2008
      • 98

      #3
      Originally posted by JosAH
      Those spaces in the path name are the killers: the exec() method uses them
      to separate the argument(s) from the path. Use double quotes around the path
      component(s) (and escape them in String literals).

      kind regards,

      Jos
      I'll try that, but I have to say that it finds the executable like this, when using the spaces. The problem is the executable craches when started from this javaprogram.

      Comment

      • Gangreen
        New Member
        • Feb 2008
        • 98

        #4
        I have printed out the maximum memory of the runtime using:

        Runtime.getRunt ime().maxMemory ();

        It appears to be a bit over 7 MB, which obviously is way too less for medal of honor. Which probably is the reason that it crashes. Any way of setting this to a high value?

        EDIT: upon more research this reply appears to be nonsense, forget it.
        But still have not found the reason why medal of honor crashes when started from this program.

        Comment

        • sukatoa
          Contributor
          • Nov 2007
          • 539

          #5
          Originally posted by Gangreen
          I have printed out the maximum memory of the runtime using:

          Runtime.getRunt ime().maxMemory ();

          It appears to be a bit over 7 MB, which obviously is way too less for medal of honor. Which probably is the reason that it crashes. Any way of setting this to a high value?

          EDIT: upon more research this reply appears to be nonsense, forget it.
          But still have not found the reason why medal of honor crashes when started from this program.
          Try to create a batch file that will invoke your "medal of honor" program...
          Test it if the batch file could invoke it properly...

          If satisfied, try to invoke that batch file using the Runtime.getRunt ime().exec(patt ern);.....

          Update us,
          sukatoa

          Comment

          • Gangreen
            New Member
            • Feb 2008
            • 98

            #6
            That does work to start medal of honor (with batch).
            But now, I don't see a way of getting the STDOUT of moh in java...

            Comment

            • sukatoa
              Contributor
              • Nov 2007
              • 539

              #7
              Originally posted by Gangreen
              That does work to start medal of honor (with batch).
              But now, I don't see a way of getting the STDOUT of moh in java...
              That's the problem now....

              Using exec() has a disadvantage... .

              I can't remember the url shown by Jos to me about Runtime....

              Try to read JavaCompiler class, i have read it, 5 months ago, but im not sure,

              it could read the outputStream of a program(externa l tools .exe).... and that program must be invoked by that class to be able to monitor that output stream... im not sure....

              sukatoa...

              Comment

              • sukatoa
                Contributor
                • Nov 2007
                • 539

                #8
                Originally posted by Gangreen
                That does work to start medal of honor (with batch).
                But now, I don't see a way of getting the STDOUT of moh in java...

                I am curious about STDOUT of MOH....

                can you post some output of STDOUT?

                update us,
                sukatoa

                Comment

                • Gangreen
                  New Member
                  • Feb 2008
                  • 98

                  #9
                  Originally posted by sukatoa
                  I am curious about STDOUT of MOH....

                  can you post some output of STDOUT?

                  update us,
                  sukatoa
                  I'm not sure this really is seen as STDOUT, but it is written in the console of moh.

                  Code:
                  --- Common Initialization ---
                  Medal of Honor: Breakthrough Demo 0.00 win-x86 Sep  3 2003
                  ----- FS_Startup -----
                  Current search path:
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak2.pk3 (921 files)
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak1.pk3 (6536 files)
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo/demott
                  
                  ----------------------
                  7519 files in pk3 files
                  
                  Running in restricted demo mode.
                  
                  ----- FS_Startup -----
                  Current search path:
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak2.pk3 (921 files)
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak1.pk3 (6536 files)
                  C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo/demott
                  
                  ----------------------
                  15038 files in pk3 files
                  execing default.cfg
                  execing buildver.cfg
                  execing menu.cfg
                  execing newconfig.cfg
                  execing localize.cfg
                  Config: unnamedsoldier.cfg
                  execing configs/unnamedsoldier.cfg
                  couldn't exec localized.cfg
                  execing autoexec.cfg
                  Unknown command "fov"
                  couldn't exec custom.cfg
                  ...detecting CPU, found Intel Pentium III
                  
                  ------- Input Initialization -------
                  Initializing DirectInput...
                  Couldn't set DI coop level
                  Falling back to Win32 mouse support...
                  ------- Input Initialization Complete ------- 54
                  You are now setup for medium mode.
                  ----- Client Initialization -----
                  ----- Initializing Renderer ----
                  ----- R_Init -----
                  Initializing OpenGL subsystem
                  ...initializing QGL
                  ...calling LoadLibrary( 'C:\Windows\system32\opengl32.dll' ): succeeded
                  ...setting mode -1: 1920 1200 FS
                  ...using colorsbits of 32
                  ...calling CDS: ok
                  ...registered window class
                  ...created window@0,0 (1920x1200)
                  Initializing OpenGL driver
                  ...getting DC: succeeded
                  ...GLW_ChoosePFD( 32, 32, 0 )
                  ...113 PFDs found
                  ...hardware acceleration found
                  ...PIXELFORMAT 7 selected
                  ...creating GL context: succeeded
                  ...making context current: succeeded
                  Initializing OpenGL extensions
                  ...using GL_EXT_texture_compression_s3tc
                  ...using GL_ARB_texture_compression
                  ...GL_EXT_texture_env_add not found
                  ...using WGL_EXT_swap_control
                  ...using GL_ARB_multitexture
                  ...ignoring GL_EXT_texture_env_combine
                  ...using GL_EXT_compiled_vertex_array
                  ...WGL_3DFX_gamma_control not found
                  ...using GL_DOT3_RGBA_EXT
                  
                  GL_VENDOR: NVIDIA Corporation
                  GL_RENDERER: GeForce 8600M GT/PCI/SSE2
                  GL_VERSION: 2.1.1
                  GL_EXTENSIONS: GL_ARB_depth_texture
                  GL_EXTENSIONS: GL_ARB_fragment_program
                  GL_EXTENSIONS: GL_ARB_imaging
                  GL_EXTENSIONS: GL_ARB_multisample
                  GL_EXTENSIONS: GL_ARB_multitexture
                  GL_EXTENSIONS: GL_ARB_point_parameters
                  GL_EXTENSIONS: GL_ARB_shadow
                  GL_EXTENSIONS: GL_ARB_texture_border_clamp
                  GL_EXTENSIONS: GL_ARB_texture_compression
                  GL_EXTENSIONS: GL_ARB_texture_cube_map
                  GL_EXTENSIONS: GL_ARB_texture_env_add
                  GL_EXTENSIONS: GL_ARB_texture_env_combine
                  GL_EXTENSIONS: GL_ARB_texture_env_dot3
                  GL_EXTENSIONS: GL_ARB_texture_mirrored_repeat
                  GL_EXTENSIONS: GL_ARB_transpose_matrix
                  GL_EXTENSIONS: GL_ARB_vertex_buffer_object
                  GL_EXTENSIONS: GL_ARB_vertex_program
                  GL_EXTENSIONS: GL_ARB_window_pos
                  GL_EXTENSIONS: GL_S3_s3tc
                  GL_EXTENSIONS: GL_EXT_abgr
                  GL_EXTENSIONS: GL_EXT_bgra
                  GL_EXTENSIONS: GL_EXT_blend_color
                  GL_EXTENSIONS: GL_EXT_blend_func_separate
                  GL_EXTENSIONS: GL_EXT_blend_minmax
                  GL_EXTENSIONS: GL_EXT_blend_subtract
                  GL_EXTENSIONS: GL_EXT_compiled_vertex_array
                  GL_EXTENSIONS: GL_EXT_draw_range_elements
                  GL_EXTENSIONS: GL_EXT_fog_coord
                  GL_EXTENSIONS: GL_EXT_multi_draw_arrays
                  GL_EXTENSIONS: GL_EXT_packed_pixels
                  GL_EXTENSIONS: GL_EXT_point_parameters
                  GL_EXTENSIONS: GL_EXT_rescale_normal
                  GL_EXTENSIONS: GL_EXT_secondary_color
                  GL_EXTENSIONS: GL_EXT_separate_specular_color
                  GL_EXTENSIONS: GL_EXT_shadow_funcs
                  GL_EXTENSIONS: GL_EXT_stencil_two_side
                  GL_EXTENSIONS: GL_EXT_stencil_wrap
                  GL_EXTENSIONS: GL_EXT_texture3D
                  GL_EXTENSIONS: GL_EXT_texture_compression_s3tc
                  GL_EXTENSIONS: GL_EXT_texture_cube_map
                  GL_EXTENSIONS: GL_EXT_texture_edge_clamp
                  GL_EXTENSIONS: GL_EXT_texture_env_combine
                  GL_EXTENSIONS: GL_EXT_texture_env_dot3
                  GL_EXTENSIONS: GL_EXT_texture_filter_anisotropic
                  GL_EXTENSIONS: GL_EXT_texture_lod
                  GL_EXTENSIONS: GL_EXT_texture_lod_bias
                  GL_EXTENSIONS: GL_EXT_texture_object
                  GL_EXTENSIONS: GL_EXT_vertex_array
                  GL_EXTENSIONS: GL_IBM_rasterpos_clip
                  GL_EXTENSIONS: GL_IBM_texture_mirrored_repeat
                  GL_EXTENSIONS: GL_KTX_buffer_region
                  GL_EXTENSIONS: GL_NV_blend_square
                  GL_EXTENSIONS: GL_NV_copy_depth_to_color
                  GL_EXTENSIONS: GL_NV_depth_clamp
                  GL_EXTENSIONS: GL_NV_fence
                  GL_EXTENSIONS: GL_NV_float_buffer
                  GL_EXTENSIONS: GL_NV_fog_distance
                  GL_EXTENSIONS: GL_NV_fragment_program
                  GL_EXTENSIONS: GL_NV_half_float
                  GL_EXTENSIONS: GL_NV_light_max_exponent
                  GL_EXTENSIONS: GL_NV_multisample_filter_hint
                  GL_EXTENSIONS: GL_NV_occlusion_query
                  GL_EXTENSIONS: GL_NV_packed_depth_stencil
                  GL_EXTENSIONS: GL_NV_pixel_data_range
                  GL_EXTENSIONS: GL_NV_point_sprite
                  GL_EXTENSIONS: GL_NV_primitive_restart
                  GL_EXTENSIONS: GL_NV_register_combiners
                  GL_EXTENSIONS: GL_NV_register_combiners2
                  GL_EXTENSIONS: GL_NV_texgen_reflection
                  GL_EXTENSIONS: GL_NV_texture_compression_vtc
                  GL_EXTENSIONS: GL_NV_texture_env_combine4
                  GL_EXTENSIONS: GL_NV_texture_expand_normal
                  GL_EXTENSIONS: GL_NV_texture_rectangle
                  GL_EXTENSIONS: GL_NV_texture_shader
                  GL_EXTENSIONS: GL_NV_texture_shader2
                  GL_EXTENSIONS: GL_NV_texture_shader3
                  GL_EXTENSIONS: GL_NV_vertex_array_range
                  GL_EXTENSIONS: GL_NV_vertex_array_range2
                  GL_EXTENSIONS: GL_NV_vertex_program
                  GL_EXTENSIONS: GL_NV_vertex_program1_1
                  GL_EXTENSIONS: GL_NV_vertex_program2
                  GL_EXTENSIONS: GL_SGIS_generate_mipmap
                  GL_EXTENSIONS: GL_SGIS_texture_lod
                  GL_EXTENSIONS: GL_SGIX_depth_texture
                  GL_EXTENSIONS: GL_SGIX_shadow
                  GL_EXTENSIONS: GL_WIN_swap_hint
                  GL_EXTENSIONS: WGL_EXT_swap_control
                  GL_MAX_TEXTURE_SIZE: 8192
                  GL_MAX_ACTIVE_TEXTURES_ARB: 4
                  
                  PIXELFORMAT: color(32-bits) Z(24-bit) stencil(0-bits)
                  MODE: -1, 1920 x 1200 fullscreen hz:59
                  GAMMA: hardware w/ 0 overbright bits
                  CPU: Intel Pentium III
                  rendering primitives: single glDrawElements
                  texturemode: GL_LINEAR_MIPMAP_LINEAR
                  picmip: 0
                  picmip_models: 0
                  picmip_sky: 0
                  texture bits: 32
                  multitexture: enabled
                  compiled vertex arrays: enabled
                  texenv add: disabled
                  compressed textures: enabled
                  Initializing Shaders
                  Setting up Shaders
                  ----- finished R_Init -----
                  ------- profiling DrawBackground methods -------
                  glDrawPixels w/ BGR: 72500 clocks
                  glDrawPixels w/ RGB: 91220 clocks
                  glTexSubImage2D w/ BGR: 3617720 clocks
                  glTexSubImage2D w/ RGB: 1618800 clocks
                  DrawBackground: using glDrawPixels with BGR data
                  -------------------------------
                  Winsock Initialized
                  Opening IP socket: localhost:12203
                  IP: 192.168.1.3
                  ------- Sound Initialization (full) -------
                  Sound opened using Direct Sound
                  'Miles Fast 2D Positional Audio' provider opened.
                  Loading global/sound0.txt
                  ------- S_StopAllSounds (stop music) -------
                  ------- S_StopAllSounds Complete-------
                  ----- Sound Info -----
                  driver - Miles Fast 2D Positional Audio
                  speaker setup - 2 speakers
                  reverb - OFF
                  samplebits - 16
                  speed - 44100
                  ----------------------
                  ------- Sound Initialization Complete ------- 84 ms
                  Setting up Shaders
                  Loading inventory...
                  ----- Client Initialization Complete ----- 1669 ms
                  --- Common Initialization Complete --- 2792 ms
                  Working directory: C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo
                  Loading Localization File global/localization.txt2
                  Loading Localization File global/localization.txt
                  ------- S_StopAllSounds (stop music) -------
                  ------- S_StopAllSounds Complete-------

                  Comment

                  • sukatoa
                    Contributor
                    • Nov 2007
                    • 539

                    #10
                    Originally posted by Gangreen
                    I'm not sure this really is seen as STDOUT, but it is written in the console of moh.

                    Code:
                    --- Common Initialization ---
                    Medal of Honor: Breakthrough Demo 0.00 win-x86 Sep  3 2003
                    ----- FS_Startup -----
                    Current search path:
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak2.pk3 (921 files)
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak1.pk3 (6536 files)
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo/demott
                    
                    ----------------------
                    7519 files in pk3 files
                    
                    Running in restricted demo mode.
                    
                    ----- FS_Startup -----
                    Current search path:
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak2.pk3 (921 files)
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo\demott\pak1.pk3 (6536 files)
                    C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo/demott
                    
                    ----------------------
                    15038 files in pk3 files
                    execing default.cfg
                    execing buildver.cfg
                    execing menu.cfg
                    execing newconfig.cfg
                    execing localize.cfg
                    Config: unnamedsoldier.cfg
                    execing configs/unnamedsoldier.cfg
                    couldn't exec localized.cfg
                    execing autoexec.cfg
                    Unknown command "fov"
                    couldn't exec custom.cfg
                    ...detecting CPU, found Intel Pentium III
                    
                    ------- Input Initialization -------
                    Initializing DirectInput...
                    Couldn't set DI coop level
                    Falling back to Win32 mouse support...
                    ------- Input Initialization Complete ------- 54
                    You are now setup for medium mode.
                    ----- Client Initialization -----
                    ----- Initializing Renderer ----
                    ----- R_Init -----
                    Initializing OpenGL subsystem
                    ...initializing QGL
                    ...calling LoadLibrary( 'C:\Windows\system32\opengl32.dll' ): succeeded
                    ...setting mode -1: 1920 1200 FS
                    ...using colorsbits of 32
                    ...calling CDS: ok
                    ...registered window class
                    ...created window@0,0 (1920x1200)
                    Initializing OpenGL driver
                    ...getting DC: succeeded
                    ...GLW_ChoosePFD( 32, 32, 0 )
                    ...113 PFDs found
                    ...hardware acceleration found
                    ...PIXELFORMAT 7 selected
                    ...creating GL context: succeeded
                    ...making context current: succeeded
                    Initializing OpenGL extensions
                    ...using GL_EXT_texture_compression_s3tc
                    ...using GL_ARB_texture_compression
                    ...GL_EXT_texture_env_add not found
                    ...using WGL_EXT_swap_control
                    ...using GL_ARB_multitexture
                    ...ignoring GL_EXT_texture_env_combine
                    ...using GL_EXT_compiled_vertex_array
                    ...WGL_3DFX_gamma_control not found
                    ...using GL_DOT3_RGBA_EXT
                    
                    GL_VENDOR: NVIDIA Corporation
                    GL_RENDERER: GeForce 8600M GT/PCI/SSE2
                    GL_VERSION: 2.1.1
                    GL_EXTENSIONS: GL_ARB_depth_texture
                    GL_EXTENSIONS: GL_ARB_fragment_program
                    GL_EXTENSIONS: GL_ARB_imaging
                    GL_EXTENSIONS: GL_ARB_multisample
                    GL_EXTENSIONS: GL_ARB_multitexture
                    GL_EXTENSIONS: GL_ARB_point_parameters
                    GL_EXTENSIONS: GL_ARB_shadow
                    GL_EXTENSIONS: GL_ARB_texture_border_clamp
                    GL_EXTENSIONS: GL_ARB_texture_compression
                    GL_EXTENSIONS: GL_ARB_texture_cube_map
                    GL_EXTENSIONS: GL_ARB_texture_env_add
                    GL_EXTENSIONS: GL_ARB_texture_env_combine
                    GL_EXTENSIONS: GL_ARB_texture_env_dot3
                    GL_EXTENSIONS: GL_ARB_texture_mirrored_repeat
                    GL_EXTENSIONS: GL_ARB_transpose_matrix
                    GL_EXTENSIONS: GL_ARB_vertex_buffer_object
                    GL_EXTENSIONS: GL_ARB_vertex_program
                    GL_EXTENSIONS: GL_ARB_window_pos
                    GL_EXTENSIONS: GL_S3_s3tc
                    GL_EXTENSIONS: GL_EXT_abgr
                    GL_EXTENSIONS: GL_EXT_bgra
                    GL_EXTENSIONS: GL_EXT_blend_color
                    GL_EXTENSIONS: GL_EXT_blend_func_separate
                    GL_EXTENSIONS: GL_EXT_blend_minmax
                    GL_EXTENSIONS: GL_EXT_blend_subtract
                    GL_EXTENSIONS: GL_EXT_compiled_vertex_array
                    GL_EXTENSIONS: GL_EXT_draw_range_elements
                    GL_EXTENSIONS: GL_EXT_fog_coord
                    GL_EXTENSIONS: GL_EXT_multi_draw_arrays
                    GL_EXTENSIONS: GL_EXT_packed_pixels
                    GL_EXTENSIONS: GL_EXT_point_parameters
                    GL_EXTENSIONS: GL_EXT_rescale_normal
                    GL_EXTENSIONS: GL_EXT_secondary_color
                    GL_EXTENSIONS: GL_EXT_separate_specular_color
                    GL_EXTENSIONS: GL_EXT_shadow_funcs
                    GL_EXTENSIONS: GL_EXT_stencil_two_side
                    GL_EXTENSIONS: GL_EXT_stencil_wrap
                    GL_EXTENSIONS: GL_EXT_texture3D
                    GL_EXTENSIONS: GL_EXT_texture_compression_s3tc
                    GL_EXTENSIONS: GL_EXT_texture_cube_map
                    GL_EXTENSIONS: GL_EXT_texture_edge_clamp
                    GL_EXTENSIONS: GL_EXT_texture_env_combine
                    GL_EXTENSIONS: GL_EXT_texture_env_dot3
                    GL_EXTENSIONS: GL_EXT_texture_filter_anisotropic
                    GL_EXTENSIONS: GL_EXT_texture_lod
                    GL_EXTENSIONS: GL_EXT_texture_lod_bias
                    GL_EXTENSIONS: GL_EXT_texture_object
                    GL_EXTENSIONS: GL_EXT_vertex_array
                    GL_EXTENSIONS: GL_IBM_rasterpos_clip
                    GL_EXTENSIONS: GL_IBM_texture_mirrored_repeat
                    GL_EXTENSIONS: GL_KTX_buffer_region
                    GL_EXTENSIONS: GL_NV_blend_square
                    GL_EXTENSIONS: GL_NV_copy_depth_to_color
                    GL_EXTENSIONS: GL_NV_depth_clamp
                    GL_EXTENSIONS: GL_NV_fence
                    GL_EXTENSIONS: GL_NV_float_buffer
                    GL_EXTENSIONS: GL_NV_fog_distance
                    GL_EXTENSIONS: GL_NV_fragment_program
                    GL_EXTENSIONS: GL_NV_half_float
                    GL_EXTENSIONS: GL_NV_light_max_exponent
                    GL_EXTENSIONS: GL_NV_multisample_filter_hint
                    GL_EXTENSIONS: GL_NV_occlusion_query
                    GL_EXTENSIONS: GL_NV_packed_depth_stencil
                    GL_EXTENSIONS: GL_NV_pixel_data_range
                    GL_EXTENSIONS: GL_NV_point_sprite
                    GL_EXTENSIONS: GL_NV_primitive_restart
                    GL_EXTENSIONS: GL_NV_register_combiners
                    GL_EXTENSIONS: GL_NV_register_combiners2
                    GL_EXTENSIONS: GL_NV_texgen_reflection
                    GL_EXTENSIONS: GL_NV_texture_compression_vtc
                    GL_EXTENSIONS: GL_NV_texture_env_combine4
                    GL_EXTENSIONS: GL_NV_texture_expand_normal
                    GL_EXTENSIONS: GL_NV_texture_rectangle
                    GL_EXTENSIONS: GL_NV_texture_shader
                    GL_EXTENSIONS: GL_NV_texture_shader2
                    GL_EXTENSIONS: GL_NV_texture_shader3
                    GL_EXTENSIONS: GL_NV_vertex_array_range
                    GL_EXTENSIONS: GL_NV_vertex_array_range2
                    GL_EXTENSIONS: GL_NV_vertex_program
                    GL_EXTENSIONS: GL_NV_vertex_program1_1
                    GL_EXTENSIONS: GL_NV_vertex_program2
                    GL_EXTENSIONS: GL_SGIS_generate_mipmap
                    GL_EXTENSIONS: GL_SGIS_texture_lod
                    GL_EXTENSIONS: GL_SGIX_depth_texture
                    GL_EXTENSIONS: GL_SGIX_shadow
                    GL_EXTENSIONS: GL_WIN_swap_hint
                    GL_EXTENSIONS: WGL_EXT_swap_control
                    GL_MAX_TEXTURE_SIZE: 8192
                    GL_MAX_ACTIVE_TEXTURES_ARB: 4
                    
                    PIXELFORMAT: color(32-bits) Z(24-bit) stencil(0-bits)
                    MODE: -1, 1920 x 1200 fullscreen hz:59
                    GAMMA: hardware w/ 0 overbright bits
                    CPU: Intel Pentium III
                    rendering primitives: single glDrawElements
                    texturemode: GL_LINEAR_MIPMAP_LINEAR
                    picmip: 0
                    picmip_models: 0
                    picmip_sky: 0
                    texture bits: 32
                    multitexture: enabled
                    compiled vertex arrays: enabled
                    texenv add: disabled
                    compressed textures: enabled
                    Initializing Shaders
                    Setting up Shaders
                    ----- finished R_Init -----
                    ------- profiling DrawBackground methods -------
                    glDrawPixels w/ BGR: 72500 clocks
                    glDrawPixels w/ RGB: 91220 clocks
                    glTexSubImage2D w/ BGR: 3617720 clocks
                    glTexSubImage2D w/ RGB: 1618800 clocks
                    DrawBackground: using glDrawPixels with BGR data
                    -------------------------------
                    Winsock Initialized
                    Opening IP socket: localhost:12203
                    IP: 192.168.1.3
                    ------- Sound Initialization (full) -------
                    Sound opened using Direct Sound
                    'Miles Fast 2D Positional Audio' provider opened.
                    Loading global/sound0.txt
                    ------- S_StopAllSounds (stop music) -------
                    ------- S_StopAllSounds Complete-------
                    ----- Sound Info -----
                    driver - Miles Fast 2D Positional Audio
                    speaker setup - 2 speakers
                    reverb - OFF
                    samplebits - 16
                    speed - 44100
                    ----------------------
                    ------- Sound Initialization Complete ------- 84 ms
                    Setting up Shaders
                    Loading inventory...
                    ----- Client Initialization Complete ----- 1669 ms
                    --- Common Initialization Complete --- 2792 ms
                    Working directory: C:\Program Files\EA GAMES\Medal of Honor Allied Assault Breakthrough Demo
                    Loading Localization File global/localization.txt2
                    Loading Localization File global/localization.txt
                    ------- S_StopAllSounds (stop music) -------
                    ------- S_StopAllSounds Complete-------
                    I have an idea....

                    Insteed of seeking for it in an output stream, you could just write it in a file....
                    i mean, the STDOUT in MOH.....
                    If and if you are the one who made the MOH....
                    THen, read it in your java program.....


                    I cannot help you about capturing the output stream by the other program....

                    Maybe later, the experts could help you out....

                    regards,
                    sukatoa.

                    Comment

                    • Gangreen
                      New Member
                      • Feb 2008
                      • 98

                      #11
                      Originally posted by sukatoa
                      I have an idea....

                      Insteed of seeking for it in an output stream, you could just write it in a file....
                      i mean, the STDOUT in MOH.....
                      If and if you are the one who made the MOH....
                      THen, read it in your java program...
                      I have had that idea too, but that would cause to much overhead of inputting and outputting to textfiles. The program I build needs to react instantly on certain sentences in the moh console...

                      Comment

                      • sukatoa
                        Contributor
                        • Nov 2007
                        • 539

                        #12
                        Originally posted by Gangreen
                        I have had that idea too, but that would cause to much overhead of inputting and outputting to textfiles. The program I build needs to react instantly on certain sentences in the moh console...
                        It might be happened.... but,


                        but that would cause to much overhead of inputting and outputting to textfiles.
                        Have you try it?

                        The program I build needs to react instantly on certain sentences in the moh console...
                        Are you assuming that java is too slow in that kind of implementation?
                        How about the JEdit? lets took some example, the syntax highlighting on it's textpane? line counting? the number printed at the left of the screen? ( Always updated )....

                        They are running with it's top performance(imp lemented in the right way and running concurrently).. ... i have made my syntax highlighting 3months ago, it was so worst "It extremely slows the performance when the lines exceeds 100...." until i knew that there is something weird in my code.... then fixed...

                        I took that example because it was nearly the same with the stdout of moh....
                        text manipulation of thousands of characters finding the specific element, consecutively every caret position changed....

                        About file reading and writing:

                        have you tried to use FileWriter? and FileReader? For me, it was nice if and only if they were use in the right way.... ( for huge content )....

                        there is no harm in trying such things, if the worst performance persists, our experts here will always ready to help you out....

                        who knows, maybe you will discover something,
                        sukatoa

                        Comment

                        • Gangreen
                          New Member
                          • Feb 2008
                          • 98

                          #13
                          ok, but then still I would need a way of writing that console to a tekstfile, which is thesame problem...I'm now trying to create this reading from that console in C, and using that C program in java, since C has some interesting FindWindow() methods and stuff like that.

                          Comment

                          • Gangreen
                            New Member
                            • Feb 2008
                            • 98

                            #14
                            I have found why it medal of honor crashes when using exec.

                            I did: exec("***path** *MOHAA.exe)

                            The problem with this is that the exe does not get started in it's working directory, which is the MOH installation path..

                            anyway

                            now I use exec(file, env, path)
                            which does exec the exe in it's working directory..one problem, apparently it does not find the exe now...and i don't think I have written any typos..

                            Code:
                            public class MohReader extends Thread {
                            	public static String path = "C:\\Program Files\\EA Games\\Medal of Honor Allied Assault Breakthrough Demo\\";
                            	
                            	public static File pathfile = new File(path);
                            	@Override
                            	public void run() {
                            			loadMoh();
                            	}
                            	
                            	private static void loadMoh() {
                            		try {
                            			String line;
                            			Process p = Runtime.getRuntime().exec("moh_breakthrough_demo.exe", null, pathfile);		
                            			BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
                            			while ((line = input.readLine()) != null)
                            				System.out.println(line);
                            			input.close();
                            		} catch (Exception err){
                            			System.err.println(err.getMessage());
                            		}
                            	}
                            btw, If someoe could explain me what that second 'environment' argument in the exe means it will also be appreciated..Is it like parameters to be given upon starting the exe?

                            Comment

                            • sukatoa
                              Contributor
                              • Nov 2007
                              • 539

                              #15
                              what that second 'environment' argument in the exe means
                              Take a look at this.

                              Double check the path variable if the directory exists.

                              eg. new File(path).exis t..... should return true....

                              Comment

                              Working...