Logo Hardware.com.br
afonso220
afonso220 General de Pijama Registrado
3.6K Mensagens 195 Curtidas
#19 Por afonso220
10/09/2017 - 12:16
Muito bom, mais em cada tópico do emulador, você poderia ter colocado qual seria a configuração minima para o emulador rodar os jogos
sem travamentos etc, pois a maquina de teste que está usando é forte, então entende-se que quase todos vão rodar sem problemas, agora em pcs
mais ''básicos'' ou menos parrudo, não se sabe como ira ocorrer essa emulação.
-Uchiha-
-Uchiha- Highlander Registrado
15.4K Mensagens 919 Curtidas
#20 Por -Uchiha-
10/09/2017 - 13:50
afonso220 disse:
Muito bom, mais em cada tópico do emulador, você poderia ter colocado qual seria a configuração minima para o emulador rodar os jogos
sem travamentos etc, pois a maquina de teste que está usando é forte, então entende-se que quase todos vão rodar sem problemas, agora em pcs
mais ''básicos'' ou menos parrudo, não se sabe como ira ocorrer essa emulação.


Entendo o questionamento, mas é mais complicado que isso... vou ver o que consigo fazer mais o problema é que os requisitos mínimos variam muito de jogo para jogo. Alguns jogos são mais exigentes que outros, além de em determinados casos, o emulador ser melhor otimizado para X jogo.

De todo modo, vou tentar elaborar uma metodologia para atender isso. isso_ai.png
sephiroth0
sephiroth0 Super Zumbi Registrado
6.9K Mensagens 694 Curtidas
#21 Por sephiroth0
11/09/2017 - 23:11
Emulando Sega Saturn

O melhor emulador de Saturn atualmente é o Mednafen, que emula vários sistemas em um único emulador, dentre os quais Sega Saturn, Mega Drive, Playstation 1, SNES, NEC PC-Engine.

1) Baixar o emulador Mednafen e o MednafenGUI Reborn (opcional), que é uma interface gráfica para o emulador, que não possui uma. Sinceramente, para os jogos em CD, única função desta interface é listar os jogos, opcionalmente com capinha e informações sobre os mesmos. Caso não queiram usar a interface, pulem os passos 3, 4 e 5.
https://mednafen.github.io/releases/
https://sourceforge.net/projects/medguireborn/

2) Colocar as bios do console, que podem ser feito dump do console ou encontradas na internet. As bios devem se colocadas no diretório firmware, presente na raiz do diretório do mednafen. A japonesa deve ser nomeada sega_101.bin e a bios US 1.0 deve ser nomeada como mpr-17933.bin para jogar jogos americanos e europeus.

3) [MedGui Reborn] Descompactar MednafenGUI Reborn para dentro do diretório onde descompactar o emulador Mednafen e executar MedGuiR.exe (pode criar um atalho para facilitar).
Aqui imagem do MedGui Reborn, com algumas partes importantes marcadas e que falarei a seguir.
Imagem

4) [MedGui Reborn] Na aba General, configurar caminho para a raiz onde colocou o Mednafen.

5) [MedGui Reborn] Não funciona na interface listar isos, logo adicione manualmente no botão indicado na imagem, e na lista de jogos pressione 'f' para adicionar aos favoritos, assim criando uma lista dos jogos do console. Os formatos mais comuns são suportados pelo emulador (iso, cue/bin). Alguns como mds/mdf precisarão ser convertidos ou feitos dumps/baixados em algum dos formatos suportados para serem jogados. Para iniciar um jogo, dê dois clicks com o botão esquerdo do mouse sobre o jogo desejado. As vezes não vai de primeira, tem de ser dois clicks rápidos para reconhecer.

6) Iniciando jogos sem interface gráfica: a melhor maneira é criar um arquivo .bat para passar por argumento o caminho do jogo. Exemplo:
mednafen.exe "D:\jogosSaturn\Legend of Heroes III.cue"



7) O Mednafen funciona com controles, aqui mapeei para o controle do Xbox 360. Com um jogo de Saturn iniciado, aperte F2 e fique apertando até aparecer gamepad, onde configurará que está usando um controle. A seguir, aperte no emulador Alt+Shift+1 para iniciar a configuração do controle. Aperte 2 vezes cada botão para confirmar. Por vezes o analógico pode interferir na configuração, em especial nos direcionais, certifique-se de que esteja centralizado quando iniciar a configuração. Se não ficar bom de primeira vez, refaça a qualquer momento, apertando o mesmo atalho.

[MedGui Reborn] Na aba General, há uma opção de configurar o controle, marcando o checkbox Use joypad (1 para controle 1, 2 para segundo controle, e assim por diante). Ignore esta opção, pois não é para mapear os botões do controle.

