srcipt resolution changing (XP to VXACE)

hello

I wish I could change the resolution to do in my game rpgmaker vxace.
has the time or I use rpg maker xp I use this script that is exactly what I want:

  1. # Resolution Changer Ultimate v1.1
  2. # Script créé par Zeus81
  3. #
  4. #
  5. #
  6. #
  7.  
  8. class << Graphics
  9.   def width ; return 1024; end # Configurez ici la largeur de l'écran
  10.   def height; return 768; end # Configurez ici la hauteur de l'écran
  11.   Fullscreen_Start = false    # Configurez ici si le jeu démarre en mode plein écran (true) ou pas (false)
  12.  
  13.   FindWindow       = Win32API.new("user32", "FindWindow", "pp", "l")
  14.   CreateWindowEx   = Win32API.new("user32", "CreateWindowEx", "lpplllllllll", "l")
  15.   UpdateWindow     = Win32API.new("user32", "UpdateWindow", "l", "l")
  16.   ShowWindow       = Win32API.new("user32", "ShowWindow", "ll", "l")
  17.   SetWindowLong    = Win32API.new("user32", "SetWindowLong", "lll", "l")
  18.   SetWindowPos     = Win32API.new("user32", "SetWindowPos", "lllllll", "l")
  19.   GetSystemMetrics = Win32API.new("user32", "GetSystemMetrics", "l", "l")
  20.   GetDC            = Win32API.new("user32", "GetDC", "l", "l")
  21.   FillRect         = Win32API.new("user32", "FillRect", "lpl", "l")
  22.   SetKeyState      = Win32API.new("user32", "keybd_event", "llll", "")
  23.   CreateSolidBrush = Win32API.new("gdi32", "CreateSolidBrush", "l", "l")
  24.   SetResolution    = Win32API.new("Display", "SetResolution", "lll", "l")
  25.   Screenshot       = Win32API.new("Screenshot", "Screenshot", "llllpll", "")
  26.   Resolutions = [[], []]
  27.   Resolutions[0].push([ 320,  240])
  28.   Resolutions[0].push([ 640,  480])
  29.   Resolutions[0].push([ 768,  576])
  30.   Resolutions[0].push([ 800,  600])
  31.   Resolutions[0].push([1024,  768])
  32.   Resolutions[0].push([1152,  864])
  33.   Resolutions[0].push([1280,  960])
  34.   Resolutions[0].push([1280, 1024])
  35.   Resolutions[0].push([1400, 1050])
  36.   Resolutions[0].push([1600, 1200])
  37.   Resolutions[0].push([2048, 1536])
  38.   Resolutions[0].push([2560, 1920])
  39.   Resolutions[0].push([2560, 2048])
  40.   Resolutions[1].push([ 320,  200])
  41.   Resolutions[1].push([ 800,  480])
  42.   Resolutions[1].push([ 854,  480])
  43.   Resolutions[1].push([ 960,  600])
  44.   Resolutions[1].push([1088,  612])
  45.   Resolutions[1].push([1280,  720])
  46.   Resolutions[1].push([1280,  768])
  47.   Resolutions[1].push([1280,  800])
  48.   Resolutions[1].push([1360,  768])
  49.   Resolutions[1].push([1440,  900])
  50.   Resolutions[1].push([1680, 1050])
  51.   Resolutions[1].push([1920, 1080])
  52.   Resolutions[1].push([1920, 1200])
  53.   Resolutions[1].push([2560, 1440])
  54.   Resolutions[1].push([2560, 1600])
  55.   Transition = Sprite.new
  56.   Transition.z = 0xFFFF
  57.   First_Start = !defined?(First_Start)
  58.   if First_Start
  59.     open("Game.ini") {|file| file.read[/Title=(.*?)\n/]}
  60.     WindowHandle     = FindWindow.call("RGSS Player", $1)
  61.     BackWindowHandle = CreateWindowEx.call(0x08000000, "Static", "", 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0)
  62.     FillRectArgs = [GetDC.call(BackWindowHandle), [0,0,0xFFFF,0xFFFF].pack("l4"), CreateSolidBrush.call(0)]
  63.     @@fullscreen, @@client_resolution = nil
  64.     alias :zeus81_rcu_graphics_freeze     :freeze
  65.     alias :zeus81_rcu_graphics_transition :transition
  66.     alias :zeus81_rcu_graphics_update     :update
  67.   end
  68.   def update
  69.     zeus81_rcu_graphics_update
  70.     set_key_state(164, false)
  71.     change_mode if Input.trigger?(Input::F5)
  72.   end
  73.   def freeze
  74.     if width <= 640 and height <= 480; zeus81_rcu_graphics_freeze
  75.     else
  76.       Screenshot.call(0, 0, width, height, "freeze.bmp", WindowHandle, 0)
  77.       Transition.bitmap = Bitmap.new("freeze.bmp")
  78.       File.delete("freeze.bmp")
  79.     end
  80.   end
  81.   def transition(d=8, f="", v=40)
  82.     if width <= 640 and height <= 480; zeus81_rcu_graphics_transition(d, f, v)
  83.     else
  84.       d.times {|i| Transition.opacity = 256 - i*256/d; update}
  85.       Transition.bitmap.dispose if Transition.bitmap
  86.       Transition.bitmap, Transition.opacity = nil, 255
  87.     end
  88.   end
  89.   def fullscreen?; return @@fullscreen; end
  90.   def change_mode; set_resolution(!@@fullscreen); end
  91.   def fullscreen_mode; set_resolution(true) unless @@fullscreen == true; end
  92.   def windowed_mode; set_resolution(false) unless @@fullscreen == false; end
  93.   private
  94.   def set_key_state(k, b); SetKeyState.call(k, 0, (b ? 0 : 2), 0); end
  95.   def get_resolution; return GetSystemMetrics.call(0), GetSystemMetrics.call(1); end
  96.   def set_resolution(fullscreen)
  97.     @@client_resolution = get_resolution unless @@fullscreen == true
  98.     @@fullscreen = fullscreen
  99.     w, h, z, f =  width, height, -1, 64
  100.     if @@fullscreen
  101.       ShowWindow.call(BackWindowHandle, 3)
  102.       SetWindowLong.call(WindowHandle, -16, 0x14000000)
  103.       ratio = @@client_resolution[0] / @@client_resolution[1].to_f
  104.       for res in Resolutions[ratio < 1.5 ? 0 : 1]
  105.         next unless res[0] >= width and res[1] >= height
  106.         SetResolution.call(res[0], res[1], 4)
  107.         break if res == get_resolution
  108.       end
  109.     else
  110.       ShowWindow.call(BackWindowHandle, 0)
  111.       SetWindowLong.call(WindowHandle, -16, 0x14CA0000)
  112.       SetResolution.call(@@client_resolution[0], @@client_resolution[1], 0)
  113.       w += (GetSystemMetrics.call(5)+2) * 2
  114.       h += (GetSystemMetrics.call(6)+2) * 2 + GetSystemMetrics.call(4)
  115.       z = f = 0
  116.     end
  117.     x, y = get_resolution
  118.     x, y = [(x-w)/2, 0].max, [(y-h)/2, 0].max
  119.     SetWindowPos.call(WindowHandle, z, x, y, w, h, f)
  120.     UpdateWindow.call(BackWindowHandle)
  121.     FillRect.call(*FillRectArgs)
  122.   end
  123.   Fullscreen_Start ? Graphics.fullscreen_mode : Graphics.windowed_mode if First_Start
  124. end
  125.  
  126. class RPG::Weather
  127.   def update
  128.     return if @type == 0
  129.     for i in 1..@max
  130.       sprite = @sprites[i]
  131.       break if sprite == nil
  132.       case @type
  133.       when 1; sprite.x -= 2; sprite.y += 16; sprite.opacity -= 8
  134.       when 2; sprite.x -= 8; sprite.y += 16; sprite.opacity -= 12
  135.       when 3; sprite.x -= 2; sprite.y +=  8; sprite.opacity -= 8
  136.       end
  137.       x, y = sprite.x - @ox, sprite.y - @oy
  138.       if sprite.opacity < 64 or x < -50 or x > Graphics.width+110 or y < -300 or y > Graphics.height+20
  139.         sprite.x, sprite.y = rand(Graphics.width+160)- 50+@ox, rand(Graphics.height+220)-200+@oy
  140.         sprite.opacity = 255
  141.       end
  142.     end
  143.   end
  144. end
  145.  
  146. class Game_Map
  147.   def scroll_right(distance); self.display_x += distance; end
  148.   def scroll_left(distance) ; self.display_x -= distance; end
  149.   def scroll_down(distance) ; self.display_y += distance; end
  150.   def scroll_up(distance)   ; self.display_y -= distance; end
  151.   def display_x=(x); @display_x = middle(0, x, width*128-Graphics.width*4) if @display_x != x and width*32 > Graphics.width; end
  152.   def display_y=(y); @display_y = middle(0, y, height*128-Graphics.height*4) if @display_y != y and height*32 > Graphics.height; end
  153.   def middle(min, x, max); return (x > min ? x < max ? x : max : min); end
  154.   end
  155.  
  156. class Game_Event
  157.   def visible; return [email protected]?("[INVISIBLE]"); end
  158. end
  159.  
  160. class Game_Player
  161.   CENTER_X, CENTER_Y = (Graphics.width/2-16)*4, (Graphics.height/2-16)*4
  162.   def center(x, y); $game_map.display_x, $game_map.display_y = x*128-CENTER_X, y*128-CENTER_Y; end
  163. end
  164.  
  165. class Sprite_Character
  166.   attr_accessor :animation_viewport, :clones
  167.   def initialize(a, b); super(a); @character, @clones = b, []; end
  168.   alias :zeus81_rcu_sprite_character_update :update
  169.   def update; zeus81_rcu_sprite_character_update; @clones.each {|c| c.update}; end
  170.   def dispose; super; @clones.each {|c| c.dispose}; end
  171.   def flash(a, b); super; @clones.each {|c| c.flash(a, b)}; end
  172.   def bitmap=(a); (super; @clones.each {|c| c.bitmap=a}) if bitmap != a; end
  173.   def visible=(a); (super; @clones.each {|c| c.visible=a}) if visible != a; end
  174.   def opacity=(a); (super; @clones.each {|c| c.opacity=a}) if opacity != a; end
  175.   def src_rect=(a); super; @clones.each {|c| c.src_rect=a}; end
  176.   def ox=(a); (super; @clones.each {|c| c.ox=a}) if ox != a; end
  177.   def oy=(a); (super; @clones.each {|c| c.oy=a}) if oy != a; end
  178.   def x=(a); (super; @clones.each {|c| c.x=a-c.viewport.rect.x+viewport.rect.x}) if x != a; end
  179.   def y=(a); (super; @clones.each {|c| c.y=a-c.viewport.rect.y+viewport.rect.y}) if y != a; end
  180.   def z=(a); (super; @clones.each {|c| c.z=a-c.viewport.rect.y+viewport.rect.y}) if z != a; end
  181.   def blend_type=(a); (super; @clones.each {|c| c.blend_type=a}) if blend_type != a; end
  182.   def bush_depth=(a); (super; @clones.each {|c| c.bush_depth=a}) if bush_depth != a; end
  183.   def animation(animation, hit)
  184.     dispose_animation
  185.     @_animation = animation
  186.     return if @_animation == nil
  187.     @_animation_hit, @_animation_duration = hit, @_animation.frame_max
  188.     bitmap = RPG::Cache.animation(@_animation.animation_name, @_animation.animation_hue)
  189.     if @@_reference_count.include?(bitmap); @@_reference_count[bitmap] += 1
  190.     else; @@_reference_count[bitmap] = 1
  191.     end
  192.     @_animation_sprites = []
  193.     if @_animation.position != 3 or not @@_animations.include?(@_animation)
  194.       16.times do
  195.         sprite = ::Sprite.new(@animation_viewport)
  196.         sprite.bitmap, sprite.visible = bitmap, false
  197.         @_animation_sprites.push(sprite)
  198.       end
  199.       @@_animations.push(@_animation) unless @@_animations.include?(@_animation)
  200.     end
  201.     update_animation
  202.   end
  203. end
  204.  
  205. class Spriteset_Map
  206.   def initialize
  207.     @tilemaps, @panoramas, @fogs, @character_sprites, @picture_sprites = [], [], [], [], []
  208.     r = Rect.new(0, 0, [$game_map.width*32, Graphics.width].min, [$game_map.height*32, Graphics.height].min)
  209.     r.x, r.y = (Graphics.width-r.width)/2, (Graphics.height-r.height)/2
  210.     iw, ih = (r.width/640.0).ceil, (r.height/480.0).ceil
  211.     for i in 0...iw*ih
  212.       x, y = i%iw*640, i/iw*480
  213.       w, h = [r.width-x, r.width, 640].min, [r.height-y, r.height, 480].min
  214.       v = Viewport.new(r.x+x, r.y+y, w, h)
  215.       @tilemaps.push(Tilemap.new(v))
  216.       @tilemaps[-1].tileset = RPG::Cache.tileset($game_map.tileset_name)
  217.       7.times {|j| @tilemaps[-1].autotiles[j] = RPG::Cache.autotile($game_map.autotile_names[j])}
  218.       @tilemaps[-1].map_data, @tilemaps[-1].priorities = $game_map.data, $game_map.priorities
  219.       @panoramas.push(Plane.new(v))
  220.       @fogs.push(Plane.new(v))
  221.       @panoramas[-1].z, @fogs[-1].z = -1000, 3000
  222.       if i == 0
  223.         $game_map.events.each_value {|e| @character_sprites.push(Sprite_Character.new(v, e)) if e.visible}
  224.         @character_sprites.push(Sprite_Character.new(v, $game_player))
  225.       else; @character_sprites.each {|s| s.clones.push(Sprite.new(v))}
  226.       end
  227.     end
  228.     @viewport1, @viewport2, @viewport3 = Viewport.new(r), Viewport.new(r), Viewport.new(r)
  229.     @viewport2.z, @viewport3.z = 200, 5000
  230.     @weather = RPG::Weather.new(@viewport1)
  231.     @character_sprites.each {|s| s.animation_viewport=@viewport1; s.update}
  232.     (1..50).each {|i| @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i]))}
  233.     @timer_sprite = Sprite_Timer.new
  234.     update
  235.   end
  236.   def dispose
  237.     @tilemaps[0].tileset.dispose
  238.     7.times {|i| @tilemaps[0].autotiles[i].dispose}
  239.     @tilemaps.each {|tilemap| tilemap.viewport.dispose; tilemap.dispose}
  240.     @panoramas.each {|panorama| panorama.dispose}
  241.     @fogs.each {|fog| fog.dispose}
  242.     @character_sprites.each {|sprite| sprite.dispose}
  243.     @weather.dispose
  244.     @picture_sprites.each {|sprite| sprite.dispose}
  245.     @timer_sprite.dispose
  246.     @viewport1.dispose
  247.     @viewport2.dispose
  248.     @viewport3.dispose
  249.   end
  250.   def update
  251.     if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue
  252.       @panorama_name, @panorama_hue = $game_map.panorama_name, $game_map.panorama_hue
  253.       @panoramas[0].bitmap.dispose if @panoramas[0].bitmap
  254.       @panoramas[0].bitmap = (@panorama_name == "" ? nil : RPG::Cache.panorama(@panorama_name, @panorama_hue))
  255.       @panoramas.each {|panorama| panorama.bitmap = @panoramas[0].bitmap}
  256.       Graphics.frame_reset
  257.     end
  258.     if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
  259.       @fog_name, @fog_hue = $game_map.fog_name, $game_map.fog_hue
  260.       @fogs[0].bitmap.dispose if @fogs[0].bitmap
  261.       @fogs[0].bitmap = (@fog_name == "" ? nil : RPG::Cache.fog(@fog_name, @fog_hue))
  262.       @fogs.each {|fog| fog.bitmap = @fogs[0].bitmap}
  263.       Graphics.frame_reset
  264.     end
  265.     @viewport1.tone, @viewport1.ox, @viewport3.color = $game_screen.tone, $game_screen.shake, $game_screen.flash_color
  266.     @viewport1.update
  267.     @viewport3.update
  268.     ox, oy = $game_map.display_x/4, $game_map.display_y/4
  269.     for i in [email hidden]
  270.       tilemap = @tilemaps[i]
  271.       tilemap.viewport.tone, tilemap.viewport.ox = @viewport1.tone, @viewport1.ox
  272.       tilemap.viewport.update
  273.       tilemap.ox = [email protected]
  274.       tilemap.oy = [email protected]
  275.       tilemap.update
  276.       panorama = @panoramas[i]
  277.       panorama.ox, panorama.oy = tilemap.ox/2, tilemap.oy/2 if panorama.bitmap
  278.       fog = @fogs[i]
  279.       if fog.bitmap
  280.         fog.ox, fog.oy = tilemap.ox+$game_map.fog_ox, tilemap.oy+$game_map.fog_oy
  281.         fog.zoom_x, fog.zoom_y = $game_map.fog_zoom/100.0, $game_map.fog_zoom/100.0
  282.         fog.opacity, fog.blend_type, fog.tone = $game_map.fog_opacity, $game_map.fog_blend_type, $game_map.fog_tone
  283.       end
  284.     end
  285.     @character_sprites.each {|sprite| sprite.update}
  286.     @weather.type, @weather.max = $game_screen.weather_type, $game_screen.weather_max
  287.     @weather.ox, @weather.oy = ox, oy
  288.     @weather.update
  289.     @picture_sprites.each {|sprite| sprite.update}
  290.     @timer_sprite.update
  291.   end
  292. end
  293.  
Expand to see the code.


you would need its file to make it work:
http://www.mediafire.com/?9jsbd1jyq70fgy4

I intend to do fonctioné my game in 1024 * 768

sorry for my pitiful English, I am French ^ ^

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=76482