{%- assign machine_id = include.id -%} {%- assign machine_type = include.type -%} {%- assign machine_config = include.config -%} {%- assign machine_layout = include.layout -%} {%- capture machine_name -%}{{ include.name | default: "PCjs Machine" }}{%- endcapture -%} {%- assign machine_errors = "" -%} {%- assign machine_does_not_exist = true -%} {%- for candidate in page.machines -%} {%- if candidate.id == machine_id -%} {%- assign machine = candidate -%} {%- if candidate.type -%}{%- assign machine_type = candidate.type -%}{%- endif -%} {%- if candidate.config -%}{%- assign machine_config = candidate.config -%}{%- endif -%} {%- if candidate.layout -%}{%- assign machine_layout = candidate.layout | replace: "/_includes/", "" | replace: ".html", "" -%}{%- endif -%} {%- if candidate.debugger -%}{%- assign machine_debugger = candidate.debugger -%}{%- endif -%} {%- assign machine_does_not_exist = false -%} {%- break -%} {%- endif -%} {%- endfor -%} {%- if machine_config -%} {%- if machine_config contains ".xml" %}
[{{ machine_name }} "{{ machine_id }}"]
Waiting for machine "{{machine_id }}" to load....
Missing machine configuration file: {{ machine_config }}
{%- endcapture -%} {%- endunless -%} {%- else -%} {%- assign machine = nil -%} {%- comment -%}The assumption here is that the page has defined its own layout, styles, and config file, so there's nothing more we need do here.{%- endcomment -%} {%- endif -%} {%- elsif machine -%} {%- unless machine.components -%} {%- assign machine_group = site.data.machines[machine_type].folder | split: '/' -%} {%- unless machine_group[1] %} {%- assign machine = site.data[machine_type][machine_id] -%} {%- else %} {%- assign machine_group = machine_group[0] -%} {%- assign machine = site.data[machine_group][machine_type][machine_id] -%} {%- endunless %} {%- unless machine -%} {%- capture machine_errors %}{{ machine_errors }}Missing machine configuration for {{ machine_id }}
{%- endcapture -%} {%- endunless -%} {%- endunless -%} {%- endif -%} {%- if machine -%} {%- unless machine_data -%} {%- assign machine_data = site.data.machines[machine_type] -%} {%- endunless -%} {%- if machine_name == "PCjs Machine" -%} {%- if machine.name -%} {%- assign machine_name = machine.name -%} {%- elsif machine_type -%} {%- capture machine_name -%}{{ machine_type | upcase | replace:"X86","x86" }} Machine{%- endcapture -%} {%- endif -%} {%- endif -%} {%- assign machine_style = "" -%} {%- if machine.style -%} {%- capture machine_style -%} {%- for style in machine.style -%}{{ style[0] }}:{{style[1]}};{%- endfor -%} {%- endcapture -%} {%- endif -%} {%- assign machine_parms = "" -%} {%- if machine.parms -%} {%- capture machine_parms %} data-value="{ {% for prop in machine.parms %}{{ prop[0] }}:'{{ prop[1] }}',{% endfor %}@ }"{%- endcapture -%} {%- endif %}Missing or invalid component configuration file: {{ config }}
{%- endcapture -%} {%- continue -%} {%- endunless -%} {%- else -%} {%- assign component = machine_component -%} {%- endif -%} {%- assign component_id = machine_component.id | default: component.id %} {%- assign component_config = "" %} {%- assign component_make = component.make | default: machine.make %} {%- assign component_model = component.model | default: machine.model %} {%- if site.developer %} {%- endif %} {%- assign component_title = "" %} {%- assign component_class = "" %} {%- assign component_style = "" %} {%- assign component_controls = "" %} {%- assign component_elements = "" %} {%- capture default_config -%}id:'{{ machine_id }}.{{ component_id }}',name:'{{ component.name }}'{%- endcapture -%} {%- if component.class == "computer" -%} {%- if component.modules -%} {%- capture module_config -%},modules:[{% for module in component.modules %}{ type:'{{ module.type }}',refID:'{{ module.id }}',start:{{ module.start }},end:{{ module.end }} },{% endfor %}@]{%- endcapture -%} {%- capture component_config -%}{ {{ default_config }}{{ module_config | replace: ",@", "" }} }{%- endcapture -%} {%- else -%} {%- capture component_config -%}{ {{ default_config }},autoPower:{{ component.autoPower | default: "true" }},busWidth:{{ component.busWidth | default: "0" }} }{%- endcapture -%} {%- endif -%} {%- elsif component.class == "chipset" -%} {%- capture component_config -%}{ {{ default_config }},model:'{{ component.model }}',scaleTimers:{{ component.scaleTimers | default: "false" }},sw1:'{{ machine_component.sw1 | default: component.sw1 }}',sw2:'{{ machine_component.sw2 | default: component.sw2 }}',sound:{{ component.sound | default: "true" }},floppies:{ {{ component.floppies }} },monitor:'{{ component.monitor }}',dateRTC:'{{ component.dateRTC }}' }{%- endcapture -%} {%- elsif component.class == "cpu" -%} {%- capture component_config -%}{ {{ default_config }},model:'{{ component.model }}',stepping:'{{ component.stepping }}',fpu:{{ component.fpu | default: "0" }},multiplier:{{ component.multiplier | default: "1" }},autoStart:{{ component.autoStart | default: "undefined" }},addrReset:{{ component.addrReset | default: "0" }} }{%- endcapture -%} {%- elsif component.class == "debugger" -%} {%- capture component_config -%}{ {{ default_config }},base:{{ component.base | default: "16" }},commands:'{{ component.commands }}',messages:'{{ component.messages }}' }{%- endcapture -%} {%- elsif component.class == "fdc" -%} {%- if component.autoMount -%} {%- capture component_autoMount -%}{%- for drive in component.autoMount -%}{{ drive[0] }}:{%- if drive[1].name -%}{name:"{{ drive[1].name }}"}{%- else -%}{path:"{{ drive[1].path }}"}{%- endif -%},{%- endfor -%}@{%- endcapture -%} {%- endif -%} {%- capture component_config -%}{ {{ default_config }},autoMount:'{ {{ component_autoMount | replace: ",@", "" }} }',diskettes:'{{ component.diskettes }}',server:'{{ component.server }}' }{%- endcapture -%} {%- elsif component.class == "hdc" -%} {%- capture component_drives -%}{%- for drive in component.drives -%}{ name:"{{ drive.name }}",type:{{ drive.type | default: "3" }},path:"{{ drive.path }}" },{%- endfor -%}@{%- endcapture -%} {%- capture component_config -%}{ {{ default_config }},drives:'[{{ component_drives | replace: ",@", "" }}]',type:'{{ component.type | default: "XT" }}',server:'{{ component.server }}' }{%- endcapture -%} {%- elsif component.class == "keyboard" -%} {%- capture component_config -%}{ {{ default_config }},model:'{{ component.model }}' }{%- endcapture -%} {%- elsif component.class == "mouse" -%} {%- capture component_config -%}{ {{ default_config }},adapter:{{ component.adapter | default: "0" }},binding:'{{ component.binding }}',type:'{{ component.type }}',scaleMouse:{{ component.scaleMouse | default: "0.5" }},serial:'{{ component.serial }}'}{%- endcapture -%} {%- elsif component.class == "panel" -%} {%- capture component_config -%}{ {{ default_config }} }{%- endcapture -%} {%- elsif component.class == "parallel" -%} {%- capture component_config -%}{ {{ default_config }},adapter:{{ component.adapter | default: "0" }},binding:'{{ component.binding }}'}{%- endcapture -%} {%- elsif component.class == "ram" -%} {%- capture component_config -%}{ {{ default_config }},addr:{{ component.addr | default: "0" }},size:{{ component['size'] | default: "0" }},file:'{{ component.file }}',load:{{ component.load | default: "null" }},exec:{{ component.exec | default: "null" }},test:{{ machine_component.test | default: component.test | default: "true" }} }{%- endcapture -%} {%- elsif component.class == "rom" -%} {%- capture component_config -%}{ {{ default_config }},addr:{{ component.addr | default: "0" }},size:{{ component['size'] | default: "0" }},file:'{{ component.file }}',alias:{{ component.alias | default: "null" }},notify:'{{ component.notify }}' }{%- endcapture -%} {%- elsif component.class == "serial" -%} {%- capture component_config -%}{ {{ default_config }},adapter:{{ component.adapter | default: "0" }},binding:'{{ component.binding }}',baudReceive:{{ component.baudReceive | default: "0" }},baudTransmit:{{ component.baudTransmit | default: "0" }},tabSize:{{ component.tabSize | default: "0" }},charBOL:{{ component.charBOL | default: "0" }},upperCase:{{ component.upperCase | default: "false" }} }{%- endcapture -%} {%- elsif component.class == "video" -%} {%- capture component_class %} pcjs-screen{%- endcapture -%} {%- capture component_config -%}{ {{ default_config }},model:'{{ machine_component.model | default: component.model }}',memory:'{{ machine_component.memory | default: component.memory }}',screenWidth:{{ component.screenWidth | default: "640" }},screenHeight:{{ component.screenHeight | default: "400" }},screenColor:'{{ component.screenColor }}',fontROM:'{{ component.fontROM }}',fontColor:'{{ component.fontColor }}',charCols:{{ component.charCols | default: 80 }},charRows:{{ component.charRows | default: 25 }},touchScreen:'{{ component.touchScreen }}',scale:{{ component.scale | default: false }},switches:'{{ component.switches }}',autoLock:{{ component.autoLock | default: false }},aspectRatio:{{ component.aspectRatio | default: 0 }},smoothing:{{ component.smoothing | default: "null" }},flicker:{{ component.flicker | default: 1.0 }} }{%- endcapture -%} {%- capture component_elements %} {%- if component.overlay %} {%- endif %} {% endcapture -%} {%- endif -%} {%- if component_config -%} {%- assign component_style = "" -%} {%- if component.style -%} {%- capture component_style -%} {%- for style in component.style -%}{{ style[0] }}:{{style[1]}};{%- endfor -%} {%- endcapture -%} {%- endif -%} {%- if component.title -%} {%- capture component_title %}{{ machine_name }} does not exist: {{ include.id }}
{%- endif -%} {{ machine_errors }}