8) Não há interface para configurações de vídeo, estas devem ser editadas no arquivo mednafen-09x.cfg no diretório raiz do emulador. Podem ser configuradas, por exemplo, scanlines (ss.scanlines), interpolação bilinear para filtragem (ss.videoip), resolução (ss.xres e ss.yres). Pode ser um pouco trabalhoso na primeira vez, mas configurado uma vez, é só dar play nos jogos e partir para a jogatina. Valores que gostei aqui são:
ss.scanlines 30
ss.xres 640
ss.yres 480
ss.xscale 2.000000
ss.yscale 2.000000

Por padrão ss.xres e ss.yres vem com 0 e ss.xscalefs e ss.yscalefs em 1.000000 o que indica rodar na resolução nativa do Saturn, com escala para 1, ou seja, proporção original. Em modo janela apenas deixo a escala dobrada. Para quem tiver monitor full-hd, uma escala em janela de no mínimo em 3 é recomendável.

Imagem

9) O Mednafen tem muitas funcionalidades imbutidas já, como tirar snapshots ou gravar vídeo. Aqui a lista de atalhos:
[spoiler]
Imagem
[/spoiler]
Deixo aqui os links da documentação dele para Sega Saturn e geral do emulador.
sephiroth0
sephiroth0 Super Zumbi Registrado
6.9K Mensagens 694 Curtidas
#22 Por sephiroth0
11/09/2017 - 23:11
Emulando PC Engine e PC-FX

NEC PC Engine e PC-FX são dois vídeo-games lançados pela NEC, e que tiveram bem pouca popularidade fora do Japão. O PC-Engine rodava cartuchos conhecidos por HuCards e CDs com um add-on (PC Engine CD). Foi lançado nos EUA e alguns países da Europa como TurboGraphx-16. O PC-FX é o sucessor do vídeo-game original, e ficou restrito ao Japão.
Há dois emuladores recomendados para emular PC-Engine e PC-FX: o Mednafen (freeware, que emula vários sistemas, como PC Engine, Sega Saturn, Mega Drive, Playstation 1, SNES) e o Magic Engine (este pago).


Método 1 – Usando Mednafen.

1) Baixar o emulador Mednafen e o MednafenGUI Reborn (opcional), que é uma interface gráfica para o emulador, que não possui uma. Sinceramente, para os jogos em CD, única função desta interface é listar os jogos, opcionalmente com capinha e informações sobre os mesmos. Caso não queiram usar a interface, pulem os passos 3, 4 e 5.
https://mednafen.github.io/releases/
https://sourceforge.net/projects/medguireborn/

2) Colocar as bios do console, que podem ser feito dump do console ou encontradas na internet. As bios devem se colocadas no diretório firmware, syscard3.pce correspondendo a bios do PC-Engine e pcfx.rom a do PC-FX.

3) [MedGui Reborn] Descompactar MednafenGUI Reborn para dentro do diretório onde descompactar o emulador Mednafen e executar MedGuiR.exe (pode criar um atalho para facilitar).
Aqui imagem do MedGui Reborn, com algumas partes importantes marcadas e que falarei a seguir.
Imagem

4) [MedGui Reborn] Na aba General, configurar caminho para a raiz onde colocou o Mednafen.

5) [MedGui Reborn] Não funciona na interface listar jogos em cd, mas para os jogos em HuCard sim. Adicione manualmente no botão indicado na imagem, e na lista de jogos pressione 'f' para adicionar aos favoritos os jogos em CD, assim criando uma lista dos jogos do console. Os formatos mais comuns são suportados pelo emulador (iso, cue/bin). Alguns como mds/mdf precisarão ser convertidos ou feitos dumps/baixados em algum dos formatos suportados para serem jogados. Para iniciar um jogo, dê dois clicks com o botão esquerdo do mouse sobre o jogo desejado. As vezes não vai de primeira, tem de ser dois clicks rápidos para reconhecer. Para os jogos em HuCard, configure em Rom Path 1, no campo PC Engine. É possível baixar as capas na própria aba Game Info, clicando em Download Box Art. Se o checkbox abaixo estiver marcado, será tentado baixar a capa automaticamente ao selecionar um jogo, se não tiver já. Uma coisa é que baixa somente as capas japonesas pelo que notei.
Imagem

6) Iniciando jogos sem interface gráfica: a melhor maneira é criar um arquivo .bat para passar por argumento o caminho do jogo. Exemplo:
mednafen.exe "D:\jogosPCFX\Zeroigar.cue"



7) O Mednafen funciona com controles, aqui mapeei para o controle do Xbox 360. Com um jogo de Saturn iniciado, aperte F2 e fique apertando até aparecer gamepad, onde configurará que está usando um controle. A seguir, aperte no emulador Alt+Shift+1 para iniciar a configuração do controle. Aperte 2 vezes cada botão para confirmar. Por vezes o analógico pode interferir na configuração, em especial nos direcionais, certifique-se de que esteja centralizado quando iniciar a configuração. Se não ficar bom de primeira vez, refaça a qualquer momento, apertando o mesmo atalho.

[MedGui Reborn] Na aba General, há uma opção de configurar o controle, marcando o checkbox Use joypad (1 para controle 1, 2 para segundo controle, e assim por diante). Ignore esta opção, pois não é para mapear os botões do controle.

8) Não há interface para configurações de vídeo, estas devem ser editadas no arquivo mednafen-09x.cfg no diretório raiz do emulador. Podem ser configuradas, por exemplo, scanlines, interpolação bilinear para filtragem, resolução. Pode ser um pouco trabalhoso na primeira vez, mas configurado uma vez, é só dar play nos jogos e partir para a jogatina.
Valores que gostei aqui são:

Para o PC Engine:
pce.scanlines 30
pce.xres 640
pce.yres 480
pce.xscale 2.000000
pce.yscale 2.000000


Para o PC-FX:
pcfx.scanlines 30
pcfx.xres 640
pcfx.yres 480
pcfx.xscale 2.000000
pcfx.yscale 2.000000


Por padrão xres e yres vem com 0 e xscalefs e yscalefs em 1.000000 o que indica rodar na resolução nativa dos vídeo games, com escala para 1, ou seja, proporção original. Em modo janela apenas deixo a escala dobrada. Para quem tiver monitor full-hd, uma escala em janela de no mínimo em 3 é recomendável.

9) O Mednafen tem muitas funcionalidades imbutidas já, como tirar snapshots ou gravar vídeo. Aqui a lista de atalhos:
[spoiler]
Imagem
[/spoiler]
Deixo aqui os links da documentação dele para PC-Engine, PC-FX e geral do emulador.


Método 2 - usando o Magic Engine.
Em breve isso_ai.png
sephiroth0
sephiroth0 Super Zumbi Registrado
6.9K Mensagens 694 Curtidas
#23 Por sephiroth0
12/09/2017 - 16:58
Vou começar pelo mais simples. Atualmente o emulador de SNES mais fácil de configurar e com compatibilidade excelente: o snes9x.

Site: http://www.snes9x.com/
Download da versão 1.54 (para Windows 64 bits): https://sites.google.com/site/bearoso/snes9x/snes9x-1.54.1-win32-x64.zip?attredirects=0&d=1
Donwload das dlls para usar shaders com Direct3D: https://sites.google.com/site/bearoso/snes9x/cg_dlls_x64.zip?attredirects=0&d=1

Boa parte já vem por padrão configurado. Basicamente é necessário:

1) Em emulation → Settings configure o caminho para o diretório de ROMs. O restante (saves, screenshots, etc.) deixo no padrão, que é dentro do diretório do Snes9x. Eu também diminuo o tempo de salvar S-RAM, que é o delay entre o jogador salvar e o emulador escrever o arquivo de save no HD. 0 Desabilita o salvamento automático, o que significa que salvar no jogo e fechar o emulador não salva o jogo, teria de ir antes de fechar o emulador em File → Save Other → Save S-RAM Data.

2) Configurar os controles em Input → Input Configuration. Lembrar de marcar o checkbox de permitir diagonais, configurando-as também.
Imagem

3) Ir em Video → Display configuration. Uso da seguinte forma a minha configuração, usando renderizador OpenGL com shaders, conforme imagem abaixo. Tirando shaders, tem opções mais simples de filtragem, como 2xSal em Output processing que pode ser usada em conjunto com a filtragem bilinear.
Imagem

Com o uso de shaders, desmarco a filtragem bilinear padrão em Video → Bilinear Filtering. Recomendo o uso de shaders, é leve e dependendo do que quiser de resultado, é só encontrar o shader ideal. Os arquivos são texto planos dentro de certos padrões, por exemplo para Direct3D é um padrão, para OpenGL, que é que utilizo, é outro encapsulado em um arquivo XML.
Aqui mostro exemplos dos shaders: Crt-Hyllian que funciona em Direct3D e Crt Shader com curvatura, que é para o OpenGL. Mais abaixo na seção 6 falo mais um pouco sobre.
Imagem
Crt-Hyllian para o renderizador em Direct3D

Imagem
Imagem
CRT shader simulando curvatura da tela para o renderizador em OpenGL

Imagem
Shader 4xSoft-HD-960x592, que apresenta um efeito próximo a um anti-aliasing, combinado com filtragem bilinear


Shaders deixo aqui. Basta copiar o texto e salvar com a extensão cg ou txt mesmo, é só no carregar selecionar “All Files” ao invés de Shaders que permite selecionar qualquer extensão.

Crt Hyllian para renderizador Direct3D:
#pragma parameter InputGamma "Input gamma" 2.4 0.0 5.0 0.1
#pragma parameter OutputGamma "Output Gamma" 2.2 0.0 5.0 0.1
#pragma parameter DILATION_STRENGTH "Dilation Strength" 0.9 0.0 1.0 0.05
#pragma parameter SHARPNESS "Sharpness" 2.0 0.0 5.0 0.1
#pragma parameter RED_BOOST "Red Boost" 1.0 1.0 2.0 0.01
#pragma parameter GREEN_BOOST "Green Boost" 1.0 1.0 2.0 0.01
#pragma parameter SCANLINES_STRENGTH "Scanline Strength" 0.7 0.0 1.0 0.01
#pragma parameter BEAM_MIN_WIDTH "Min. Beam Width" 0.1 0.0 1.0 0.01
#pragma parameter BEAM_MAX_WIDTH "Max Beam Width" 0.7 0.0 1.0 0.01
#pragma parameter COLOR_BOOST "Color Boost" 1.2 1.0 2.0 0.05
#pragma parameter BEAM_WIDTH_SENSITIVITY "Beam Width Sensitivity" 0.5 0.0 1.0 0.01
#pragma parameter CRT_TV_BLUE_TINT "CRT TV Blue Tint" 1.05 1.0 2.0 0.01
#ifdef PARAMETER_UNIFORM
uniform float InputGamma;
uniform float OutputGamma;
uniform float DILATION_STRENGTH;
uniform float SHARPNESS;
uniform float RED_BOOST;
uniform float GREEN_BOOST;
uniform float SCANLINES_STRENGTH;
uniform float BEAM_MIN_WIDTH;
uniform float BEAM_MAX_WIDTH;
uniform float COLOR_BOOST;
uniform float BEAM_WIDTH_SENSITIVITY;
uniform float CRT_TV_BLUE_TINT;
#else
#define InputGamma 2.4
#define OutputGamma 2.2
#define DILATION_STRENGTH 0.9
#define SHARPNESS 2.0
#define RED_BOOST 1.0
#define GREEN_BOOST 1.0
#define SCANLINES_STRENGTH 0.7
#define BEAM_MIN_WIDTH 0.1
#define BEAM_MAX_WIDTH 0.7
#define COLOR_BOOST 1.2
#define BEAM_WIDTH_SENSITIVITY 0.5
#define CRT_TV_BLUE_TINT 1.05
#endif
// END PARAMETERS //

/* COMPATIBILITY
- HLSL compilers
- Cg compilers
*/

/*
Hyllian's CRT Shader

Copyright (C) 2011-2014 Hyllian/Jararaca - sergiogdb@gmail.com

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

// Uncomment to enable anti-ringing to horizontal filter.
#define ANTI_RINGING

// Uncomment to dilate bright pixels horizontally.
#define DILATION

// Uncomment to increase the sharpness of the scanlines.
//#define SHARPER

// Comment next line if you don't desire the phosphor effect.
#define PHOSPHOR

// Uncomment to enable adjustment of red and green saturation.
//#define RED_GREEN_CONTROL

#define GAMMA_IN(color) pow(color, float3(InputGamma, InputGamma, InputGamma))
#define GAMMA_OUT(color) pow(color, float3(1.0 / OutputGamma, 1.0 / OutputGamma, 1.0 / OutputGamma))


// Horizontal cubic filter.

// Some known filters use these values:

// B = 0.0, C = 0.0 => Hermite cubic filter.
// B = 1.0, C = 0.0 => Cubic B-Spline filter.
// B = 0.0, C = 0.5 => Catmull-Rom Spline filter. This is the default used in this shader.
// B = C = 1.0/3.0 => Mitchell-Netravali cubic filter.
// B = 0.3782, C = 0.3109 => Robidoux filter.
// B = 0.2620, C = 0.3690 => Robidoux Sharp filter.
// B = 0.36, C = 0.28 => My best config for ringing elimination in pixel art (Hyllian).


// For more info, see: http://www.imagemagick.org/Usage/img_diagrams/cubic_survey.gif

// Change these params to configure the horizontal filter.
const static float B = 0.0;
const static float C = 0.5;

const static float4x4 invX = float4x4( (-B - 6.0*C)/6.0, (3.0*B + 12.0*C)/6.0, (-3.0*B - 6.0*C)/6.0, B/6.0,
(12.0 - 9.0*B - 6.0*C)/6.0, (-18.0 + 12.0*B + 6.0*C)/6.0, 0.0, (6.0 - 2.0*B)/6.0,
-(12.0 - 9.0*B - 6.0*C)/6.0, (18.0 - 15.0*B - 12.0*C)/6.0, (3.0*B + 6.0*C)/6.0, B/6.0,

(B + 6.0*C)/6.0, -C, 0.0, 0.0);


struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
float frame_count;
float frame_direction;
float frame_rotation;
};


struct out_vertex {
float2 texCoord;
};

/* VERTEX_SHADER */
out_vertex main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
float2 texCoord : TEXCOORD0,

uniform float4x4 modelViewProj,
uniform input IN
)
{
oPosition = mul(modelViewProj, position);

out_vertex OUT = {
texCoord
};

return OUT;
}


float4 main_fragment(in out_vertex VAR, uniform sampler2D s_p : TEXUNIT0, uniform input IN) : COLOR
{
#ifdef SHARPER
float2 TextureSize = float2(SHARPNESS*IN.texture_size.x, IN.texture_size.y);
#else
float2 TextureSize = IN.texture_size;
#endif

float2 dx = float2(1.0/TextureSize.x, 0.0);
float2 dy = float2(0.0, 1.0/TextureSize.y);
float2 pix_coord = VAR.texCoord*TextureSize-float2(0.5,0.0);

float2 tc = (floor(pix_coord)+float2(0.5,0.5))/TextureSize;

float2 fp = frac(pix_coord);

float3 c10 = tex2D(s_p, tc - dx).xyz;
float3 c11 = tex2D(s_p, tc ).xyz;
float3 c12 = tex2D(s_p, tc + dx).xyz;
float3 c13 = tex2D(s_p, tc + 2.0*dx).xyz;

#ifdef ANTI_RINGING
// Get min/max samples
float3 min_sample = min(c11, c12);
float3 max_sample = max(c11, c12);
#endif

float4x3 color_matrix = float4x3(c10, c11, c12, c13);

float4 invX_Px = mul(invX, float4(fp.x*fp.x*fp.x, fp.x*fp.x, fp.x, 1.0));
float3 color = mul(invX_Px, color_matrix);

#ifdef DILATION
float dz = DILATION_STRENGTH*IN.video_size.x/(IN.output_size.x);

float2 fpf = float2(fp.x + dz, fp.y);
float2 fpd = float2(fp.x - dz, fp.y);

invX_Px = mul(invX, float4(fpf.x*fpf.x*fpf.x, fpf.x*fpf.x, fpf.x, 1.0));
float3 colorf = mul(invX_Px, color_matrix);

invX_Px = mul(invX, float4(fpd.x*fpd.x*fpd.x, fpd.x*fpd.x, fpd.x, 1.0));
float3 colord = mul(invX_Px, color_matrix);

color = max(color, max(colorf, colord));
#endif

#ifdef ANTI_RINGING
// Anti-ringing
color = clamp(color, min_sample, max_sample);
#endif

float pos = abs(fp.y - 0.5);

float3 lum = lerp(float3(BEAM_MIN_WIDTH), float3(BEAM_MAX_WIDTH), color);
lum = pow(lum,float3(BEAM_WIDTH_SENSITIVITY));

float3 d = clamp(pos/lum, 0.0, 1.0);

d = smoothstep(0.0, 1.0, 1.0-d);

d = SCANLINES_STRENGTH*(d-1.0)+1.0;

#ifdef RED_GREEN_CONTROL
color.rgb *= float3(RED_BOOST, GREEN_BOOST, CRT_TV_BLUE_TINT);
#else
color.b *= CRT_TV_BLUE_TINT;
#endif

color = clamp(color*d, 0.0, 1.0);

color = GAMMA_IN(color);

#ifdef PHOSPHOR
float mod_factor = VAR.texCoord.x * IN.output_size.x * IN.texture_size.x / IN.video_size.x;

float3 dotMaskWeights = lerp(
float3(1.0, 0.7, 1.0),
float3(0.7, 1.0, 0.7),
floor(fmod(mod_factor, 2.0))
);

color.rgb *= dotMaskWeights;
#endif

color *= COLOR_BOOST;
color = GAMMA_OUT(color);

return float4(color, 1.0);
}



Crt Shader para renderizador OpenGL:
<?xml version="1.0" encoding="UTF-8"?>
<!--
CRT shader

Copyright (C) 2010, 2011 cgwg, Themaister and DOLLS

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.

(cgwg gave their consent to have the original version of this shader
distributed under the GPL in this message:

http://board.byuu.org/viewtopic.php?p=26075#p26075

"Feel free to distribute my shaders under the GPL. After all, the
barrel distortion code was taken from the Curvature shader, which is
under the GPL."
)
-->
<shader language="GLSL">
<vertex><![CDATA[
uniform vec2 rubyInputSize;
uniform vec2 rubyOutputSize;
uniform vec2 rubyTextureSize;

// Define some calculations that will be used in fragment shader.
varying vec2 texCoord;
varying vec2 one;
varying float mod_factor;

void main()
{
// Do the standard vertex processing.
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

// Precalculate a bunch of useful values we'll need in the fragment
// shader.

// Texture coords.
texCoord = gl_MultiTexCoord0.xy;

// The size of one texel, in texture-coordinates.
one = 1.0 / rubyTextureSize;

// Resulting X pixel-coordinate of the pixel we're drawing.
mod_factor = texCoord.x * rubyTextureSize.x * rubyOutputSize.x / rubyInputSize.x;
}
]]></vertex>
<fragment><![CDATA[
uniform sampler2D rubyTexture;
uniform vec2 rubyInputSize;
uniform vec2 rubyOutputSize;
uniform vec2 rubyTextureSize;

varying vec2 texCoord;
varying vec2 one;
varying float mod_factor;

// Comment the next line to disable interpolation in linear gamma (and gain speed).
#define LINEAR_PROCESSING

// Compensate for 16-235 level range as per Rec. 601.
#define REF_LEVELS

// Enable screen curvature.
#define CURVATURE

// Controls the intensity of the barrel distortion used to emulate the
// curvature of a CRT. 0.0 is perfectly flat, 1.0 is annoyingly
// distorted, higher values are increasingly ridiculous.
#define distortion 0.2

// Simulate a CRT gamma of 2.4.
#define inputGamma 2.4

// Compensate for the standard sRGB gamma of 2.2.
#define outputGamma 2.2

// Macros.
#define FIX(c) max(abs(c), 1e-5);
#define PI 3.141592653589

#ifdef REF_LEVELS
# define LEVELS(c) max((c - 16.0 / 255.0) * 255.0 / (235.0 - 16.0), 0.0)
#else
# define LEVELS(c) c
#endif

#ifdef LINEAR_PROCESSING
# define TEX2D(c) pow(LEVELS(texture2D(rubyTexture, (c))), vec4(inputGamma))
#else
# define TEX2D(c) LEVELS(texture2D(rubyTexture, (c)))
#endif

// Apply radial distortion to the given coordinate.
vec2 radialDistortion(vec2 coord)
{
coord *= rubyTextureSize / rubyInputSize;
vec2 cc = coord - 0.5;
float dist = dot(cc, cc) * distortion;
return (coord + cc * (1.0 + dist) * dist) * rubyInputSize / rubyTextureSize;
}

// Calculate the influence of a scanline on the current pixel.
//
// 'distance' is the distance in texture coordinates from the current
// pixel to the scanline in question.
// 'color' is the colour of the scanline at the horizontal location of
// the current pixel.
vec4 scanlineWeights(float distance, vec4 color)
{
// The "width" of the scanline beam is set as 2*(1 + x^4) for
// each RGB channel.
vec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));

// The "weights" lines basically specify the formula that gives
// you the profile of the beam, i.e. the intensity as
// a function of distance from the vertical center of the
// scanline. In this case, it is gaussian if width=2, and
// becomes nongaussian for larger widths. Ideally this should
// be normalized so that the integral across the beam is
// independent of its width. That is, for a narrower beam
// "weights" should have a higher peak at the center of the
// scanline than for a wider beam.
vec4 weights = vec4(distance / 0.3);
return 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);
}

void main()
{
// Here's a helpful diagram to keep in mind while trying to
// understand the code:
//
// | | | | |
// -------------------------------
// | | | | |
// | 01 | 11 | 21 | 31 | <-- current scanline
// | | @ | | |
// -------------------------------
// | | | | |
// | 02 | 12 | 22 | 32 | <-- next scanline
// | | | | |
// -------------------------------
// | | | | |
//
// Each character-cell represents a pixel on the output
// surface, "@" represents the current pixel (always somewhere
// in the bottom half of the current scan-line, or the top-half
// of the next scanline). The grid of lines represents the
// edges of the texels of the underlying texture.

// Texture coordinates of the texel containing the active pixel.
#ifdef CURVATURE
vec2 xy = radialDistortion(texCoord);
#else
vec2 xy = texCoord;
#endif

// Of all the pixels that are mapped onto the texel we are
// currently rendering, which pixel are we currently rendering?
vec2 ratio_scale = xy * rubyTextureSize - vec2(0.5);
vec2 uv_ratio = fract(ratio_scale);

// Snap to the center of the underlying texel.
xy = (floor(ratio_scale) + vec2(0.5)) / rubyTextureSize;

// Calculate Lanczos scaling coefficients describing the effect
// of various neighbour texels in a scanline on the current
// pixel.
vec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);

// Prevent division by zero.
coeffs = FIX(coeffs);

// Lanczos2 kernel.
coeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);

// Normalize.
coeffs /= dot(coeffs, vec4(1.0));

// Calculate the effective colour of the current and next
// scanlines at the horizontal location of the current pixel,
// using the Lanczos coefficients above.
vec4 col = clamp(mat4(
TEX2D(xy + vec2(-one.x, 0.0)),
TEX2D(xy),
TEX2D(xy + vec2(one.x, 0.0)),
TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,
0.0, 1.0);
vec4 col2 = clamp(mat4(
TEX2D(xy + vec2(-one.x, one.y)),
TEX2D(xy + vec2(0.0, one.y)),
TEX2D(xy + one),
TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,
0.0, 1.0);

#ifndef LINEAR_PROCESSING
col = pow(col , vec4(inputGamma));
col2 = pow(col2, vec4(inputGamma));
#endif

// Calculate the influence of the current and next scanlines on
// the current pixel.
vec4 weights = scanlineWeights(uv_ratio.y, col);
vec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);
vec3 mul_res = (col * weights + col2 * weights2).rgb;

// dot-mask emulation:
// Output pixels are alternately tinted green and magenta.
vec3 dotMaskWeights = mix(
vec3(1.0, 0.7, 1.0),
vec3(0.7, 1.0, 0.7),
floor(mod(mod_factor, 2.0))
);

mul_res *= dotMaskWeights;

// Convert the image gamma for display on our output device.
mul_res = pow(mul_res, vec3(1.0 / outputGamma));

// Color the texel.
gl_FragColor = vec4(mul_res, 1.0);
}
]]></fragment>
</shader>


Shader 4xSoft-HD-960x592, que funciona para o renderizador Direct3D:

/*

Copyright (C) 2007 guest(r) - guest.r@gmail.com

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

/*

The 4xSoft shader processes a gfx. surface and redraws it 4x finer.

Note: set scaler to normal2x.

*/

const static half3 dt = half3(1.0, 1.0, 1.0);

struct input
{
half2 video_size;
half2 texture_size;
half2 output_size;
};


struct out_vertex {
half4 position : POSITION;
half4 color : COLOR;
half2 texCoord : TEXCOORD0;
half4 t1 : TEXCOORD1;
half4 t2 : TEXCOORD2;
half4 t3 : TEXCOORD3;
half4 t4 : TEXCOORD4;
half4 t5 : TEXCOORD5;
half4 t6 : TEXCOORD6;
};

/* VERTEX_SHADER */
out_vertex main_vertex
(
half4 position : POSITION,
half4 color : COLOR,
half2 tex : TEXCOORD0,

uniform half4x4 modelViewProj,
uniform input IN
)
{
half2 ps = half2(1.0/960.0, 1.0/592.0);
half dx = ps.x;
half dy = ps.y;
half sx = ps.x * 0.5;
half sy = ps.y * 0.5;


out_vertex OUT = {
mul(modelViewProj, position),
color,
tex,
half4(tex,tex) + half4(-dx, -dy, dx, -dy), // outer diag. texels
half4(tex,tex) + half4(dx, dy, -dx, dy),
half4(tex,tex) + half4(-sx, -sy, sx, -sy), // inner diag. texels
half4(tex,tex) + half4(sx, sy, -sx, sy),
half4(tex,tex) + half4(-dx, 0, dx, 0), // inner hor/vert texels
half4(tex,tex) + half4(0, -dy, 0, dy)
};


return OUT;
}


half4 main_fragment(in out_vertex VAR, uniform sampler2D s_p : TEXUNIT0, uniform input IN) : COLOR
{

half3 c11 = tex2D(s_p, VAR.texCoord).xyz;
half3 c00 = tex2D(s_p, VAR.t1.xy).xyz;
half3 c20 = tex2D(s_p, VAR.t1.zw).xyz;
half3 c22 = tex2D(s_p, VAR.t2.xy).xyz;
half3 c02 = tex2D(s_p, VAR.t2.zw).xyz;
half3 s00 = tex2D(s_p, VAR.t3.xy).xyz;
half3 s20 = tex2D(s_p, VAR.t3.zw).xyz;
half3 s22 = tex2D(s_p, VAR.t4.xy).xyz;
half3 s02 = tex2D(s_p, VAR.t4.zw).xyz;
half3 c01 = tex2D(s_p, VAR.t5.xy).xyz;
half3 c21 = tex2D(s_p, VAR.t5.zw).xyz;
half3 c10 = tex2D(s_p, VAR.t6.xy).xyz;
half3 c12 = tex2D(s_p, VAR.t6.zw).xyz;

half d1=dot(abs(c00-c22),dt)+0.0001;
half d2=dot(abs(c20-c02),dt)+0.0001;
half hl=dot(abs(c01-c21),dt)+0.0001;
half vl=dot(abs(c10-c12),dt)+0.0001;
half m1=dot(abs(c00-c22),dt)+0.001;
half m2=dot(abs(c02-c20),dt)+0.001;

half3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(3.0*(hl+vl));
half3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(3.0*(d1+d2));

return half4(0.25*(t1+t2+(m2*(s00+s22)+m1*(s02+s20))/(m1+m2)),0);
}


4) Jogar. Vá em File → Load Game para carregar um jogo, que pode estar compactado como zip.

5) Saves states podem ser salvos ou carregados em File → Save game position ou File → Load game position. Bem como screenshots em File → Save Other → Screenshot. Normalmente é melhor configurar atalhos para tal em Input → Costumize Hotkeys. Lá dá para configurar, inclusive com multi-teclas (Shift + P por exemplo) funções como save state no slot 1, fast-forward e rewind (esses dois gosto de deixar no controle configurado por exemplo).

6) Shaders simulando TV CRT
Aqui vou deixar algumas imagens de testes que fiz para 2 casos que considero que mais perfeitamente simulam uma Televisão de tubo: CRT-Shader OpenGL e CRT-Lottes usando o higan (sobre o qual falarei posteriormente).

ImagemImagem
Da esquerda para a direita: Crt-Shader, Crt-lottes no higan, que considero o melhor resultado que vi. A imagem inteira usando crt-lottes abaixo:
Imagem
-Uchiha-
-Uchiha- Highlander Registrado
15.4K Mensagens 919 Curtidas
#25 Por -Uchiha-
13/09/2017 - 13:24
Julaes disse:
Muito bom o tópico, gostei bastante! boa.gif
Só não entendi qual o problema de selecionar widescreen no emulador do PS One, você comentou que não recomenda mas não informou o que de ruim acontece caso a opção seja selecionada.


Removi do Guia a parte do "Não recomendo" por ser uma opinião pessoal. Eu particularmente não recomendo pois em jogos 2D, o aspect ratio fica deformado... irei dar uma revisada no tutorial do PSOne acrescentando novas informações... isso_ai.png
-Uchiha-
-Uchiha- Highlander Registrado
15.4K Mensagens 919 Curtidas
#29 Por -Uchiha-
16/09/2017 - 13:18
sephiroth0 disse:
Tutorial de Saturn adicionado.
https://www.hardware.com.br/comunidade/posts/7846875/

Muito bom o Demul Uchiha. Não conhecia.


Eu também! kkkk eu me lembro que o primeiro emulador de Dreamcast que eu rodei foi o Chankast e só de ver a BIOS eu ja fiquei feliz.. depois teve o NullDC mas muitos jogos tinham diversos bugs, à época que eu testei, não me lembro de ter um jogo que rodou 100%... Revisitando agora a emulação do Dreamcast, encontrei o Demul e fiquei de queixo caído... ainda tem problemas mas, muitos jogos totalmente jogáveis... E ainda tem o fato dele rodar jogos de Arcade que eu vou fazer mais para frente um tutorial... ele emula além do Dreamcast, mais umas 4 máquinas Arcade...
afonso220
afonso220 General de Pijama Registrado
3.6K Mensagens 195 Curtidas
#30 Por afonso220
16/09/2017 - 15:03
-Uchiha- disse:
Entendo o questionamento, mas é mais complicado que isso... vou ver o que consigo fazer mais o problema é que os requisitos mínimos variam muito de jogo para jogo. Alguns jogos são mais exigentes que outros, além de em determinados casos, o emulador ser melhor otimizado para X jogo.

De todo modo, vou tentar elaborar uma metodologia para atender isso. isso_ai.png



Valeu Uchiha, entendo que isso deve demandar muito tempo para a tal proeza, mais sempre é bom!. eu curti muito o tópico, só não fui atras
para realizar a emulação devido o meu PC ser simples ( vamos se dizer assim) comparado ao equipamento que foi utilizado para testes.

Sei que os emuladores de jogos antigos do Super, Nintendo 64, Fliperama, PS1 roda tranquilamente, PS2 já tenho minhas duvidas.


Por fim, ótimo tópico. big_green.png
© 1999-2024 Hardware.com.br. Todos os direitos reservados.
Imagem do Modal